berkshelf 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,4 +6,10 @@ matrix:
6
6
  allow_failures:
7
7
  - rvm: 1.9.2
8
8
  - rvm: ruby-head
9
+ notifications:
10
+ irc:
11
+ channels:
12
+ - "irc.freenode.org#berkshelf"
13
+ skip_join: true
14
+ use_notice: true
9
15
  script: 'bundle exec thor spec:ci'
@@ -0,0 +1,31 @@
1
+ # Contributing
2
+
3
+ ## Running tests
4
+
5
+ ### Install prerequisites
6
+
7
+ Install the latest version of [Bundler](http://gembundler.com)
8
+
9
+ $ gem install bundler
10
+
11
+ Clone the project
12
+
13
+ $ git clone git://github.com/RiotGames/berkshelf.git
14
+
15
+ and run:
16
+
17
+ $ cd berkshelf
18
+ $ bundle install
19
+
20
+ Bundler will install all gems and their dependencies required for testing and developing.
21
+
22
+ ### Running unit (RSpec) and acceptance (Cucumber) tests
23
+
24
+ Simply copy the `spec/knife.rb.sample` to `spec/knife.rb`, and point it at a
25
+ chef server. Berkshelf tests may upload and destroy cookbooks on your chef
26
+ server, so be sure to configure a server safe for this task.
27
+
28
+ $ bundle exec guard start
29
+
30
+ See [here](https://github.com/tdegrunt/vagrant-chef-server-bootstrap) for a
31
+ quick way to get a testing chef server up.
data/README.md CHANGED
@@ -12,38 +12,6 @@ Manage a Cookbook or an Application's Cookbook dependencies
12
12
 
13
13
  See [berkshelf.com](http://berkshelf.com) for up-to-date usage instructions.
14
14
 
15
- # Contributing
16
-
17
- ## Running tests
18
-
19
- ### Install prerequisites
20
-
21
- Install the latest version of [Bundler](http://gembundler.com)
22
-
23
- $ gem install bundler
24
-
25
- Clone the project
26
-
27
- $ git clone git://github.com/RiotGames/berkshelf.git
28
-
29
- and run:
30
-
31
- $ cd berkshelf
32
- $ bundle install
33
-
34
- Bundler will install all gems and their dependencies required for testing and developing.
35
-
36
- ### Running unit (RSpec) and acceptance (Cucumber) tests
37
-
38
- Simply copy the `spec/knife.rb.sample` to `spec/knife.rb`, and point it at a
39
- chef server. Berkshelf tests may upload and destroy cookbooks on your chef
40
- server, so be sure to configure a server safe for this task.
41
-
42
- $ bundle exec guard start
43
-
44
- See [here](https://github.com/tdegrunt/vagrant-chef-server-bootstrap) for a
45
- quick way to get a testing chef server up.
46
-
47
15
  # Authors
48
16
 
49
17
  * Jamie Winsor (<jamie@vialstudios.com>)
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
30
30
  s.add_dependency 'yajl-ruby'
31
31
  s.add_dependency 'activesupport'
32
32
  s.add_dependency 'chef', '>= 10.16.2'
33
- s.add_dependency 'ridley', '>= 0.4.1'
33
+ s.add_dependency 'ridley', '>= 0.6.2'
34
34
  s.add_dependency 'chozo', '>= 0.2.3'
35
35
  s.add_dependency 'hashie'
36
36
  s.add_dependency 'minitar'
@@ -1,12 +1,21 @@
1
- # Put files/directories that should be ignored in this file.
1
+ # Put files/directories that should be ignored in this file when uploading
2
+ # or sharing to the community site.
2
3
  # Lines that start with '# ' are comments.
3
4
 
4
- ## OS
5
+ # OS generated files #
6
+ ######################
5
7
  .DS_Store
6
8
  Icon?
7
9
  nohup.out
10
+ ehthumbs.db
11
+ Thumbs.db
8
12
 
9
- ## EDITORS
13
+ # SASS #
14
+ ########
15
+ .sass-cache
16
+
17
+ # EDITORS #
18
+ ###########
10
19
  \#*
11
20
  .#*
12
21
  *~
@@ -22,31 +31,66 @@ tmtags
22
31
  .settings
23
32
  mkmf.log
24
33
 
25
- ## COMPILED
34
+ ## COMPILED ##
35
+ ##############
26
36
  a.out
27
37
  *.o
28
38
  *.pyc
29
39
  *.so
40
+ *.com
41
+ *.class
42
+ *.dll
43
+ *.exe
44
+ */rdoc/
30
45
 
31
- ## OTHER SCM
32
- */.bzr/*
33
- */.hg/*
34
- */.svn/*
35
-
36
- ## Don't send rspecs up in cookbook
46
+ # Testing #
47
+ ###########
37
48
  .watchr
38
49
  .rspec
39
50
  spec/*
40
51
  spec/fixtures/*
52
+ test/*
41
53
  features/*
54
+ Guardfile
55
+ Procfile
42
56
 
43
- ## SCM
57
+ # SCM #
58
+ #######
59
+ .git
60
+ */.git
44
61
  .gitignore
62
+ .gitmodules
63
+ .gitconfig
64
+ .gitattributes
65
+ .svn
66
+ */.bzr/*
67
+ */.hg/*
68
+ */.svn/*
45
69
 
46
- # Berkshelf
70
+ # Berkshelf #
71
+ #############
47
72
  Berksfile
48
73
  Berksfile.lock
49
74
  cookbooks/*
75
+ tmp
76
+
77
+ # Cookbooks #
78
+ #############
79
+ CONTRIBUTING
80
+ CHANGELOG*
50
81
 
51
- # Vagrant
82
+ # Strainer #
83
+ ############
84
+ Colanderfile
85
+ Strainerfile
86
+ .colander
87
+ .strainer
88
+
89
+ # Vagrant #
90
+ ###########
52
91
  .vagrant
92
+ Vagrantfile
93
+
94
+ # Travis #
95
+ ##########
96
+ .travis.yml
@@ -82,7 +82,7 @@ module Berkshelf
82
82
  @cached_cookbooks = nil
83
83
  end
84
84
 
85
- # Add a cookbook source to the Berksfile to be retrieved and have it's dependencies recurisvely retrieved
85
+ # Add a cookbook source to the Berksfile to be retrieved and have it's dependencies recursively retrieved
86
86
  # and resolved.
87
87
  #
88
88
  # @example a cookbook source that will be retrieved from one of the default locations
@@ -468,7 +468,6 @@ module Berkshelf
468
468
  # group to be installed and all others to be ignored
469
469
  # @option cookbooks [String, Array] :cookbooks
470
470
  # Names of the cookbooks to retrieve sources for
471
- # @option options [Integer] :thread_count
472
471
  # @option options [Hash] :params
473
472
  # URI query unencoded key/value pairs
474
473
  # @option options [Hash] :headers
@@ -183,6 +183,11 @@ module Berkshelf
183
183
  type: :boolean,
184
184
  default: nil,
185
185
  desc: "Disable/Enable SSL verification when uploading cookbooks"
186
+ option :skip_syntax_check,
187
+ type: :boolean,
188
+ default: false,
189
+ desc: "Skip Ruby syntax check when uploading cookbooks",
190
+ aliases: "-s"
186
191
  desc "upload [COOKBOOKS]", "Upload cookbook(s) specified by a Berksfile to the configured Chef Server."
187
192
  def upload(*cookbook_names)
188
193
  berksfile = ::Berkshelf::Berksfile.from_file(options[:berksfile])
@@ -4,8 +4,9 @@ require 'mixlib/shellout'
4
4
  module Berkshelf
5
5
  # @author Jamie Winsor <jamie@vialstudios.com>
6
6
  class Git
7
- GIT_REGEXP = URI.regexp(%w{ https git }).freeze
8
- SSH_REGEXP = /(.+)@(.+):(.+)\.git/.freeze
7
+ GIT_REGEXP = URI.regexp(%w(http https ssh git+ssh git rsync))
8
+ SCP_REGEXP = /^(.+@)?[\w\d\.-]+:.*$/
9
+
9
10
  HAS_QUOTE_RE = %r{\"}.freeze
10
11
  HAS_SPACE_RE = %r{\s}.freeze
11
12
 
@@ -99,15 +100,16 @@ module Berkshelf
99
100
  #
100
101
  # @return [Boolean]
101
102
  def validate_uri(uri)
103
+
102
104
  unless uri.is_a?(String)
103
105
  return false
104
106
  end
105
107
 
106
- unless uri.slice(SSH_REGEXP).nil?
108
+ unless uri.slice(GIT_REGEXP).nil?
107
109
  return true
108
110
  end
109
111
 
110
- unless uri.slice(GIT_REGEXP).nil?
112
+ unless uri.slice(SCP_REGEXP).nil?
111
113
  return true
112
114
  end
113
115
 
@@ -17,7 +17,6 @@ module Berkshelf
17
17
  # @option options [String] :organization
18
18
  # the Organization to connect to. This is only used if you are connecting to
19
19
  # private Chef or hosted Chef
20
- # @option options [Integer] :thread_count
21
20
  # @option options [Hash] :params
22
21
  # URI query unencoded key/value pairs
23
22
  # @option options [Hash] :headers
@@ -43,26 +42,23 @@ module Berkshelf
43
42
  # @option options [Boolean] :freeze
44
43
  # Freeze the uploaded Cookbook on the Chef Server so that it cannot be
45
44
  # overwritten
45
+ # @option options [Boolean] :skip_syntax_check
46
+ # Skip syntax checking of the Cookbook to reduce the overall upload time
46
47
  #
47
48
  # @raise [CookbookNotFound]
48
49
  # @raise [CookbookSyntaxError]
49
50
  #
50
51
  # @return [Boolean]
51
52
  def upload(cookbook, options = {})
52
- cookbook.validate!
53
+ cookbook.validate! unless options[:skip_syntax_check]
53
54
  mutex = Mutex.new
54
55
  checksums = cookbook.checksums.dup
55
56
  sandbox = conn.sandbox.create(checksums.keys)
56
57
 
57
- conn.thread_count.times.collect do
58
- Thread.new(conn, sandbox, checksums.to_a) do |conn, sandbox, checksums|
59
- while checksum = mutex.synchronize { checksums.pop }
60
- sandbox.upload(checksum[0], checksum[1])
61
- end
62
- end
63
- end.each(&:join)
64
-
58
+ sandbox.multi_upload(checksums)
65
59
  sandbox.commit
60
+ sandbox.terminate
61
+
66
62
  conn.cookbook.save(
67
63
  cookbook.cookbook_name,
68
64
  cookbook.version,
@@ -1,3 +1,3 @@
1
1
  module Berkshelf
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -85,6 +85,36 @@ describe Berkshelf::Git do
85
85
  end
86
86
  end
87
87
 
88
+ context "given a valid git+ssh URI without an username" do
89
+ it "returns true" do
90
+ subject.validate_uri("git+ssh://host.com/repo").should be_true
91
+ end
92
+ end
93
+
94
+ context "given a valid git+ssh URI with an username" do
95
+ it "returns true" do
96
+ subject.validate_uri("git+ssh://user@host.com/repo").should be_true
97
+ end
98
+ end
99
+
100
+ context "given a valid URI with a dash in the hostname" do
101
+ it "returns true" do
102
+ subject.validate_uri("git://user@git-host.com/repo").should be_true
103
+ end
104
+ end
105
+
106
+ context "given a valid URI with host being a subdomain" do
107
+ it "returns true" do
108
+ subject.validate_uri("git://user@git.host.com/repo").should be_true
109
+ end
110
+ end
111
+
112
+ context "given a valid git+ssh URI with home directory expansion" do
113
+ it "returns true" do
114
+ subject.validate_uri("git+ssh://user@host.com/~repo").should be_true
115
+ end
116
+ end
117
+
88
118
  context "given an invalid URI" do
89
119
  it "returns false" do
90
120
  subject.validate_uri(invalid_uri).should be_false
@@ -92,8 +122,8 @@ describe Berkshelf::Git do
92
122
  end
93
123
 
94
124
  context "given a HTTP URI" do
95
- it "returns false" do
96
- subject.validate_uri(http_uri).should be_false
125
+ it "returns true" do
126
+ subject.validate_uri(http_uri).should be_true
97
127
  end
98
128
  end
99
129
 
@@ -139,9 +169,7 @@ describe Berkshelf::Git do
139
169
 
140
170
  context "given a HTTP URI" do
141
171
  it "raises InvalidGitURI" do
142
- lambda {
143
- subject.validate_uri!(http_uri)
144
- }.should raise_error(Berkshelf::InvalidGitURI)
172
+ subject.validate_uri!(http_uri).should be_true
145
173
  end
146
174
  end
147
175
 
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: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-12-06 00:00:00.000000000 Z
15
+ date: 2013-01-01 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: yajl-ruby
@@ -69,7 +69,7 @@ dependencies:
69
69
  requirements:
70
70
  - - ! '>='
71
71
  - !ruby/object:Gem::Version
72
- version: 0.4.1
72
+ version: 0.6.2
73
73
  type: :runtime
74
74
  prerelease: false
75
75
  version_requirements: !ruby/object:Gem::Requirement
@@ -77,7 +77,7 @@ dependencies:
77
77
  requirements:
78
78
  - - ! '>='
79
79
  - !ruby/object:Gem::Version
80
- version: 0.4.1
80
+ version: 0.6.2
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: chozo
83
83
  requirement: !ruby/object:Gem::Requirement
@@ -205,6 +205,7 @@ files:
205
205
  - .rbenv-version
206
206
  - .rvmrc
207
207
  - .travis.yml
208
+ - CONTRIBUTING.md
208
209
  - Gemfile
209
210
  - Guardfile
210
211
  - LICENSE
@@ -368,10 +369,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
368
369
  version: '0'
369
370
  segments:
370
371
  - 0
371
- hash: 810514310070508080
372
+ hash: -2262003520386136890
372
373
  requirements: []
373
374
  rubyforge_project:
374
- rubygems_version: 1.8.23
375
+ rubygems_version: 1.8.24
375
376
  signing_key:
376
377
  specification_version: 3
377
378
  summary: Manages a Cookbook's, or an Application's, Cookbook dependencies