grocery_delivery 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Grocery Delivery
2
2
 
3
+ [![Build Status](https://travis-ci.org/facebook/grocery-delivery.svg)](http://travis-ci.org/facebook/grocery-delivery)
4
+
3
5
  ## Intro
4
6
  Ohai!
5
7
 
@@ -70,11 +72,17 @@ In addition the following are also available:
70
72
  relative to `reponame`. Default: `gd_revision`
71
73
  * knife_config - Knife config to use for uploads. Default:
72
74
  `/root/.chef/knife.rb`
75
+ Note: `knife.rb` will need to set `cookbook_path` pointing to the cookbook
76
+ path in the work directory,
77
+ e.g. `/var/chef/grocery_delivery_work/ops/chef/cookbooks`
73
78
  * knife_bin - Path to knife. Default: `/opt/chef/bin/knife`
74
79
  * vcs_type - Git or SVN? Default: `svn`
75
80
  * vcs_path - Path to git or svn binary. If not given, just uses 'git' or 'svn'.
76
81
  Default: `nil`
77
82
  * plugin_path - Path to plugin file. Default: `/etc/gd-plugin.rb`
83
+ * berks - Boolean to determine if we should use berkshelf to resolve
84
+ dependencies and upload cookbooks. Default: `false`
85
+ * berks_bin - Path to berkshelf. Default: `/opt/chefdk/bin/berks`
78
86
 
79
87
  ## Plugin
80
88
 
data/bin/grocery-delivery CHANGED
@@ -1,14 +1,14 @@
1
- #!/opt/chef/embedded/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
  # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
3
3
 
4
4
  # Copyright 2013-present Facebook
5
- #
5
+ #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
8
8
  # You may obtain a copy of the License at
9
- #
9
+ #
10
10
  # http://www.apache.org/licenses/LICENSE-2.0
11
- #
11
+ #
12
12
  # Unless required by applicable law or agreed to in writing, software
13
13
  # distributed under the License is distributed on an "AS IS" BASIS,
14
14
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -66,8 +66,16 @@ def read_checkpoint
66
66
  end
67
67
 
68
68
  def full_upload(knife)
69
- GroceryDelivery::Log.warn('Uploading all cookbooks')
70
- knife.cookbook_upload_all
69
+ if GroceryDelivery::Config.berks
70
+ GroceryDelivery::Log.warn('Uploading all cookbooks with berkshelf')
71
+ GroceryDelivery::Log.debug(
72
+ "Using cookbook paths: #{GroceryDelivery::Config.cookbook_paths}"
73
+ )
74
+ knife.berks_cookbook_upload_all
75
+ else
76
+ GroceryDelivery::Log.warn('Uploading all cookbooks')
77
+ knife.cookbook_upload_all
78
+ end
71
79
  GroceryDelivery::Log.warn('Uploading all roles')
72
80
  knife.role_upload_all
73
81
  GroceryDelivery::Log.warn('Uploading all databags')
@@ -115,12 +123,17 @@ def partial_upload(knife, repo, checkpoint, local_head)
115
123
  'Deleted databags' => deleted_databags,
116
124
  }.each do |msg, list|
117
125
  if list
118
- GroceryDelivery::Log.warn("#{msg}: #{list.map {|x| x.to_s}}")
126
+ GroceryDelivery::Log.warn("#{msg}: #{list.map(&:to_s)}")
119
127
  end
120
128
  end
121
129
 
122
130
  knife.cookbook_delete(deleted_cookbooks) if deleted_cookbooks
123
- knife.cookbook_upload(added_cookbooks) if added_cookbooks
131
+ if GroceryDelivery::Config.berks
132
+ GroceryDelivery::Log.warn('Using Berkshelf to upload cookbooks')
133
+ knife.berks_cookbook_upload(added_cookbooks) if added_cookbooks
134
+ else
135
+ knife.cookbook_upload(added_cookbooks) if added_cookbooks
136
+ end
124
137
  knife.role_delete(deleted_roles) if deleted_roles
125
138
  knife.role_upload(added_roles) if added_roles
126
139
  knife.databag_delete(deleted_databags) if deleted_databags
@@ -137,6 +150,8 @@ def upload_changed(repo, checkpoint)
137
150
  :logger => GroceryDelivery::Log,
138
151
  :config => GroceryDelivery::Config.knife_config,
139
152
  :bin => GroceryDelivery::Config.knife_bin,
153
+ :berks_bin => GroceryDelivery::Config.berks_bin,
154
+ :berks_config => GroceryDelivery::Config.berks_config,
140
155
  :role_dir => File.join(base_dir, GroceryDelivery::Config.role_path),
141
156
  :cookbook_dirs => GroceryDelivery::Config.cookbook_paths.map do |x|
142
157
  File.join(base_dir, x)
@@ -181,6 +196,9 @@ def setup_config
181
196
  opts.on('-l', '--lockfile FILE', 'lockfile') do |s|
182
197
  options[:lockfile] = s
183
198
  end
199
+ opts.on('--stdout', 'Log to stdout as well.') do |_s|
200
+ options[:stdout] = true
201
+ end
184
202
  opts.on('-p', '--pidfile FILE', 'pidfile') do |s|
185
203
  options[:pidfile] = s
186
204
  end
@@ -190,6 +208,7 @@ def setup_config
190
208
  end
191
209
  GroceryDelivery::Config.merge!(options)
192
210
  GroceryDelivery::Log.verbosity = GroceryDelivery::Config.verbosity
211
+ GroceryDelivery::Log.stdout = GroceryDelivery::Config.stdout
193
212
  if GroceryDelivery::Config.dry_run
194
213
  GroceryDelivery::Log.warn('Dryrun mode activated, no changes will be made.')
195
214
  end
@@ -1,13 +1,13 @@
1
1
  # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
2
2
 
3
3
  # Copyright 2013-present Facebook
4
- #
4
+ #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
7
7
  # You may obtain a copy of the License at
8
- #
8
+ #
9
9
  # http://www.apache.org/licenses/LICENSE-2.0
10
- #
10
+ #
11
11
  # Unless required by applicable law or agreed to in writing, software
12
12
  # distributed under the License is distributed on an "AS IS" BASIS,
13
13
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,7 +23,7 @@ module GroceryDelivery
23
23
  # it's compatible with v2, so it should work in 11 too.
24
24
  class Config
25
25
  extend Mixlib::Config
26
-
26
+ stdout false
27
27
  dry_run false
28
28
  verbosity Logger::WARN
29
29
  timestamp false
@@ -42,5 +42,8 @@ module GroceryDelivery
42
42
  vcs_type 'svn'
43
43
  vcs_path nil
44
44
  plugin_path '/etc/gd-plugin.rb'
45
+ berks false
46
+ berks_bin '/opt/chefdk/bin/berks'
47
+ berks_config nil
45
48
  end
46
49
  end
@@ -1,13 +1,13 @@
1
1
  # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
2
2
 
3
3
  # Copyright 2013-present Facebook
4
- #
4
+ #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
7
7
  # You may obtain a copy of the License at
8
- #
8
+ #
9
9
  # http://www.apache.org/licenses/LICENSE-2.0
10
- #
10
+ #
11
11
  # Unless required by applicable law or agreed to in writing, software
12
12
  # distributed under the License is distributed on an "AS IS" BASIS,
13
13
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -1,13 +1,13 @@
1
1
  # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
2
2
 
3
3
  # Copyright 2013-present Facebook
4
- #
4
+ #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
7
7
  # You may obtain a copy of the License at
8
- #
8
+ #
9
9
  # http://www.apache.org/licenses/LICENSE-2.0
10
- #
10
+ #
11
11
  # Unless required by applicable law or agreed to in writing, software
12
12
  # distributed under the License is distributed on an "AS IS" BASIS,
13
13
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,13 +33,17 @@ module GroceryDelivery
33
33
  @@level = val
34
34
  end
35
35
 
36
+ def self.stdout=(val)
37
+ @@stdout = val
38
+ end
39
+
36
40
  def self.logit(level, msg)
37
41
  init unless @@init
38
42
  # You can't do `Syslog.log(level, msg)` because if there is a
39
43
  # `%` in `msg` then ruby will interpret it as a printf string and
40
44
  # expect more arguments to log().
41
45
  Syslog.log(level, '%s', msg)
42
- puts msg if $stdout.tty?
46
+ puts msg if $stdout.tty? || @@stdout
43
47
  end
44
48
 
45
49
  def self.debug(msg)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grocery_delivery
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Phil Dibowitz
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2015-01-05 00:00:00 Z
19
+ date: 2015-11-26 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: mixlib-config
@@ -33,7 +33,7 @@ dependencies:
33
33
  type: :runtime
34
34
  version_requirements: *id001
35
35
  - !ruby/object:Gem::Dependency
36
- name: between_meals
36
+ name: between_meals >= 0.0.6
37
37
  prerelease: false
38
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
39
  none: false
@@ -46,6 +46,48 @@ dependencies:
46
46
  version: "0"
47
47
  type: :runtime
48
48
  version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: rubocop
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :development
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ name: knife-solo
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ type: :development
76
+ version_requirements: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ name: chef-zero
79
+ prerelease: false
80
+ requirement: &id005 !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ type: :development
90
+ version_requirements: *id005
49
91
  description: Utility for keeping Chef servers in sync with a repo
50
92
  email:
51
93
  executables:
@@ -59,8 +101,8 @@ files:
59
101
  - README.md
60
102
  - LICENSE
61
103
  - lib/grocery_delivery/hooks.rb
62
- - lib/grocery_delivery/config.rb
63
104
  - lib/grocery_delivery/logging.rb
105
+ - lib/grocery_delivery/config.rb
64
106
  - bin/grocery-delivery
65
107
  homepage:
66
108
  licenses: