whisk 0.2.1 → 0.2.2

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
@@ -19,32 +19,33 @@ Whiskfile.
19
19
 
20
20
  ## Example Whiskfile ##
21
21
 
22
- cb_path = "/home/msf/hack/whisk/%s"
23
- github = "git://github.com/cookbooks/%s.git"
22
+ whisk_dir = "#{ENV['HOME']}/whisk"
23
+ github = "git://github.com/opscode-cookbooks/%s.git"
24
24
 
25
- bowl "production" do
26
- path cb_path % name
27
-
28
- ingredient "ntp" do
29
- source github % "ntp"
30
- ref '1.1.2'
25
+ bowl "testing" do
26
+ path File.join(whisk_dir, "testing")
27
+ ingredient 'openssh' do
28
+ source github % 'openssh'
31
29
  end
32
- end
33
-
34
- bowl "development" do
35
- path cb_path % name
36
30
 
37
- ingredient "ntp" do
38
- source github % "ntp"
39
- ref 'develop'
31
+ ingredient 'ntp' do
32
+ source github % 'ntp'
40
33
  end
34
+ end
41
35
 
42
- ingredient "ssh" do
43
- source github % "ssh"
44
- ref 'develop'
36
+ bowl "production" do
37
+ path File.join(whisk_dir, "production")
38
+ ingredient 'openssh' do
39
+ source github % 'openssh'
40
+ ref '1.0.0'
45
41
  end
46
42
  end
47
43
 
44
+ Additionally, whisk can take advantage of knife to upload cookbooks.
45
+ Whisk requires that the following code be added to your knife.rb
46
+
47
+ cookbook_path ENV['WHISK_COOKBOOK_PATH']
48
+
48
49
  # Commands #
49
50
 
50
51
  ## whisk list ##
@@ -55,11 +56,9 @@ separated by a forward slash. These short names maybe be used as filters for
55
56
  most other subcommands
56
57
 
57
58
  $ whisk list
58
- production/ntp
59
- production/ssh
60
- development/ntp
61
- development/ssh
62
-
59
+ testing/openssh
60
+ testing/ntp
61
+ production/openssh
63
62
 
64
63
  ## whisk prepare ##
65
64
 
@@ -67,11 +66,20 @@ The prepare subcommand allows you to clone your ingredients and optional
67
66
  checkout a specified ref.
68
67
 
69
68
  $ whisk prepare
70
- Creating bowl 'production' with path /home/msf/hack/whisk/production
71
- Preparing bowl 'production' with path /home/msf/hack/whisk/production
72
- Cloning ingredient ntp, from git url git://github.com/cookbooks/ntp.git
69
+ Creating bowl 'testing' with path /home/msf/whisk/testing
70
+ Preparing bowl 'testing' with path /home/msf/whisk/testing
71
+ Cloning ingredient 'openssh', from url
72
+ git://github.com/opscode-cookbooks/openssh.git
73
+ Cloning into 'openssh'...
74
+ Cloning ingredient 'ntp', from url
75
+ git://github.com/opscode-cookbooks/ntp.git
73
76
  Cloning into 'ntp'...
74
- Checking out ref '1.1.2' for ingredient ntp
77
+ Creating bowl 'production' with path /home/msf/whisk/production
78
+ Preparing bowl 'production' with path /home/msf/whisk/production
79
+ Cloning ingredient 'openssh', from url
80
+ git://github.com/opscode-cookbooks/openssh.git
81
+ Cloning into 'openssh'...
82
+ Checking out ref '1.0.0' for ingredient 'openssh'
75
83
 
76
84
  You can also use specify a filter to run whisk subcommands on a subset of
77
85
  cookbooks by specifying the bowl and ingredient separated by a forward slash.
@@ -96,9 +104,18 @@ to run update on a subset of ingredients
96
104
 
97
105
  # show status for all configured bowls
98
106
  $ whisk status
99
- Status for ingredient 'production/ntp'
107
+ Status for bowl 'testing' with path /home/msf/whisk/testing
108
+ Status for ingredient 'openssh'
109
+ # On branch master
110
+ nothing to commit (working directory clean)
111
+ Status for ingredient 'ntp'
100
112
  # On branch master
101
113
  nothing to commit (working directory clean)
114
+ Status for bowl 'production' with path /home/msf/whisk/production
115
+ Status for ingredient 'openssh'
116
+ # Not currently on any branch.
117
+ nothing to commit (working directory clean)
118
+
102
119
 
103
120
  ## whisk update ##
104
121
 
@@ -113,3 +130,18 @@ to run update on a subset of ingredients
113
130
 
114
131
  # only update the 'development bowl'
115
132
  $ whisk update dev
133
+
134
+ ## whisk upload ##
135
+
136
+ Whisk upload will upload all bowls specified by the Whiskfile to a chef server
137
+
138
+ # upload all bowls to the chef server
139
+ $ whisk upload
140
+ $ ruby bin/whisk upload
141
+ Uploading ingredients in bowl 'testing'
142
+ Uploading ntp [1.2.0]
143
+ Uploading openssh [1.0.0]
144
+ Uploaded 2 cookbooks.
145
+ Uploading ingredients in bowl 'production'
146
+ Uploading openssh [1.0.0]
147
+ Uploaded 1 cookbook.
@@ -93,5 +93,18 @@ class Whisk
93
93
  runner = Whisk::Runner.new(options[:whiskfile], filter)
94
94
  runner.run('update')
95
95
  end
96
+
97
+ method_option :whiskfile,
98
+ type: :string,
99
+ default: File.join(Dir.pwd, Whisk::DEFAULT_FILENAME),
100
+ desc: "Path to a Whiskfile to operate off of.",
101
+ aliases: "-w",
102
+ banner: "PATH"
103
+ desc "upload", "upload the specifiec bowls to a chef server"
104
+ def upload(filter=nil)
105
+ runner = Whisk::Runner.new(options[:whiskfile], filter)
106
+ runner.run('upload')
107
+ end
108
+
96
109
  end
97
110
  end
@@ -18,11 +18,14 @@
18
18
 
19
19
  require 'whisk'
20
20
  require 'whisk/provider'
21
+ require 'whisk/mixin/shellout'
21
22
 
22
23
  class Whisk
23
24
  class Provider
24
25
  class Bowl < Provider
25
26
 
27
+ include Whisk::Mixin::ShellOut
28
+
26
29
  def exist?
27
30
  ::Dir.exist? resource.path
28
31
  end
@@ -33,6 +36,13 @@ class Whisk
33
36
  end
34
37
  end
35
38
 
39
+ def knife_env
40
+ cb_path = resource.path
41
+ return {
42
+ 'WHISK_COOKBOOK_PATH' => cb_path
43
+ }
44
+ end
45
+
36
46
  def create
37
47
  unless self.exist?
38
48
  Whisk.ui.info "Creating bowl '#{resource.name}' with path #{resource.path}"
@@ -76,6 +86,13 @@ class Whisk
76
86
  ingredients_run("update")
77
87
  end
78
88
  end
89
+
90
+ def action_upload
91
+ if self.exist?
92
+ Whisk.ui.info "Uploading ingredients in bowl '#{resource.name}'"
93
+ shell_out!("knife cookbook upload --all", :env => knife_env)
94
+ end
95
+ end
79
96
  end
80
97
  end
81
98
  end
@@ -35,9 +35,9 @@ class Whisk
35
35
 
36
36
  def ingredient(iname, &block)
37
37
  if ingredients.has_key? iname
38
- raise ArgumentError, "Ingredient '#{iname}' has already added to bowl '#{name}'"
38
+ raise ArgumentError, "Ingredient '#{iname}' has already been added to bowl '#{name}'"
39
39
  else
40
- ingredients[iname] = Whisk::Resource::Ingredient.new(iname, &block)
40
+ ingredients[iname] = Whisk::Resource::Ingredient.new(iname, self, &block)
41
41
  end
42
42
  end
43
43
 
@@ -25,7 +25,10 @@ class Whisk
25
25
 
26
26
  include Chef::Mixin::ParamsValidate
27
27
 
28
- def initialize(name, &block)
28
+ attr_accessor :bowl
29
+
30
+ def initialize(name, bowl, &block)
31
+ @bowl = bowl
29
32
  @provider = Whisk::Provider::Ingredient
30
33
  @ref = nil
31
34
  @source = nil
@@ -17,5 +17,5 @@
17
17
  #
18
18
 
19
19
  class Whisk
20
- VERSION = '0.2.1'
20
+ VERSION = '0.2.2'
21
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whisk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-12 00:00:00.000000000 Z
12
+ date: 2012-09-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef