berkshelf 2.0.10 → 2.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 100a6f3b421a94aa67bb5656af8f3bc689b0dc12
4
- data.tar.gz: 7b6301d2dbedb6faf17db98f3d08767104e2ab2e
3
+ metadata.gz: cd1aa53a9867a0e5a5499885621fb883886c4d70
4
+ data.tar.gz: 4a730017be76868d1892a8e0f283415f4fcc922d
5
5
  SHA512:
6
- metadata.gz: 05c22a423962555fc42d425121922a7a8a42bcc4e365903d55a9cc176d9a78f42b3e915c77b4a415454259e7a211df57343569a91e24dce725f3e516ad0f0b7d
7
- data.tar.gz: b0c809c1113c592ee8bf1d7041369d13edad6433bb15d83c02eeaab8bf38ab37db5668def7681686c28cce890f3cc0b1a64eac56c8e29b391c5d54b9af1ad4ac
6
+ metadata.gz: 6e69b3084e8f50f45099b6978c339fbb39b602c3caf7724b7383697b0d4ac3beca4f77848ccc7b4f23a72ebc5bedecce0e709e3e2a996d72fb0c5fa3f5b7d22b
7
+ data.tar.gz: c07fe3c83904af0f9b0c45a1db8ac85e65ea07450328fa2fbbf7fa062f9bcd43a2666545b183b6e33b1710d9c6eafa09a6701d050d1e29f4c9f103f867caa929
@@ -17,8 +17,8 @@ Feature: Applying cookbook versions to a Chef Environment
17
17
  When I successfully run `berks apply berkshelf_lock_test`
18
18
  Then the version locks in "berkshelf_lock_test" should be:
19
19
  | cookbook | version_lock |
20
- | fake | 1.0.0 |
21
- | dependency | 2.0.0 |
20
+ | fake | = 1.0.0 |
21
+ | dependency | = 2.0.0 |
22
22
  And the exit status should be 0
23
23
 
24
24
  @chef_server
@@ -316,3 +316,32 @@ Feature: Uploading cookbooks to a Chef Server
316
316
  Uploading fake (0.0.0)
317
317
  """
318
318
  And the exit status should be 0
319
+ Scenario: When the syntax check is skipped
320
+ Given a cookbook named "fake"
321
+ And the cookbook "fake" has the file "recipes/default.rb" with:
322
+ """
323
+ Totally not valid Ruby syntax
324
+ """
325
+ And the cookbook "fake" has the file "templates/default/file.erb" with:
326
+ """
327
+ <% for %>
328
+ """
329
+ And the cookbook "fake" has the file "recipes/template.rb" with:
330
+ """
331
+ template "/tmp/wadus" do
332
+ source "file.erb"
333
+ end
334
+ """
335
+ And the cookbook "fake" has the file "Berksfile" with:
336
+ """
337
+ site :opscode
338
+
339
+ metadata
340
+ """
341
+ And I cd to "fake"
342
+ When I successfully run `berks upload --skip-syntax-check`
343
+ Then the output should contain:
344
+ """
345
+ Using fake (0.0.0) from metadata
346
+ Uploading fake (0.0.0) to: 'http://localhost:4000/'
347
+ """
@@ -519,10 +519,10 @@ module Berkshelf
519
519
  # if an attempt to upload a cookbook which has been frozen on the target server is made
520
520
  # and the :halt_on_frozen option was true
521
521
  def upload(options = {})
522
- options = options.reverse_merge(force: false, freeze: true, skip_dependencies: false, halt_on_frozen: false, update_lockfile: false)
522
+ options = options.reverse_merge(force: false, freeze: true, skip_dependencies: false, halt_on_frozen: false, update_lockfile: false, validate: true)
523
523
 
524
524
  cached_cookbooks = install(options)
525
- upload_opts = options.slice(:force, :freeze)
525
+ upload_opts = options.slice(:force, :freeze, :validate)
526
526
  conn = ridley_connection(options)
527
527
 
528
528
  cached_cookbooks.each do |cookbook|
@@ -572,7 +572,7 @@ module Berkshelf
572
572
  install
573
573
 
574
574
  environment.cookbook_versions = {}.tap do |cookbook_versions|
575
- lockfile.sources.each { |source| cookbook_versions[source.name] = source.locked_version.to_s }
575
+ lockfile.sources.each { |source| cookbook_versions[source.name] = "= #{source.locked_version.to_s}" }
576
576
  end
577
577
 
578
578
  environment.save
@@ -225,6 +225,7 @@ module Berkshelf
225
225
  upload_options = Hash[options.except(:no_freeze, :berksfile)].symbolize_keys
226
226
  upload_options[:cookbooks] = cookbook_names
227
227
  upload_options[:freeze] = false if options[:no_freeze]
228
+ upload_options[:validate] = false if options[:skip_syntax_check]
228
229
 
229
230
  berksfile.upload(upload_options)
230
231
  end
@@ -1,3 +1,3 @@
1
1
  module Berkshelf
2
- VERSION = "2.0.10"
2
+ VERSION = "2.0.11"
3
3
  end
@@ -510,6 +510,37 @@ describe Berkshelf::Berksfile do
510
510
  upload
511
511
  end
512
512
  end
513
+
514
+ context 'when validate is passed' do
515
+ let(:options) do
516
+ {
517
+ force: false,
518
+ freeze: true,
519
+ validate: false,
520
+ name: "cookbook"
521
+ }
522
+ end
523
+ let(:ridley_options) do
524
+ default_ridley_options.merge(
525
+ { server_url: 'http://configured-chef-server/'})
526
+ end
527
+ let(:cookbook) { double('cookbook', cookbook_name: 'cookbook', path: 'path', version: '1.0.0') }
528
+ let(:installed_cookbooks) { [ cookbook ] }
529
+ let(:server_url) { Berkshelf::RSpec::ChefServer.server_url }
530
+ let(:client_name) { 'reset' }
531
+ let(:client_key) { 'client-key' }
532
+ let(:ridley_connection) { double('ridley-connection', server_url: server_url, client_name: client_name, client_key: client_key) }
533
+ let(:cookbook_resource) { double('cookbook') }
534
+
535
+ it 'uses the passed in :validate' do
536
+ Ridley.stub(:new).with(ridley_options).and_return(ridley_connection)
537
+ ridley_connection.stub(:alive?).and_return(true)
538
+ ridley_connection.stub(:terminate).and_return(true)
539
+ ridley_connection.should_receive(:cookbook).and_return(cookbook_resource)
540
+ cookbook_resource.should_receive(:upload).with('path', options )
541
+ upload
542
+ end
543
+ end
513
544
  end
514
545
 
515
546
  describe '#apply' do
@@ -548,8 +579,8 @@ describe Berkshelf::Berksfile do
548
579
 
549
580
  environment = ::JSON.parse(chef_server.data_store.get(['environments', 'berkshelf']))
550
581
  expect(environment['cookbook_versions']).to have(2).items
551
- expect(environment['cookbook_versions']['nginx']).to eq('1.2.3')
552
- expect(environment['cookbook_versions']['artifact']).to eq('1.4.0')
582
+ expect(environment['cookbook_versions']['nginx']).to eq('= 1.2.3')
583
+ expect(environment['cookbook_versions']['artifact']).to eq('= 1.4.0')
553
584
  end
554
585
  end
555
586
 
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe Berkshelf::Cli do
4
+ let(:subject) { described_class.new }
5
+ let(:berksfile) { double('Berksfile') }
6
+ let(:cookbooks) { ['mysql'] }
7
+ describe '#upload' do
8
+ it 'calls to upload with params if passed in cli' do
9
+ Berkshelf::Berksfile.should_receive(:from_file).and_return(berksfile)
10
+ berksfile.should_receive(:upload).with(include(:skip_syntax_check => true, :freeze => false, :cookbooks => cookbooks))
11
+ subject.options[:skip_syntax_check] = true
12
+ subject.options[:no_freeze] = true
13
+ subject.upload('mysql')
14
+ end
15
+ end
16
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berkshelf
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.10
4
+ version: 2.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Winsor
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-09-03 00:00:00.000000000 Z
15
+ date: 2014-01-07 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport
@@ -616,6 +616,7 @@ files:
616
616
  - spec/unit/berkshelf/berksfile_spec.rb
617
617
  - spec/unit/berkshelf/cached_cookbook_spec.rb
618
618
  - spec/unit/berkshelf/chef/cookbook/chefignore_spec.rb
619
+ - spec/unit/berkshelf/cli_spec.rb
619
620
  - spec/unit/berkshelf/community_rest_spec.rb
620
621
  - spec/unit/berkshelf/config_spec.rb
621
622
  - spec/unit/berkshelf/cookbook_generator_spec.rb
@@ -755,6 +756,7 @@ test_files:
755
756
  - spec/unit/berkshelf/berksfile_spec.rb
756
757
  - spec/unit/berkshelf/cached_cookbook_spec.rb
757
758
  - spec/unit/berkshelf/chef/cookbook/chefignore_spec.rb
759
+ - spec/unit/berkshelf/cli_spec.rb
758
760
  - spec/unit/berkshelf/community_rest_spec.rb
759
761
  - spec/unit/berkshelf/config_spec.rb
760
762
  - spec/unit/berkshelf/cookbook_generator_spec.rb