Skip to content

Commit 218cb87

Browse files
committed
update specs
1 parent aa922a9 commit 218cb87

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

lib/bashly/commands/add.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class Add < Base
2121
attr_reader :skip_src_check
2222

2323
def run
24+
say "Performing git operations, this may take a while...\n" if lib_source.git?
25+
2426
if args['--list']
2527
show_list
2628
else

lib/bashly/library_source.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ def path
4747

4848
def git_clone
4949
dir = Dir.mktmpdir 'bashly-libs-'
50-
safe_run "git clone --depth 1 #{git_specs[:url]} #{dir}"
51-
safe_run %[git -C "#{dir}" checkout #{git_specs[:ref]}] if git_specs[:ref]
50+
safe_run "git clone --quiet #{git_specs[:url]} #{dir}"
51+
safe_run %[git -C "#{dir}" checkout --quiet #{git_specs[:ref]}] if git_specs[:ref]
5252

5353
"#{dir}#{git_specs[:path]}"
5454
end
@@ -69,7 +69,7 @@ def git_specs
6969
end
7070

7171
def safe_run(cmd)
72-
raise "Failed running command:\nm`#{cmd}`" unless system "#{cmd} > /dev/null 2>&1"
72+
raise "Failed running command:\nm`#{cmd}`" unless system cmd
7373
end
7474

7575
def transform_github_uri

spec/approvals/cli/add/from-github

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Performing git operations, this may take a while...
2+
3+
created spec/tmp/src/lib/database.sh

spec/bashly/commands/add_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,4 +200,13 @@
200200
.to output_approval('cli/add/from-extenal-path')
201201
end
202202
end
203+
204+
context 'with a library from github' do
205+
before { reset_tmp_dir create_src: true }
206+
207+
it 'properly installs the library' do
208+
expect { subject.execute %w[add --source github:dannyben/bashly//spec/fixtures/libraries database] }
209+
.to output_approval('cli/add/from-github')
210+
end
211+
end
203212
end

0 commit comments

Comments
 (0)