berkshelf-api 1.2.0.rc1 → 1.2.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -3
- data/Gemfile +4 -5
- data/Guardfile +0 -6
- data/Thorfile +73 -18
- data/berkshelf-api.gemspec +16 -14
- data/lib/berkshelf/api/cache_builder/worker/github.rb +2 -2
- data/lib/berkshelf/api/version.rb +1 -1
- data/spec/support/chef_server.rb +53 -51
- data/tasks/build_gem.rb +34 -0
- metadata +44 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35fe7a7e1966af33f082d0c1ae1e1732e5891aab
|
4
|
+
data.tar.gz: 6404341b2e51593475c2cf156d9923986aa7f090
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 046e40ccf541a7c7c1f425bfd4aa09af5341d812e2540e18a50079c562a0c1840f4968756ac9f6dcaa6baa735dc2574f9734398eac4d71d923d44f5bbd547c26
|
7
|
+
data.tar.gz: b0779aaa43078a5231f780231a40cf312f274bd390c0857a3429ff121cbf48813a78c8f3cf3ccc6e482dfe82eed058f9dcc0b51660afc8421f1cf6354cb3ee25
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -4,14 +4,13 @@ gemspec
|
|
4
4
|
|
5
5
|
group :development do
|
6
6
|
gem 'coolline'
|
7
|
-
gem 'fuubar'
|
7
|
+
gem 'fuubar', '~> 1.1'
|
8
8
|
gem 'redcarpet', platforms: :ruby
|
9
9
|
gem 'yard'
|
10
10
|
|
11
|
-
gem 'guard'
|
11
|
+
gem 'guard', '~> 1.8'
|
12
12
|
gem 'guard-rspec'
|
13
13
|
gem 'guard-spork', platforms: :ruby
|
14
|
-
gem 'guard-yard'
|
15
14
|
|
16
15
|
require 'rbconfig'
|
17
16
|
|
@@ -34,6 +33,6 @@ end
|
|
34
33
|
|
35
34
|
group :development, :test do
|
36
35
|
gem 'rack-test'
|
37
|
-
gem 'rspec'
|
38
|
-
gem 'spork'
|
36
|
+
gem 'rspec', '~> 2.13'
|
37
|
+
gem 'spork', '~> 0.9'
|
39
38
|
end
|
data/Guardfile
CHANGED
@@ -6,12 +6,6 @@ guard 'spork' do
|
|
6
6
|
watch(%r{^spec/support/.+\.rb$}) { :rspec }
|
7
7
|
end
|
8
8
|
|
9
|
-
guard 'yard', stdout: '/dev/null', stderr: '/dev/null' do
|
10
|
-
watch(%r{app/.+\.rb})
|
11
|
-
watch(%r{lib/.+\.rb})
|
12
|
-
watch(%r{ext/.+\.c})
|
13
|
-
end
|
14
|
-
|
15
9
|
guard 'rspec', cli: "--color --drb --format Fuubar", all_on_start: false, all_after_pass: false do
|
16
10
|
watch(%r{^spec/unit/.+_spec\.rb$})
|
17
11
|
|
data/Thorfile
CHANGED
@@ -1,39 +1,94 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
$:.push File.expand_path("../tasks", __FILE__)
|
3
4
|
|
4
5
|
require 'bundler'
|
5
6
|
require 'bundler/setup'
|
6
7
|
require 'thor'
|
7
8
|
require 'berkshelf-api'
|
9
|
+
require 'build_gem'
|
10
|
+
require 'octokit'
|
8
11
|
|
9
12
|
class Default < Thor
|
10
|
-
|
13
|
+
include Thor::Actions
|
14
|
+
namespace "build"
|
15
|
+
default_task :all
|
11
16
|
|
12
|
-
|
13
|
-
|
17
|
+
GITHUB_ORG_REGEX = /(git\@github.com\:|https\:\/\/github.com\/)(.+).git/.freeze
|
18
|
+
PKG_DIR = File.expand_path("../pkg", __FILE__).freeze
|
19
|
+
VENDOR_DIR = File.expand_path("../vendor", __FILE__).freeze
|
20
|
+
PROJECT_DIR = File.dirname(__FILE__)
|
14
21
|
|
15
|
-
desc "
|
16
|
-
def
|
17
|
-
|
22
|
+
desc "all", "clean, package, and release to Github"
|
23
|
+
def all
|
24
|
+
clean
|
25
|
+
package
|
26
|
+
release
|
18
27
|
end
|
19
28
|
|
20
|
-
desc "
|
21
|
-
def
|
22
|
-
|
29
|
+
desc "clean", "clean the packaging directory"
|
30
|
+
def clean
|
31
|
+
say "cleaning..."
|
32
|
+
[ PKG_DIR, VENDOR_DIR ].each do |dir|
|
33
|
+
FileUtils.rm_rf(dir)
|
34
|
+
FileUtils.mkdir_p(dir)
|
35
|
+
end
|
23
36
|
end
|
24
37
|
|
25
|
-
desc "
|
26
|
-
def
|
27
|
-
|
38
|
+
desc "package", "package the software for release"
|
39
|
+
def package
|
40
|
+
say "packaging..."
|
41
|
+
empty_directory PKG_DIR
|
42
|
+
invoke "gem:build"
|
43
|
+
inside(File.dirname(__FILE__)) do
|
44
|
+
run "bundle package --all"
|
45
|
+
files = `git ls-files | grep -v spec`.split("\n")
|
46
|
+
run("tar -czf #{archive_out} #{files.join(' ')} vendor")
|
47
|
+
end
|
28
48
|
end
|
29
49
|
|
30
|
-
|
31
|
-
|
32
|
-
|
50
|
+
method_option :github_token,
|
51
|
+
type: :string,
|
52
|
+
default: ENV["GITHUB_TOKEN"],
|
53
|
+
required: true,
|
54
|
+
aliases: "-t",
|
55
|
+
banner: "TOKEN"
|
56
|
+
desc "release", "release the packaged software to Github"
|
57
|
+
def release
|
58
|
+
say "releasing..."
|
59
|
+
invoke "gem:release"
|
33
60
|
|
34
|
-
|
35
|
-
|
36
|
-
|
61
|
+
begin
|
62
|
+
release = github_client.create_release(repository, version)
|
63
|
+
rescue Octokit::UnprocessableEntity
|
64
|
+
release = github_client.releases(repository).find { |release| release[:tag_name] == version }
|
37
65
|
end
|
66
|
+
|
67
|
+
say "Uploading #{File.basename(archive_out)} to Github..."
|
68
|
+
github_client.upload_asset(release[:url], archive_out, name: "berkshelf-api.tar.gz",
|
69
|
+
content_type: "application/x-tar")
|
38
70
|
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
def archive_out
|
75
|
+
File.join(PKG_DIR, "berkshelf-api-#{version}.tar.gz")
|
76
|
+
end
|
77
|
+
|
78
|
+
def github_client
|
79
|
+
@github_client ||= Octokit::Client.new(access_token: options[:github_token])
|
80
|
+
end
|
81
|
+
|
82
|
+
def repository
|
83
|
+
@repository ||= extract_repository
|
84
|
+
end
|
85
|
+
|
86
|
+
def extract_repository
|
87
|
+
_, repository = `git remote show origin | grep Push`.scan(GITHUB_ORG_REGEX).first
|
88
|
+
repository
|
89
|
+
end
|
90
|
+
|
91
|
+
def version
|
92
|
+
@version ||= `git describe`.chomp
|
93
|
+
end
|
39
94
|
end
|
data/berkshelf-api.gemspec
CHANGED
@@ -19,20 +19,22 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
spec.required_ruby_version = ">= 1.9.3"
|
21
21
|
|
22
|
-
spec.add_dependency 'ridley',
|
23
|
-
spec.add_dependency 'celluloid',
|
24
|
-
spec.add_dependency 'reel',
|
25
|
-
spec.add_dependency '
|
26
|
-
spec.add_dependency 'grape
|
27
|
-
spec.add_dependency '
|
28
|
-
spec.add_dependency '
|
29
|
-
spec.add_dependency '
|
30
|
-
spec.add_dependency '
|
31
|
-
spec.add_dependency '
|
32
|
-
spec.add_dependency '
|
33
|
-
spec.add_dependency '
|
22
|
+
spec.add_dependency 'ridley', '~> 3.0'
|
23
|
+
spec.add_dependency 'celluloid', '~> 0.16.0.pre'
|
24
|
+
spec.add_dependency 'reel', '>= 0.4.0'
|
25
|
+
spec.add_dependency 'http', '~> 0.5.0' # explicitly lock because reel's is too lax
|
26
|
+
spec.add_dependency 'grape', '~> 0.6'
|
27
|
+
spec.add_dependency 'grape-msgpack', '~> 0.1'
|
28
|
+
spec.add_dependency 'hashie', '>= 2.0.4'
|
29
|
+
spec.add_dependency 'faraday', '~> 0.9.0'
|
30
|
+
spec.add_dependency 'retryable', '~> 1.3.3'
|
31
|
+
spec.add_dependency 'archive', '= 0.0.6'
|
32
|
+
spec.add_dependency 'buff-config', '~> 0.1'
|
33
|
+
spec.add_dependency 'octokit', '~> 2.6'
|
34
|
+
spec.add_dependency 'semverse', '~> 1.0'
|
34
35
|
|
35
|
-
spec.add_development_dependency 'bundler',
|
36
|
-
spec.add_development_dependency 'thor',
|
36
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
37
|
+
spec.add_development_dependency 'thor', '~> 0.18'
|
37
38
|
spec.add_development_dependency 'chef-zero', '~> 1.5'
|
39
|
+
spec.add_development_dependency "octokit", '~> 2.6'
|
38
40
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'octokit'
|
2
|
-
require '
|
2
|
+
require 'semverse'
|
3
3
|
require 'net/http'
|
4
4
|
|
5
5
|
module Berkshelf::API
|
@@ -46,7 +46,7 @@ module Berkshelf::API
|
|
46
46
|
log.warn "Version found in metadata for #{repo.name} (#{tag.name}) does not " +
|
47
47
|
"match the tag. Got #{cookbook_metadata.version}."
|
48
48
|
end
|
49
|
-
rescue
|
49
|
+
rescue Semverse::InvalidVersionFormat
|
50
50
|
log.debug "Ignoring tag #{tag.name} for: #{repo.name}. Does not conform to semver."
|
51
51
|
rescue Octokit::NotFound
|
52
52
|
log.debug "Ignoring tag #{tag.name} for: #{repo.name}. No raw metadata found."
|
data/spec/support/chef_server.rb
CHANGED
@@ -1,73 +1,75 @@
|
|
1
1
|
require 'chef_zero/server'
|
2
2
|
|
3
|
-
module Berkshelf
|
4
|
-
module
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
module Berkshelf
|
4
|
+
module RSpec
|
5
|
+
module ChefServer
|
6
|
+
class << self
|
7
|
+
def clear_request_log
|
8
|
+
@request_log = Array.new
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
def request_log
|
12
|
+
@request_log ||= Array.new
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
def server
|
16
|
+
@server ||= ChefZero::Server.new(port: PORT, generate_real_keys: false)
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
def server_url
|
20
|
+
(@server && @server.url) || "http://localhost/#{PORT}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def start
|
24
|
+
server.start_background
|
25
|
+
server.on_response do |request, response|
|
26
|
+
request_log << [ request, response ]
|
27
|
+
end
|
28
|
+
clear_request_log
|
21
29
|
|
22
|
-
|
23
|
-
server.start_background
|
24
|
-
server.on_response do |request, response|
|
25
|
-
request_log << [ request, response ]
|
30
|
+
server
|
26
31
|
end
|
27
|
-
clear_request_log
|
28
32
|
|
29
|
-
|
30
|
-
|
33
|
+
def stop
|
34
|
+
@server.stop if @server
|
35
|
+
end
|
31
36
|
|
32
|
-
|
33
|
-
|
37
|
+
def running?
|
38
|
+
@server && @server.running?
|
39
|
+
end
|
34
40
|
end
|
35
41
|
|
36
|
-
|
37
|
-
|
42
|
+
PORT = 8889
|
43
|
+
|
44
|
+
def chef_client(name, hash = Hash.new)
|
45
|
+
load_data(:clients, name, hash)
|
38
46
|
end
|
39
|
-
end
|
40
47
|
|
41
|
-
|
48
|
+
def chef_cookbook(name, version, cookbook = Hash.new)
|
49
|
+
ChefServer.server.load_data("cookbooks" => { "#{name}-#{version}" => cookbook })
|
50
|
+
end
|
42
51
|
|
43
|
-
|
44
|
-
|
45
|
-
|
52
|
+
def chef_data_bag(name, hash = Hash.new)
|
53
|
+
ChefServer.server.load_data({ 'data' => { name => hash }})
|
54
|
+
end
|
46
55
|
|
47
|
-
|
48
|
-
|
49
|
-
|
56
|
+
def chef_environment(name, hash = Hash.new)
|
57
|
+
load_data(:environments, name, hash)
|
58
|
+
end
|
50
59
|
|
51
|
-
|
52
|
-
|
53
|
-
|
60
|
+
def chef_node(name, hash = Hash.new)
|
61
|
+
load_data(:nodes, name, hash)
|
62
|
+
end
|
54
63
|
|
55
|
-
|
56
|
-
|
57
|
-
|
64
|
+
def chef_role(name, hash = Hash.new)
|
65
|
+
load_data(:roles, name, hash)
|
66
|
+
end
|
58
67
|
|
59
|
-
|
60
|
-
load_data(:nodes, name, hash)
|
61
|
-
end
|
68
|
+
private
|
62
69
|
|
63
|
-
|
64
|
-
|
70
|
+
def load_data(key, name, hash)
|
71
|
+
ChefServer.server.load_data(key.to_s => { name => JSON.fast_generate(hash) })
|
72
|
+
end
|
65
73
|
end
|
66
|
-
|
67
|
-
private
|
68
|
-
|
69
|
-
def load_data(key, name, hash)
|
70
|
-
ChefServer.server.load_data(key.to_s => { name => JSON.fast_generate(hash) })
|
71
|
-
end
|
72
74
|
end
|
73
75
|
end
|
data/tasks/build_gem.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
class BuildGem < Thor
|
4
|
+
require 'thor/rake_compat'
|
5
|
+
namespace "gem"
|
6
|
+
|
7
|
+
include Thor::RakeCompat
|
8
|
+
Bundler::GemHelper.install_tasks
|
9
|
+
|
10
|
+
desc "build", "Build berkshelf-api-#{Berkshelf::API::VERSION}.gem into the pkg directory"
|
11
|
+
def build
|
12
|
+
Rake::Task["build"].execute
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "install", "Build and install berkshelf-api-#{Berkshelf::API::VERSION}.gem into system gems"
|
16
|
+
def install
|
17
|
+
Rake::Task["install"].execute
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "release", "Create tag v#{Berkshelf::API::VERSION} and build and push berkshelf-api-#{Berkshelf::API::VERSION}.gem to Rubygems"
|
21
|
+
def release
|
22
|
+
Rake::Task["release"].execute
|
23
|
+
end
|
24
|
+
|
25
|
+
class Spec < Thor
|
26
|
+
namespace :spec
|
27
|
+
default_task :all
|
28
|
+
|
29
|
+
desc "all", "run all tests"
|
30
|
+
def all
|
31
|
+
exec "rspec --color --format=documentation spec"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: berkshelf-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.0.
|
4
|
+
version: 1.2.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Winsor
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-04-
|
12
|
+
date: 2014-04-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ridley
|
@@ -17,28 +17,28 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ~>
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 3.0
|
20
|
+
version: '3.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ~>
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 3.0
|
27
|
+
version: '3.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: celluloid
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - ~>
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: 0.16.0.pre
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - ~>
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: 0.16.0.pre
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: reel
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,6 +53,20 @@ dependencies:
|
|
53
53
|
- - '>='
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 0.4.0
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: http
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 0.5.0
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.5.0
|
56
70
|
- !ruby/object:Gem::Dependency
|
57
71
|
name: grape
|
58
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,14 +143,14 @@ dependencies:
|
|
129
143
|
requirements:
|
130
144
|
- - '='
|
131
145
|
- !ruby/object:Gem::Version
|
132
|
-
version: 0.0.
|
146
|
+
version: 0.0.6
|
133
147
|
type: :runtime
|
134
148
|
prerelease: false
|
135
149
|
version_requirements: !ruby/object:Gem::Requirement
|
136
150
|
requirements:
|
137
151
|
- - '='
|
138
152
|
- !ruby/object:Gem::Version
|
139
|
-
version: 0.0.
|
153
|
+
version: 0.0.6
|
140
154
|
- !ruby/object:Gem::Dependency
|
141
155
|
name: buff-config
|
142
156
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,19 +180,19 @@ dependencies:
|
|
166
180
|
- !ruby/object:Gem::Version
|
167
181
|
version: '2.6'
|
168
182
|
- !ruby/object:Gem::Dependency
|
169
|
-
name:
|
183
|
+
name: semverse
|
170
184
|
requirement: !ruby/object:Gem::Requirement
|
171
185
|
requirements:
|
172
|
-
- -
|
186
|
+
- - ~>
|
173
187
|
- !ruby/object:Gem::Version
|
174
|
-
version: '0'
|
188
|
+
version: '1.0'
|
175
189
|
type: :runtime
|
176
190
|
prerelease: false
|
177
191
|
version_requirements: !ruby/object:Gem::Requirement
|
178
192
|
requirements:
|
179
|
-
- -
|
193
|
+
- - ~>
|
180
194
|
- !ruby/object:Gem::Version
|
181
|
-
version: '0'
|
195
|
+
version: '1.0'
|
182
196
|
- !ruby/object:Gem::Dependency
|
183
197
|
name: bundler
|
184
198
|
requirement: !ruby/object:Gem::Requirement
|
@@ -199,14 +213,14 @@ dependencies:
|
|
199
213
|
requirements:
|
200
214
|
- - ~>
|
201
215
|
- !ruby/object:Gem::Version
|
202
|
-
version: 0.18
|
216
|
+
version: '0.18'
|
203
217
|
type: :development
|
204
218
|
prerelease: false
|
205
219
|
version_requirements: !ruby/object:Gem::Requirement
|
206
220
|
requirements:
|
207
221
|
- - ~>
|
208
222
|
- !ruby/object:Gem::Version
|
209
|
-
version: 0.18
|
223
|
+
version: '0.18'
|
210
224
|
- !ruby/object:Gem::Dependency
|
211
225
|
name: chef-zero
|
212
226
|
requirement: !ruby/object:Gem::Requirement
|
@@ -221,6 +235,20 @@ dependencies:
|
|
221
235
|
- - ~>
|
222
236
|
- !ruby/object:Gem::Version
|
223
237
|
version: '1.5'
|
238
|
+
- !ruby/object:Gem::Dependency
|
239
|
+
name: octokit
|
240
|
+
requirement: !ruby/object:Gem::Requirement
|
241
|
+
requirements:
|
242
|
+
- - ~>
|
243
|
+
- !ruby/object:Gem::Version
|
244
|
+
version: '2.6'
|
245
|
+
type: :development
|
246
|
+
prerelease: false
|
247
|
+
version_requirements: !ruby/object:Gem::Requirement
|
248
|
+
requirements:
|
249
|
+
- - ~>
|
250
|
+
- !ruby/object:Gem::Version
|
251
|
+
version: '2.6'
|
224
252
|
description: Berkshelf dependency API server
|
225
253
|
email:
|
226
254
|
- jamie@vialstudios.com
|
@@ -296,6 +324,7 @@ files:
|
|
296
324
|
- spec/unit/berkshelf/api/rest_gateway_spec.rb
|
297
325
|
- spec/unit/berkshelf/api/site_connector/opscode_spec.rb
|
298
326
|
- spec/unit/berkshelf/api/srv_ctl_spec.rb
|
327
|
+
- tasks/build_gem.rb
|
299
328
|
homepage: https://github.com/berkshelf/berkshelf-api
|
300
329
|
licenses:
|
301
330
|
- Apache 2.0
|