chef-dk 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,114 +25,151 @@ describe ChefDK::CookbookProfiler::Git do
25
25
 
26
26
  include ChefDK::Helpers
27
27
 
28
- include_context "setup git cookbooks"
29
-
30
28
  let(:git_profiler) do
31
29
  ChefDK::CookbookProfiler::Git.new(cookbook_path)
32
30
  end
33
31
 
34
- def edit_repo
35
- with_file(File.join(cookbook_path, "README.md"), "ab+") { |f| f.puts "some unpublished changes" }
36
- end
32
+ context "with cookbooks in a valid git repo" do
37
33
 
38
- context "given a clean repo with no remotes" do
34
+ include_context "setup git cookbooks"
39
35
 
40
- it "reports that the repo has no remotes" do
41
- expect(git_profiler.remote).to be_nil
36
+ def edit_repo
37
+ with_file(File.join(cookbook_path, "README.md"), "ab+") { |f| f.puts "some unpublished changes" }
42
38
  end
43
39
 
44
- it "determines the rev of the repo" do
45
- expect(git_profiler.revision).to eq(current_rev)
46
- end
40
+ context "given a clean repo with no remotes" do
47
41
 
48
- it "reports that the repo is clean" do
49
- expect(git_profiler.clean?).to be true
50
- end
42
+ it "reports that the repo has no remotes" do
43
+ expect(git_profiler.remote).to be_nil
44
+ end
51
45
 
52
- it "reports that the commits are unpublished" do
53
- expect(git_profiler.unpublished_commits?).to be true
54
- end
46
+ it "determines the rev of the repo" do
47
+ expect(git_profiler.revision).to eq(current_rev)
48
+ end
55
49
 
56
- it "reports that no remotes have the commits" do
57
- expect(git_profiler.synchronized_remotes).to eq([])
58
- end
50
+ it "reports that the repo is clean" do
51
+ expect(git_profiler.clean?).to be true
52
+ end
59
53
 
60
- end
54
+ it "reports that the commits are unpublished" do
55
+ expect(git_profiler.unpublished_commits?).to be true
56
+ end
61
57
 
62
- context "when the remote is a local branch" do
58
+ it "reports that no remotes have the commits" do
59
+ expect(git_profiler.synchronized_remotes).to eq([])
60
+ end
63
61
 
64
- before do
65
- allow(git_profiler).to receive(:remote_name).and_return(".")
66
62
  end
67
63
 
68
- it "reports that the repo doesn't have a remote" do
69
- expect(git_profiler.have_remote?).to be(false)
64
+ context "when the remote is a local branch" do
65
+
66
+ before do
67
+ allow(git_profiler).to receive(:remote_name).and_return(".")
68
+ end
69
+
70
+ it "reports that the repo doesn't have a remote" do
71
+ expect(git_profiler.have_remote?).to be(false)
72
+ end
73
+
70
74
  end
71
75
 
72
- end
76
+ context "with a remote configured" do
73
77
 
74
- context "with a remote configured" do
78
+ include_context "setup git cookbook remote"
75
79
 
76
- include_context "setup git cookbook remote"
80
+ context "given a clean repo with all commits published to the remote" do
77
81
 
78
- context "given a clean repo with all commits published to the remote" do
82
+ it "determines the remote for the repo" do
83
+ expect(git_profiler.remote).to eq(remote_url)
84
+ end
79
85
 
80
- it "determines the remote for the repo" do
81
- expect(git_profiler.remote).to eq(remote_url)
82
- end
86
+ it "determines the rev of the repo" do
87
+ expect(git_profiler.revision).to eq(current_rev)
88
+ end
83
89
 
84
- it "determines the rev of the repo" do
85
- expect(git_profiler.revision).to eq(current_rev)
86
- end
90
+ it "reports that the repo is clean" do
91
+ expect(git_profiler.clean?).to be true
92
+ end
87
93
 
88
- it "reports that the repo is clean" do
89
- expect(git_profiler.clean?).to be true
90
- end
94
+ it "reports that all commits are published to the upstream" do
95
+ expect(git_profiler.unpublished_commits?).to be false
96
+ end
91
97
 
92
- it "reports that all commits are published to the upstream" do
93
- expect(git_profiler.unpublished_commits?).to be false
94
- end
98
+ it "lists the remotes that commits are published to" do
99
+ expect(git_profiler.synchronized_remotes).to eq(%w[origin/master])
100
+ end
95
101
 
96
- it "lists the remotes that commits are published to" do
97
- expect(git_profiler.synchronized_remotes).to eq(%w[origin/master])
98
102
  end
99
103
 
100
- end
104
+ context "given a clean repo with unpublished changes" do
101
105
 
102
- context "given a clean repo with unpublished changes" do
106
+ before do
107
+ edit_repo
108
+ system_command('git config --local user.name "Alice"', cwd: cookbook_path).error!
109
+ system_command('git config --local user.email "alice@example.com"', cwd: cookbook_path).error!
110
+ system_command('git commit -a -m "update readme" --author "Alice <alice@example.com>"', cwd: cookbook_path).error!
111
+ end
103
112
 
104
- before do
105
- edit_repo
106
- system_command('git config --local user.name "Alice"', cwd: cookbook_path).error!
107
- system_command('git config --local user.email "alice@example.com"', cwd: cookbook_path).error!
108
- system_command('git commit -a -m "update readme" --author "Alice <alice@example.com>"', cwd: cookbook_path).error!
109
- end
113
+ it "reports that the repo is clean" do
114
+ expect(git_profiler.clean?).to be true
115
+ end
116
+
117
+ it "reports that there are unpublished changes" do
118
+ expect(git_profiler.unpublished_commits?).to be true
119
+ end
120
+
121
+ it "reports that no remotes have the commits" do
122
+ expect(git_profiler.synchronized_remotes).to eq([])
123
+ end
110
124
 
111
- it "reports that the repo is clean" do
112
- expect(git_profiler.clean?).to be true
113
125
  end
126
+ end
114
127
 
115
- it "reports that there are unpublished changes" do
116
- expect(git_profiler.unpublished_commits?).to be true
128
+ context "given a dirty repo" do
129
+
130
+ before do
131
+ edit_repo
117
132
  end
118
133
 
119
- it "reports that no remotes have the commits" do
120
- expect(git_profiler.synchronized_remotes).to eq([])
134
+ it "reports that the repo is dirty" do
135
+ expect(git_profiler.clean?).to be false
121
136
  end
122
137
 
123
138
  end
139
+
124
140
  end
125
141
 
126
- context "given a dirty repo" do
142
+ context "given a repo on an unborn master branch" do
143
+
144
+ let(:cookbook_path) { File.join(tempdir, "unborn") }
145
+
146
+ let(:profile_data) { git_profiler.profile_data }
127
147
 
128
148
  before do
129
- edit_repo
149
+ reset_tempdir
150
+ FileUtils.mkdir_p(cookbook_path)
151
+ system_command("git init .", cwd: cookbook_path).error!
130
152
  end
131
153
 
132
- it "reports that the repo is dirty" do
133
- expect(git_profiler.clean?).to be false
154
+ it "does not error when profiling the cookbook" do
155
+ expect { git_profiler.profile_data }.to_not raise_error
134
156
  end
135
157
 
158
+ it "has a nil revision" do
159
+ expect(profile_data["revision"]).to be_nil
160
+ end
161
+
162
+ it "has no remote" do
163
+ expect(profile_data["remote"]).to be_nil
164
+ end
165
+
166
+ it "has no synchronized remote branches" do
167
+ expect(profile_data["synchronized_remote_branches"]).to eq([])
168
+ end
169
+
170
+ it "is not published" do
171
+ expect(profile_data["published"]).to be(false)
172
+ end
136
173
  end
137
174
 
138
175
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-dk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel DeLeo
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-04-30 00:00:00.000000000 Z
13
+ date: 2015-05-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: mixlib-cli
@@ -50,16 +50,22 @@ dependencies:
50
50
  name: ffi-yajl
51
51
  requirement: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '1.0'
56
+ - - "<"
57
+ - !ruby/object:Gem::Version
58
+ version: '3.0'
56
59
  type: :runtime
57
60
  prerelease: false
58
61
  version_requirements: !ruby/object:Gem::Requirement
59
62
  requirements:
60
- - - "~>"
63
+ - - ">="
61
64
  - !ruby/object:Gem::Version
62
65
  version: '1.0'
66
+ - - "<"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
63
69
  - !ruby/object:Gem::Dependency
64
70
  name: chef
65
71
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +142,20 @@ dependencies:
136
142
  - - "~>"
137
143
  - !ruby/object:Gem::Version
138
144
  version: '1.0'
145
+ - !ruby/object:Gem::Dependency
146
+ name: chef-provisioning
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: 1.1.1
152
+ type: :runtime
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - "~>"
157
+ - !ruby/object:Gem::Version
158
+ version: 1.1.1
139
159
  - !ruby/object:Gem::Dependency
140
160
  name: rspec-core
141
161
  requirement: !ruby/object:Gem::Requirement
@@ -217,6 +237,7 @@ files:
217
237
  - lib/chef-dk/command/generator_commands/repo.rb
218
238
  - lib/chef-dk/command/generator_commands/template.rb
219
239
  - lib/chef-dk/command/install.rb
240
+ - lib/chef-dk/command/provision.rb
220
241
  - lib/chef-dk/command/push.rb
221
242
  - lib/chef-dk/command/shell_init.rb
222
243
  - lib/chef-dk/command/update.rb
@@ -334,6 +355,7 @@ files:
334
355
  - spec/unit/command/generator_commands/repo_spec.rb
335
356
  - spec/unit/command/generator_commands/template_spec.rb
336
357
  - spec/unit/command/install_spec.rb
358
+ - spec/unit/command/provision_spec.rb
337
359
  - spec/unit/command/push_spec.rb
338
360
  - spec/unit/command/shell_init_spec.rb
339
361
  - spec/unit/command/update_spec.rb
@@ -386,6 +408,19 @@ files:
386
408
  - spec/unit/fixtures/eg_omnibus_dir/valid/embedded/apps/test-kitchen/verify_me
387
409
  - spec/unit/fixtures/eg_omnibus_dir/valid/embedded/bin/.keep
388
410
  - spec/unit/fixtures/example_app/Policyfile.rb
411
+ - spec/unit/fixtures/example_cookbook/.git/HEAD
412
+ - spec/unit/fixtures/example_cookbook/.git/config
413
+ - spec/unit/fixtures/example_cookbook/.git/description
414
+ - spec/unit/fixtures/example_cookbook/.git/hooks/applypatch-msg.sample
415
+ - spec/unit/fixtures/example_cookbook/.git/hooks/commit-msg.sample
416
+ - spec/unit/fixtures/example_cookbook/.git/hooks/post-update.sample
417
+ - spec/unit/fixtures/example_cookbook/.git/hooks/pre-applypatch.sample
418
+ - spec/unit/fixtures/example_cookbook/.git/hooks/pre-commit.sample
419
+ - spec/unit/fixtures/example_cookbook/.git/hooks/pre-push.sample
420
+ - spec/unit/fixtures/example_cookbook/.git/hooks/pre-rebase.sample
421
+ - spec/unit/fixtures/example_cookbook/.git/hooks/prepare-commit-msg.sample
422
+ - spec/unit/fixtures/example_cookbook/.git/hooks/update.sample
423
+ - spec/unit/fixtures/example_cookbook/.git/info/exclude
389
424
  - spec/unit/fixtures/example_cookbook/.gitignore
390
425
  - spec/unit/fixtures/example_cookbook/.kitchen.yml
391
426
  - spec/unit/fixtures/example_cookbook/Berksfile
@@ -393,6 +428,19 @@ files:
393
428
  - spec/unit/fixtures/example_cookbook/chefignore
394
429
  - spec/unit/fixtures/example_cookbook/metadata.rb
395
430
  - spec/unit/fixtures/example_cookbook/recipes/default.rb
431
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/HEAD
432
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/config
433
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/description
434
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/hooks/applypatch-msg.sample
435
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/hooks/commit-msg.sample
436
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/hooks/post-update.sample
437
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/hooks/pre-applypatch.sample
438
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/hooks/pre-commit.sample
439
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/hooks/pre-push.sample
440
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/hooks/pre-rebase.sample
441
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/hooks/prepare-commit-msg.sample
442
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/hooks/update.sample
443
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/info/exclude
396
444
  - spec/unit/fixtures/example_cookbook_metadata_json_only/.gitignore
397
445
  - spec/unit/fixtures/example_cookbook_metadata_json_only/.kitchen.yml
398
446
  - spec/unit/fixtures/example_cookbook_metadata_json_only/Berksfile
@@ -400,6 +448,19 @@ files:
400
448
  - spec/unit/fixtures/example_cookbook_metadata_json_only/chefignore
401
449
  - spec/unit/fixtures/example_cookbook_metadata_json_only/metadata.json
402
450
  - spec/unit/fixtures/example_cookbook_metadata_json_only/recipes/default.rb
451
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/HEAD
452
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/config
453
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/description
454
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/hooks/applypatch-msg.sample
455
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/hooks/commit-msg.sample
456
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/hooks/post-update.sample
457
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/hooks/pre-applypatch.sample
458
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/hooks/pre-commit.sample
459
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/hooks/pre-push.sample
460
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/hooks/pre-rebase.sample
461
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/hooks/prepare-commit-msg.sample
462
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/hooks/update.sample
463
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/info/exclude
403
464
  - spec/unit/fixtures/example_cookbook_no_metadata/.gitignore
404
465
  - spec/unit/fixtures/example_cookbook_no_metadata/.kitchen.yml
405
466
  - spec/unit/fixtures/example_cookbook_no_metadata/Berksfile
@@ -474,7 +535,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
474
535
  version: '0'
475
536
  requirements: []
476
537
  rubyforge_project:
477
- rubygems_version: 2.4.2
538
+ rubygems_version: 2.4.6
478
539
  signing_key:
479
540
  specification_version: 4
480
541
  summary: A streamlined development and deployment workflow for Chef platform.
@@ -504,6 +565,7 @@ test_files:
504
565
  - spec/unit/command/generator_commands/repo_spec.rb
505
566
  - spec/unit/command/generator_commands/template_spec.rb
506
567
  - spec/unit/command/install_spec.rb
568
+ - spec/unit/command/provision_spec.rb
507
569
  - spec/unit/command/push_spec.rb
508
570
  - spec/unit/command/shell_init_spec.rb
509
571
  - spec/unit/command/update_spec.rb
@@ -556,6 +618,19 @@ test_files:
556
618
  - spec/unit/fixtures/eg_omnibus_dir/valid/embedded/apps/test-kitchen/verify_me
557
619
  - spec/unit/fixtures/eg_omnibus_dir/valid/embedded/bin/.keep
558
620
  - spec/unit/fixtures/example_app/Policyfile.rb
621
+ - spec/unit/fixtures/example_cookbook/.git/HEAD
622
+ - spec/unit/fixtures/example_cookbook/.git/config
623
+ - spec/unit/fixtures/example_cookbook/.git/description
624
+ - spec/unit/fixtures/example_cookbook/.git/hooks/applypatch-msg.sample
625
+ - spec/unit/fixtures/example_cookbook/.git/hooks/commit-msg.sample
626
+ - spec/unit/fixtures/example_cookbook/.git/hooks/post-update.sample
627
+ - spec/unit/fixtures/example_cookbook/.git/hooks/pre-applypatch.sample
628
+ - spec/unit/fixtures/example_cookbook/.git/hooks/pre-commit.sample
629
+ - spec/unit/fixtures/example_cookbook/.git/hooks/pre-push.sample
630
+ - spec/unit/fixtures/example_cookbook/.git/hooks/pre-rebase.sample
631
+ - spec/unit/fixtures/example_cookbook/.git/hooks/prepare-commit-msg.sample
632
+ - spec/unit/fixtures/example_cookbook/.git/hooks/update.sample
633
+ - spec/unit/fixtures/example_cookbook/.git/info/exclude
559
634
  - spec/unit/fixtures/example_cookbook/.gitignore
560
635
  - spec/unit/fixtures/example_cookbook/.kitchen.yml
561
636
  - spec/unit/fixtures/example_cookbook/Berksfile
@@ -563,6 +638,19 @@ test_files:
563
638
  - spec/unit/fixtures/example_cookbook/chefignore
564
639
  - spec/unit/fixtures/example_cookbook/metadata.rb
565
640
  - spec/unit/fixtures/example_cookbook/recipes/default.rb
641
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/HEAD
642
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/config
643
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/description
644
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/hooks/applypatch-msg.sample
645
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/hooks/commit-msg.sample
646
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/hooks/post-update.sample
647
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/hooks/pre-applypatch.sample
648
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/hooks/pre-commit.sample
649
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/hooks/pre-push.sample
650
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/hooks/pre-rebase.sample
651
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/hooks/prepare-commit-msg.sample
652
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/hooks/update.sample
653
+ - spec/unit/fixtures/example_cookbook_metadata_json_only/.git/info/exclude
566
654
  - spec/unit/fixtures/example_cookbook_metadata_json_only/.gitignore
567
655
  - spec/unit/fixtures/example_cookbook_metadata_json_only/.kitchen.yml
568
656
  - spec/unit/fixtures/example_cookbook_metadata_json_only/Berksfile
@@ -570,6 +658,19 @@ test_files:
570
658
  - spec/unit/fixtures/example_cookbook_metadata_json_only/chefignore
571
659
  - spec/unit/fixtures/example_cookbook_metadata_json_only/metadata.json
572
660
  - spec/unit/fixtures/example_cookbook_metadata_json_only/recipes/default.rb
661
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/HEAD
662
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/config
663
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/description
664
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/hooks/applypatch-msg.sample
665
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/hooks/commit-msg.sample
666
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/hooks/post-update.sample
667
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/hooks/pre-applypatch.sample
668
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/hooks/pre-commit.sample
669
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/hooks/pre-push.sample
670
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/hooks/pre-rebase.sample
671
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/hooks/prepare-commit-msg.sample
672
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/hooks/update.sample
673
+ - spec/unit/fixtures/example_cookbook_no_metadata/.git/info/exclude
573
674
  - spec/unit/fixtures/example_cookbook_no_metadata/.gitignore
574
675
  - spec/unit/fixtures/example_cookbook_no_metadata/.kitchen.yml
575
676
  - spec/unit/fixtures/example_cookbook_no_metadata/Berksfile
@@ -625,3 +726,4 @@ test_files:
625
726
  - spec/unit/service_exception_inspectors/base_spec.rb
626
727
  - spec/unit/service_exception_inspectors/http_spec.rb
627
728
  - spec/unit/shell_out_spec.rb
729
+ has_rdoc: