chef-dk 1.6.11 → 2.0.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +25 -38
  3. data/Gemfile.lock +199 -199
  4. data/README.md +4 -2
  5. data/Rakefile +1 -2
  6. data/acceptance/Gemfile +1 -1
  7. data/acceptance/Gemfile.lock +23 -21
  8. data/chef-dk.gemspec +4 -6
  9. data/lib/chef-dk/builtin_commands.rb +1 -1
  10. data/lib/chef-dk/chef_runner.rb +1 -1
  11. data/lib/chef-dk/cli.rb +1 -0
  12. data/lib/chef-dk/command/generate.rb +5 -2
  13. data/lib/chef-dk/command/generator_commands/helpers.rb +36 -0
  14. data/lib/chef-dk/command/generator_commands/{lwrp.rb → resource.rb} +4 -4
  15. data/lib/chef-dk/command/update.rb +11 -18
  16. data/lib/chef-dk/command/verify.rb +1 -16
  17. data/lib/chef-dk/commands_map.rb +3 -3
  18. data/lib/chef-dk/policyfile/artifactory_cookbook_source.rb +102 -0
  19. data/lib/chef-dk/policyfile/cookbook_location_specification.rb +2 -2
  20. data/lib/chef-dk/policyfile/cookbook_sources.rb +1 -0
  21. data/lib/chef-dk/policyfile/dsl.rb +10 -0
  22. data/lib/chef-dk/policyfile/solution_dependencies.rb +15 -1
  23. data/lib/chef-dk/policyfile_lock.rb +1 -1
  24. data/lib/chef-dk/policyfile_services/install.rb +30 -2
  25. data/lib/chef-dk/skeletons/code_generator/files/default/Berksfile +1 -0
  26. data/lib/chef-dk/skeletons/code_generator/files/default/build_cookbook/test-fixture-recipe.rb +1 -0
  27. data/lib/chef-dk/skeletons/code_generator/files/default/cookbook_readmes/README.md +2 -2
  28. data/lib/chef-dk/skeletons/code_generator/files/default/delivery-config.json +3 -0
  29. data/lib/chef-dk/skeletons/code_generator/files/default/delivery-project.toml +1 -1
  30. data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/attributes/default.rb +1 -0
  31. data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/metadata.rb +2 -1
  32. data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/recipes/default.rb +1 -0
  33. data/lib/chef-dk/skeletons/code_generator/files/default/spec_helper.rb +1 -0
  34. data/lib/chef-dk/skeletons/code_generator/files/default/spec_helper_policyfile.rb +1 -0
  35. data/lib/chef-dk/skeletons/code_generator/metadata.rb +3 -2
  36. data/lib/chef-dk/skeletons/code_generator/recipes/app.rb +1 -1
  37. data/lib/chef-dk/skeletons/code_generator/recipes/attribute.rb +1 -0
  38. data/lib/chef-dk/skeletons/code_generator/recipes/build_cookbook.rb +7 -12
  39. data/lib/chef-dk/skeletons/code_generator/recipes/cookbook.rb +1 -0
  40. data/lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb +1 -0
  41. data/lib/chef-dk/skeletons/code_generator/recipes/helpers.rb +21 -0
  42. data/lib/chef-dk/skeletons/code_generator/recipes/policyfile.rb +1 -0
  43. data/lib/chef-dk/skeletons/code_generator/recipes/recipe.rb +1 -0
  44. data/lib/chef-dk/skeletons/code_generator/recipes/repo.rb +1 -0
  45. data/lib/chef-dk/skeletons/code_generator/recipes/{lwrp.rb → resource.rb} +1 -11
  46. data/lib/chef-dk/skeletons/code_generator/recipes/template.rb +3 -3
  47. data/lib/chef-dk/skeletons/code_generator/templates/default/helpers.rb.erb +39 -0
  48. data/lib/chef-dk/skeletons/code_generator/templates/default/metadata.rb.erb +1 -1
  49. data/lib/chef-dk/skeletons/code_generator/templates/default/resource.rb.erb +1 -0
  50. data/lib/chef-dk/version.rb +2 -2
  51. data/omnibus_overrides.rb +14 -12
  52. data/spec/unit/command/generator_commands/cookbook_spec.rb +7 -1
  53. data/spec/unit/command/generator_commands/helpers_spec.rb +31 -0
  54. data/spec/unit/command/generator_commands/{lwrp_spec.rb → resource_spec.rb} +5 -5
  55. data/spec/unit/command/install_spec.rb +2 -2
  56. data/spec/unit/command/update_spec.rb +11 -3
  57. data/spec/unit/command/verify_spec.rb +2 -1
  58. data/spec/unit/policyfile/artifactory_cookbook_source_spec.rb +59 -0
  59. data/spec/unit/policyfile/read_cookbook_for_compat_mode_upload_spec.rb +1 -1
  60. data/spec/unit/policyfile/solution_dependencies_spec.rb +25 -0
  61. data/spec/unit/policyfile_demands_spec.rb +2 -1
  62. data/spec/unit/policyfile_lock_build_spec.rb +23 -21
  63. data/spec/unit/policyfile_lock_install_spec.rb +2 -2
  64. data/spec/unit/policyfile_lock_validation_spec.rb +3 -3
  65. data/spec/unit/policyfile_services/export_repo_spec.rb +6 -6
  66. data/spec/unit/policyfile_services/install_spec.rb +1 -1
  67. data/spec/unit/policyfile_services/update_spec.rb +143 -0
  68. data/tasks/announce.rb +3 -2
  69. data/tasks/dependencies.rb +35 -111
  70. data/tasks/github_changelog_generator.rb +0 -3
  71. data/tasks/templates/prerelease.md.erb +1 -1
  72. data/tasks/templates/release.md.erb +1 -1
  73. metadata +20 -38
  74. data/lib/chef-dk/skeletons/code_generator/templates/default/provider.rb.erb +0 -0
  75. data/spec/unit/gemfile_util_spec.rb +0 -41
  76. data/spec/unit/helpers_spec.rb +0 -120
  77. data/spec/unit/tasks/helpers_spec.rb +0 -75
  78. data/tasks/bin/bundle-platform +0 -19
  79. data/tasks/bin/create-override-gemfile +0 -110
  80. data/tasks/bundle.rb +0 -96
  81. data/tasks/bundle_util.rb +0 -110
  82. data/tasks/gemfile_util.rb +0 -435
  83. data/tasks/helpers.rb +0 -47
  84. data/version_policy.rb +0 -142
@@ -38,9 +38,6 @@ begin
38
38
  config.between_tags = ["v#{latest_stable_version}", "v#{ChefDK::VERSION}"]
39
39
  config.max_issues = 0
40
40
  config.add_issues_wo_labels = false
41
- config.enhancement_labels = "enhancement,Enhancement,New Feature,Feature".split(",")
42
- config.bug_labels = "bug,Bug,Improvement,Upstream Bug".split(",")
43
- config.exclude_labels = "duplicate,question,invalid,wontfix,no_changelog,Exclude From Changelog,Question,Discussion".split(",")
44
41
  config.header = "This changelog reflects the current state of chef-dk's master branch on github and may not reflect the current released version of chef-dk, which is [![Gem Version](https://badge.fury.io/rb/chef-dk.svg)](https://badge.fury.io/rb/chef-dk)."
45
42
  end
46
43
  end
@@ -1,6 +1,6 @@
1
1
  Ohai Chefs!
2
2
 
3
- We have selected <%= @version %> as our ChefDK v<%= @version %> release candidate which is scheduled for release on <%= @date.strftime('%A %B %-d, %Y') %>.
3
+ We have selected <%= @version %> as our ChefDK v<%= @maj_minor %> release candidate which is scheduled for release on <%= @date.strftime('%A %B %-d, %Y') %>.
4
4
 
5
5
  # Release Highlights
6
6
 
@@ -1,6 +1,6 @@
1
1
  Ohai Chefs!
2
2
 
3
- We're happy to announce the release of ChefDK v<%= @version %>!
3
+ We're happy to announce the release of ChefDK v<%= @maj_minor %>!
4
4
 
5
5
  # Release Highlights
6
6
 
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: 1.6.11
4
+ version: 2.0.26
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: 2017-11-29 00:00:00.000000000 Z
13
+ date: 2017-07-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: mixlib-cli
@@ -80,14 +80,14 @@ dependencies:
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '12.5'
83
+ version: '13.0'
84
84
  type: :runtime
85
85
  prerelease: false
86
86
  version_requirements: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: '12.5'
90
+ version: '13.0'
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: solve
93
93
  requirement: !ruby/object:Gem::Requirement
@@ -184,20 +184,6 @@ dependencies:
184
184
  - - "~>"
185
185
  - !ruby/object:Gem::Version
186
186
  version: '2.0'
187
- - !ruby/object:Gem::Dependency
188
- name: rake
189
- requirement: !ruby/object:Gem::Requirement
190
- requirements:
191
- - - ">="
192
- - !ruby/object:Gem::Version
193
- version: '0'
194
- type: :development
195
- prerelease: false
196
- version_requirements: !ruby/object:Gem::Requirement
197
- requirements:
198
- - - ">="
199
- - !ruby/object:Gem::Version
200
- version: '0'
201
187
  - !ruby/object:Gem::Dependency
202
188
  name: rspec-core
203
189
  requirement: !ruby/object:Gem::Requirement
@@ -300,10 +286,11 @@ files:
300
286
  - lib/chef-dk/command/generator_commands/cookbook_code_file.rb
301
287
  - lib/chef-dk/command/generator_commands/cookbook_file.rb
302
288
  - lib/chef-dk/command/generator_commands/generator_generator.rb
303
- - lib/chef-dk/command/generator_commands/lwrp.rb
289
+ - lib/chef-dk/command/generator_commands/helpers.rb
304
290
  - lib/chef-dk/command/generator_commands/policyfile.rb
305
291
  - lib/chef-dk/command/generator_commands/recipe.rb
306
292
  - lib/chef-dk/command/generator_commands/repo.rb
293
+ - lib/chef-dk/command/generator_commands/resource.rb
307
294
  - lib/chef-dk/command/generator_commands/template.rb
308
295
  - lib/chef-dk/command/install.rb
309
296
  - lib/chef-dk/command/provision.rb
@@ -329,6 +316,7 @@ files:
329
316
  - lib/chef-dk/generator.rb
330
317
  - lib/chef-dk/helpers.rb
331
318
  - lib/chef-dk/pager.rb
319
+ - lib/chef-dk/policyfile/artifactory_cookbook_source.rb
332
320
  - lib/chef-dk/policyfile/chef_repo_cookbook_source.rb
333
321
  - lib/chef-dk/policyfile/chef_server_cookbook_source.rb
334
322
  - lib/chef-dk/policyfile/community_cookbook_source.rb
@@ -400,10 +388,11 @@ files:
400
388
  - lib/chef-dk/skeletons/code_generator/recipes/build_cookbook.rb
401
389
  - lib/chef-dk/skeletons/code_generator/recipes/cookbook.rb
402
390
  - lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb
403
- - lib/chef-dk/skeletons/code_generator/recipes/lwrp.rb
391
+ - lib/chef-dk/skeletons/code_generator/recipes/helpers.rb
404
392
  - lib/chef-dk/skeletons/code_generator/recipes/policyfile.rb
405
393
  - lib/chef-dk/skeletons/code_generator/recipes/recipe.rb
406
394
  - lib/chef-dk/skeletons/code_generator/recipes/repo.rb
395
+ - lib/chef-dk/skeletons/code_generator/recipes/resource.rb
407
396
  - lib/chef-dk/skeletons/code_generator/recipes/template.rb
408
397
  - lib/chef-dk/skeletons/code_generator/templates/default/LICENSE.all_rights.erb
409
398
  - lib/chef-dk/skeletons/code_generator/templates/default/LICENSE.apachev2.erb
@@ -417,11 +406,11 @@ files:
417
406
  - lib/chef-dk/skeletons/code_generator/templates/default/build_cookbook/metadata.rb.erb
418
407
  - lib/chef-dk/skeletons/code_generator/templates/default/build_cookbook/recipe.rb.erb
419
408
  - lib/chef-dk/skeletons/code_generator/templates/default/cookbook_file.erb
409
+ - lib/chef-dk/skeletons/code_generator/templates/default/helpers.rb.erb
420
410
  - lib/chef-dk/skeletons/code_generator/templates/default/inspec_default_test.rb.erb
421
411
  - lib/chef-dk/skeletons/code_generator/templates/default/kitchen.yml.erb
422
412
  - lib/chef-dk/skeletons/code_generator/templates/default/kitchen_policyfile.yml.erb
423
413
  - lib/chef-dk/skeletons/code_generator/templates/default/metadata.rb.erb
424
- - lib/chef-dk/skeletons/code_generator/templates/default/provider.rb.erb
425
414
  - lib/chef-dk/skeletons/code_generator/templates/default/recipe.rb.erb
426
415
  - lib/chef-dk/skeletons/code_generator/templates/default/recipe_spec.rb.erb
427
416
  - lib/chef-dk/skeletons/code_generator/templates/default/repo/gitignore.erb
@@ -461,10 +450,11 @@ files:
461
450
  - spec/unit/command/generator_commands/cookbook_file_spec.rb
462
451
  - spec/unit/command/generator_commands/cookbook_spec.rb
463
452
  - spec/unit/command/generator_commands/generator_generator_spec.rb
464
- - spec/unit/command/generator_commands/lwrp_spec.rb
453
+ - spec/unit/command/generator_commands/helpers_spec.rb
465
454
  - spec/unit/command/generator_commands/policyfile_spec.rb
466
455
  - spec/unit/command/generator_commands/recipe_spec.rb
467
456
  - spec/unit/command/generator_commands/repo_spec.rb
457
+ - spec/unit/command/generator_commands/resource_spec.rb
468
458
  - spec/unit/command/generator_commands/template_spec.rb
469
459
  - spec/unit/command/install_spec.rb
470
460
  - spec/unit/command/provision_spec.rb
@@ -569,10 +559,9 @@ files:
569
559
  - spec/unit/fixtures/local_path_cookbooks/noignore-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/README.md
570
560
  - spec/unit/fixtures/local_path_cookbooks/noignore-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/metadata.rb
571
561
  - spec/unit/fixtures/local_path_cookbooks/noignore-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/recipes/default.rb
572
- - spec/unit/gemfile_util_spec.rb
573
562
  - spec/unit/generator_spec.rb
574
- - spec/unit/helpers_spec.rb
575
563
  - spec/unit/pager_spec.rb
564
+ - spec/unit/policyfile/artifactory_cookbook_source_spec.rb
576
565
  - spec/unit/policyfile/chef_repo_cookbook_source_spec.rb
577
566
  - spec/unit/policyfile/chef_server_cookbook_source_spec.rb
578
567
  - spec/unit/policyfile/community_cookbook_source_spec.rb
@@ -609,24 +598,17 @@ files:
609
598
  - spec/unit/policyfile_services/show_policy_spec.rb
610
599
  - spec/unit/policyfile_services/undelete_spec.rb
611
600
  - spec/unit/policyfile_services/update_attributes_spec.rb
601
+ - spec/unit/policyfile_services/update_spec.rb
612
602
  - spec/unit/service_exception_inspectors/base_spec.rb
613
603
  - spec/unit/service_exception_inspectors/http_spec.rb
614
604
  - spec/unit/shell_out_spec.rb
615
- - spec/unit/tasks/helpers_spec.rb
616
605
  - tasks/announce.rb
617
- - tasks/bin/bundle-platform
618
606
  - tasks/bin/bundle-platform.bat
619
- - tasks/bin/create-override-gemfile
620
- - tasks/bundle.rb
621
- - tasks/bundle_util.rb
622
607
  - tasks/dependencies.rb
623
- - tasks/gemfile_util.rb
624
608
  - tasks/github_changelog_generator.rb
625
- - tasks/helpers.rb
626
609
  - tasks/templates/prerelease.md.erb
627
610
  - tasks/templates/release.md.erb
628
611
  - tasks/version.rb
629
- - version_policy.rb
630
612
  - warning.txt
631
613
  homepage: https://www.chef.io/
632
614
  licenses: []
@@ -648,7 +630,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
648
630
  requirements:
649
631
  - - ">="
650
632
  - !ruby/object:Gem::Version
651
- version: '2.2'
633
+ version: '2.3'
652
634
  required_rubygems_version: !ruby/object:Gem::Requirement
653
635
  requirements:
654
636
  - - ">="
@@ -656,7 +638,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
656
638
  version: '0'
657
639
  requirements: []
658
640
  rubyforge_project:
659
- rubygems_version: 2.6.14
641
+ rubygems_version: 2.6.11
660
642
  signing_key:
661
643
  specification_version: 4
662
644
  summary: A streamlined development and deployment workflow for Chef platform.
@@ -691,10 +673,11 @@ test_files:
691
673
  - spec/unit/command/generator_commands/cookbook_file_spec.rb
692
674
  - spec/unit/command/generator_commands/cookbook_spec.rb
693
675
  - spec/unit/command/generator_commands/generator_generator_spec.rb
694
- - spec/unit/command/generator_commands/lwrp_spec.rb
676
+ - spec/unit/command/generator_commands/helpers_spec.rb
695
677
  - spec/unit/command/generator_commands/policyfile_spec.rb
696
678
  - spec/unit/command/generator_commands/recipe_spec.rb
697
679
  - spec/unit/command/generator_commands/repo_spec.rb
680
+ - spec/unit/command/generator_commands/resource_spec.rb
698
681
  - spec/unit/command/generator_commands/template_spec.rb
699
682
  - spec/unit/command/install_spec.rb
700
683
  - spec/unit/command/provision_spec.rb
@@ -799,10 +782,9 @@ test_files:
799
782
  - spec/unit/fixtures/local_path_cookbooks/noignore-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/README.md
800
783
  - spec/unit/fixtures/local_path_cookbooks/noignore-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/metadata.rb
801
784
  - spec/unit/fixtures/local_path_cookbooks/noignore-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/recipes/default.rb
802
- - spec/unit/gemfile_util_spec.rb
803
785
  - spec/unit/generator_spec.rb
804
- - spec/unit/helpers_spec.rb
805
786
  - spec/unit/pager_spec.rb
787
+ - spec/unit/policyfile/artifactory_cookbook_source_spec.rb
806
788
  - spec/unit/policyfile/chef_repo_cookbook_source_spec.rb
807
789
  - spec/unit/policyfile/chef_server_cookbook_source_spec.rb
808
790
  - spec/unit/policyfile/community_cookbook_source_spec.rb
@@ -839,7 +821,7 @@ test_files:
839
821
  - spec/unit/policyfile_services/show_policy_spec.rb
840
822
  - spec/unit/policyfile_services/undelete_spec.rb
841
823
  - spec/unit/policyfile_services/update_attributes_spec.rb
824
+ - spec/unit/policyfile_services/update_spec.rb
842
825
  - spec/unit/service_exception_inspectors/base_spec.rb
843
826
  - spec/unit/service_exception_inspectors/http_spec.rb
844
827
  - spec/unit/shell_out_spec.rb
845
- - spec/unit/tasks/helpers_spec.rb
@@ -1,41 +0,0 @@
1
- require "spec_helper"
2
- require_relative "../../tasks/gemfile_util"
3
-
4
- class GemfileSuper
5
- def gem(*args)
6
- :superclass
7
- end
8
- end
9
-
10
- class GemfileUtilUser < GemfileSuper
11
- include GemfileUtil
12
- end
13
-
14
- describe GemfileUtil do
15
- let (:gem_name) { "uncle_bobs_json_parser" }
16
- let (:gemfile_util) { GemfileUtilUser.new }
17
-
18
- context "#gem", :skip do
19
- it "calls the superclass method by default" do
20
- expect(gemfile_util).to receive(:gem).and_return(:superclass)
21
- gemfile_util.gem(gem_name)
22
- end
23
-
24
- # :path and :override follow the same code path, but for clarity get unrefactored specs.
25
- it "overrides gems with :path" do
26
- expect(gemfile_util).to receive(:warn_if_replacing)
27
- expect(gemfile_util.gem(gem_name, path: true)).to be_nil
28
- expect(gemfile_util.overridden_gems).to eq({ gem_name => [{ path: true }] })
29
- end
30
-
31
- it "overrides gems with :override" do
32
- expect(gemfile_util).to receive(:warn_if_replacing)
33
- expect(gemfile_util.gem(gem_name, override: true)).to be_nil
34
- expect(gemfile_util.overridden_gems).to eq({ gem_name => [{}] })
35
- end
36
-
37
- it "does not override gems with :overrideable" do
38
- expect(gemfile_util.gem(gem_name, override: true)).to be_nil
39
- end
40
- end
41
- end
@@ -1,120 +0,0 @@
1
- #
2
- # Copyright:: Copyright (c) 2014 Chef Software Inc.
3
- # License:: Apache License, Version 2.0
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
- #
17
-
18
- require "spec_helper"
19
- require "chef-dk/helpers"
20
-
21
- describe ChefDK::Helpers do
22
-
23
- let (:helpers) do
24
- ChefDK::Helpers.send(:reset!)
25
- ChefDK::Helpers
26
- end
27
-
28
- let(:env) { {} }
29
-
30
- describe "chefdk_home" do
31
- before do
32
- allow(ENV).to receive(:[]) do |k|
33
- env[k]
34
- end
35
- allow(Chef::Platform).to receive(:windows?).and_return(false)
36
- end
37
-
38
- context "when CHEFDK_HOME is set" do
39
- let(:env) { { "CHEFDK_HOME" => "foo" } }
40
- it "returns CHEFDK_HOME" do
41
- expect(helpers.chefdk_home).to eq(env["CHEFDK_HOME"])
42
- end
43
- end
44
-
45
- context "when CHEFDK_HOME is not set" do
46
- context "on windows" do
47
- before do
48
- allow(Chef::Platform).to receive(:windows?).and_return(true)
49
- end
50
-
51
- let(:env) { { "LOCALAPPDATA" => 'C:\\foo' } }
52
-
53
- it "uses LOCALAPPDATA" do
54
- expect(File).to receive(:join).with(env["LOCALAPPDATA"], "chefdk").and_return("chefdkdefaulthome")
55
- expect(helpers.chefdk_home).to eq("chefdkdefaulthome")
56
- end
57
- end
58
-
59
- context "on *nix" do
60
- it "uses LOCALAPPDATA" do
61
- expect(File).to receive(:expand_path).with("~/.chefdk").and_return("chefdkdefaulthome")
62
- expect(helpers.chefdk_home).to eq("chefdkdefaulthome")
63
- end
64
- end
65
- end
66
-
67
- context "using usr_bin_prefix" do
68
- before do
69
- stub_const("RUBY_PLATFORM", ruby_platform_string)
70
- end
71
-
72
- context "on Mac" do
73
- let(:ruby_platform_string) { "x86_64-darwin12.0" }
74
-
75
- it "uses /usr/local/bin" do
76
- expect(helpers.usr_bin_prefix).to eq("/usr/local/bin")
77
- expect(helpers.usr_bin_path("berks")).to eq("/usr/local/bin/berks")
78
- end
79
- end
80
-
81
- context "on other systems" do
82
- let(:ruby_platform_string) { "x86_64-linux" }
83
-
84
- it "uses /usr/bin" do
85
- expect(helpers.usr_bin_prefix).to eq("/usr/bin")
86
- expect(helpers.usr_bin_path("berks")).to eq("/usr/bin/berks")
87
- end
88
- end
89
- end
90
-
91
- end
92
-
93
- describe "omnibus_env" do
94
- let(:git_tools_path) { File.join("embedded", "git", "usr", "bin") }
95
- let(:custom_gitbin_path) { File.join("gitbin") }
96
- before do
97
- allow(helpers).to receive(:omnibus_expand_path) { |*paths| File.expand_path(File.join(paths)) }
98
- allow(Dir).to receive(:exists?).with(/#{custom_gitbin_path}/).and_return false
99
- allow(Dir).to receive(:exists?).with(/#{git_tools_path}/).and_return false
100
- end
101
-
102
- it "does not include the git tools in the path" do
103
- expect(helpers.omnibus_env["PATH"]).to_not match(/#{git_tools_path}/)
104
- end
105
-
106
- context "when the custom gitbin directory exists" do
107
- it "includes them in the path" do
108
- expect(Dir).to receive(:exists?).with(/#{custom_gitbin_path}/).and_return true
109
- expect(helpers.omnibus_env["PATH"]).to match(/#{custom_gitbin_path}$/)
110
- end
111
- end
112
-
113
- context "when the git tools directory exists" do
114
- it "includes them in the path" do
115
- expect(Dir).to receive(:exists?).with(/#{git_tools_path}/).and_return true
116
- expect(helpers.omnibus_env["PATH"]).to match(/#{git_tools_path}$/)
117
- end
118
- end
119
- end
120
- end
@@ -1,75 +0,0 @@
1
- #
2
- # Copyright:: Copyright (c) 2014 Chef Software Inc.
3
- # License:: Apache License, Version 2.0
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
- #
17
-
18
- require "spec_helper"
19
- require_relative "../../../tasks/helpers"
20
-
21
- class RakeMock
22
-
23
- end
24
-
25
- describe "Rake 'dependencies' task" do
26
- let(:rake_mock) { Class.new { include RakeDependenciesTaskHelpers }.new }
27
- let(:product_name) { "chef" }
28
- let(:gemfile_name) { "chef" }
29
- let(:gemfile) { 'gem "chef", github: "chef/chef", branch: "0.0.0"' }
30
- let(:expected_version) { "0.0.1" }
31
-
32
- before do
33
- allow(rake_mock).to receive(:puts)
34
- allow(rake_mock).to receive(:get_latest_version_for).with(product_name).and_return(expected_version)
35
- end
36
-
37
- describe "update_gemfile_from_stable" do
38
- context "when gemfile does not contain the expected string" do
39
- let(:gemfile) { "These are not the droids you are looking for." }
40
-
41
- it "raises an error" do
42
- expect { rake_mock.update_gemfile_from_stable(gemfile, product_name, gemfile_name) }.to raise_error(/Gemfile does not have a line of the form/)
43
- end
44
- end
45
-
46
- context "when gemfile does contain the expected string" do
47
- let(:prefix) { "" }
48
- let(:expected_output) { "gem \"chef\", github: \"chef/chef\", branch: \"#{prefix}#{expected_version}\"" }
49
-
50
- context "and the version string does not have a prefix" do
51
- it "updates the gemfile entry to the newer version" do
52
- expect(rake_mock.update_gemfile_from_stable(gemfile, product_name, gemfile_name))
53
- .to eq(expected_output)
54
- end
55
- end
56
-
57
- context "and the version is the same" do
58
- let(:expected_version) { "0.0.0" }
59
- it "warns the user that the version is not being updated" do
60
- expect(rake_mock).to receive(:puts).with(/version in Gemfile already at latest stable/)
61
- expect(rake_mock.update_gemfile_from_stable(gemfile, product_name, gemfile_name))
62
- .to eq(expected_output)
63
- end
64
- end
65
-
66
- context "and a prefix is specified" do
67
- let(:prefix) { "v" }
68
- it "updates the gemfile entry to the newer version" do
69
- expect(rake_mock.update_gemfile_from_stable(gemfile, product_name, gemfile_name, prefix))
70
- .to eq(expected_output)
71
- end
72
- end
73
- end
74
- end
75
- end