berkshelf-api 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # 2.1.0
2
+
3
+ * Enhancements
4
+ * Added --version flag for displaying version (alias -v)
5
+ * Build interval for cache builder is now configurable
6
+
7
+ * Bug Fixes
8
+ * Supermarket location_path was not correctly set
9
+
10
+ * Backwards incompatible changes
11
+ * --verbose alias is now -V. Previously -v.
12
+
1
13
  # 2.0.0
2
14
 
3
15
  * Enhancements
data/README.md CHANGED
@@ -55,13 +55,20 @@ And add your configuration to the `node[:berkshelf_api][:config]` attribute
55
55
  "client_name": "berkshelf"
56
56
  }
57
57
  }
58
- ]
58
+ ],
59
+ "build_interval": 5.0
59
60
  },
60
- "host":"your.fqdn.here"
61
+ "host": "your.fqdn.here"
61
62
  }
62
63
  }
63
64
  ```
64
65
 
66
+ Options:
67
+
68
+ * build_interval - the number of seconds before it refreshes from the endpoints.
69
+ * endpoints - an array of endpoints to cache
70
+ * home_path - data directory for the berkshelf-api server
71
+
65
72
  > See configuration endpoints below for a complete list of supported endpoints, and the [api cookbook readme](https://github.com/berkshelf/berkshelf-api/tree/master/cookbook) for all configuration options.
66
73
 
67
74
  Update the machine you bootstrapped to the latest version of Berkshelf-API
@@ -4,8 +4,6 @@ module Berkshelf::API
4
4
 
5
5
  class WorkerSupervisor < Celluloid::SupervisionGroup; end
6
6
 
7
- BUILD_INTERVAL = 5.0
8
-
9
7
  include Berkshelf::API::GenericServer
10
8
  include Berkshelf::API::Logging
11
9
  include Berkshelf::API::Mixin::Services
@@ -18,6 +16,7 @@ module Berkshelf::API
18
16
  @worker_registry = Celluloid::Registry.new
19
17
  @worker_supervisor = WorkerSupervisor.new(@worker_registry)
20
18
  @building = false
19
+ @build_interval = Application.config.build_interval
21
20
 
22
21
  Application.config.endpoints.each_with_index do |endpoint, index|
23
22
  endpoint_options = (endpoint.options || {}).to_hash.deep_symbolize_keys
@@ -32,7 +31,7 @@ module Berkshelf::API
32
31
  # Issue a build command to all workers at the scheduled interval
33
32
  #
34
33
  # @param [Fixnum, Float] interval
35
- def build_loop(interval = BUILD_INTERVAL)
34
+ def build_loop(interval = @build_interval)
36
35
  return if @building
37
36
 
38
37
  loop do
@@ -16,7 +16,7 @@ module Berkshelf::API
16
16
  def cookbooks
17
17
  connection.universe.inject([]) do |list, (name, versions)|
18
18
  versions.each do |version, info|
19
- list << RemoteCookbook.new(name, version, self.class.worker_type, connection.api_url, priority, info)
19
+ list << RemoteCookbook.new(name, version, self.class.worker_type, info["location_path"], priority, info)
20
20
  end
21
21
 
22
22
  list
@@ -40,7 +40,6 @@ module Berkshelf::API
40
40
  private
41
41
 
42
42
  attr_accessor :connection
43
-
44
43
  end
45
44
  end
46
45
  end
@@ -23,6 +23,10 @@ module Berkshelf::API
23
23
  }
24
24
  ]
25
25
 
26
+ attribute 'build_interval',
27
+ type: Float,
28
+ default: 5.0
29
+
26
30
  def endpoints_checksum
27
31
  Digest::SHA1.hexdigest(endpoints.collect {|x| x.to_hash }.to_s)
28
32
  end
@@ -15,12 +15,12 @@ module Berkshelf
15
15
  opts.on("-h", "--host HOST", String, "set the listening address") do |h|
16
16
  options[:host] = h
17
17
  end
18
-
18
+
19
19
  opts.on("-p", "--port PORT", Integer, "set the listening port") do |v|
20
20
  options[:port] = v
21
21
  end
22
22
 
23
- opts.on("-v", "--verbose", "run with verbose output") do
23
+ opts.on("-V", "--verbose", "run with verbose output") do
24
24
  options[:log_level] = "INFO"
25
25
  end
26
26
 
@@ -36,6 +36,12 @@ module Berkshelf
36
36
  options[:config_file] = v
37
37
  end
38
38
 
39
+ opts.on("-v", "--version", "show version") do |v|
40
+ require 'berkshelf/api/version'
41
+ puts Berkshelf::API::VERSION
42
+ exit
43
+ end
44
+
39
45
  opts.on_tail("-h", "--help", "show this message") do
40
46
  puts opts
41
47
  exit
@@ -1,5 +1,5 @@
1
1
  module Berkshelf
2
2
  module API
3
- VERSION = "2.0.0"
3
+ VERSION = "2.1.0"
4
4
  end
5
5
  end
@@ -19,5 +19,9 @@ describe Berkshelf::API::Config do
19
19
  it "has the Supermarket community site as an endpoint" do
20
20
  expect(subject.endpoints.first.type).to eql("supermarket")
21
21
  end
22
+
23
+ it "has the default build_interval" do
24
+ expect(subject.build_interval).to eq(5.0)
25
+ end
22
26
  end
23
27
  end
@@ -20,8 +20,8 @@ describe Berkshelf::API::SrvCtl do
20
20
  end
21
21
  end
22
22
 
23
- context "given -v" do
24
- let(:args) { ["-v"] }
23
+ context "given -V" do
24
+ let(:args) { ["-V"] }
25
25
 
26
26
  it "sets :log_level to INFO" do
27
27
  expect(subject[:log_level]).to eql("INFO")
@@ -44,8 +44,8 @@ describe Berkshelf::API::SrvCtl do
44
44
  end
45
45
  end
46
46
 
47
- context "given -v and -d" do
48
- let(:args) { ["-v", "-d"] }
47
+ context "given -V and -d" do
48
+ let(:args) { ["-V", "-d"] }
49
49
 
50
50
  it "sets :log_level to DEBUG" do
51
51
  expect(subject[:log_level]).to eql("DEBUG")
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: 2.0.0
4
+ version: 2.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-07-10 00:00:00.000000000 Z
13
+ date: 2014-08-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ridley
@@ -297,7 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
297
297
  version: '0'
298
298
  segments:
299
299
  - 0
300
- hash: -144777955995008759
300
+ hash: 186690400328134402
301
301
  requirements: []
302
302
  rubyforge_project:
303
303
  rubygems_version: 1.8.23