whisk 0.1.0 → 0.1.1
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 +3 -3
- data/lib/whisk/bowl.rb +10 -10
- data/lib/whisk/exceptions.rb +5 -0
- data/lib/whisk/flavour/git.rb +19 -6
- data/lib/whisk/ingredient.rb +4 -3
- data/lib/whisk/mixin/shellout.rb +6 -0
- data/lib/whisk/version.rb +1 -1
- metadata +3 -2
data/README.md
CHANGED
@@ -9,7 +9,7 @@ exactly what you tell it, and will not resolve dependencies for you or make any
|
|
9
9
|
decisions about which code gets downloaded for you.
|
10
10
|
|
11
11
|
Whisk has been designed to work with git only and tries to help automating
|
12
|
-
the more tedious aspects of working
|
12
|
+
the more tedious aspects of working with the 'single git repository per
|
13
13
|
cookbook' model.
|
14
14
|
|
15
15
|
# Configuration #
|
@@ -27,7 +27,7 @@ Whiskfile.
|
|
27
27
|
|
28
28
|
ingredient "ntp" do
|
29
29
|
source github % "ntp"
|
30
|
-
|
30
|
+
ref '1.1.2'
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -43,7 +43,7 @@ checkout a specified ref.
|
|
43
43
|
Preparing bowl 'production' with path /home/msf/hack/whisk/production
|
44
44
|
Cloning ingredient ntp, from git url git://github.com/cookbooks/ntp.git
|
45
45
|
Cloning into 'ntp'...
|
46
|
-
Checking out ref '
|
46
|
+
Checking out ref '1.1.2' for ingredient ntp
|
47
47
|
|
48
48
|
You can also use specify an optional filter to run prepare on a subset of
|
49
49
|
cookbooks using ruby regexes.
|
data/lib/whisk/bowl.rb
CHANGED
@@ -15,13 +15,17 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
|
-
require 'pp'
|
19
18
|
require 'fileutils'
|
19
|
+
require 'chef/mixin/params_validate'
|
20
|
+
require 'whisk/exceptions'
|
20
21
|
require 'whisk/ingredient'
|
21
22
|
|
22
23
|
class Whisk
|
23
24
|
class Bowl
|
24
|
-
|
25
|
+
|
26
|
+
include Chef::Mixin::ParamsValidate
|
27
|
+
|
28
|
+
attr_reader :name, :ingredients
|
25
29
|
|
26
30
|
def initialize(name, path=nil, &block)
|
27
31
|
@name = name
|
@@ -31,14 +35,6 @@ class Whisk
|
|
31
35
|
instance_eval(&block) if block_given?
|
32
36
|
end
|
33
37
|
|
34
|
-
def path(pth=nil)
|
35
|
-
if pth
|
36
|
-
@path = pth
|
37
|
-
else
|
38
|
-
@path
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
38
|
def ingredient(iname, &block)
|
43
39
|
if ingredients.has_key? iname
|
44
40
|
raise ArgumentError "Ingredient '#{iname}' has already added to bowl '#{name}'"
|
@@ -90,5 +86,9 @@ class Whisk
|
|
90
86
|
ingredient.update
|
91
87
|
end
|
92
88
|
end
|
89
|
+
|
90
|
+
def path(arg=nil)
|
91
|
+
set_or_return(:path, arg, :default => File.join(Dir.getwd, name))
|
92
|
+
end
|
93
93
|
end
|
94
94
|
end
|
data/lib/whisk/flavour/git.rb
CHANGED
@@ -26,17 +26,30 @@ class Whisk
|
|
26
26
|
|
27
27
|
def clone
|
28
28
|
if ::File.exists? File.join(Dir.pwd, name, ".git", "config")
|
29
|
-
Whisk.ui.info "Ingredient #{self.name} already prepared
|
29
|
+
Whisk.ui.info "Ingredient '#{self.name}' already prepared"
|
30
30
|
else
|
31
|
-
Whisk.ui.info "Cloning ingredient #{self.name}, " + "from
|
31
|
+
Whisk.ui.info "Cloning ingredient '#{self.name}', " + "from url #{self.source}"
|
32
32
|
shell_out("git clone #{self.source} #{self.name}")
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
def current_ref
|
37
|
+
cref = run_command("git rev-parse --abbrev-ref HEAD", :cwd => self.name).stdout.chomp
|
38
|
+
if cref == 'HEAD'
|
39
|
+
return run_command("git describe", :cwd => self.name).stdout.chomp
|
40
|
+
else
|
41
|
+
return cref
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def checkout
|
46
|
+
if self.ref
|
47
|
+
if self.current_ref == self.ref
|
48
|
+
Whisk.ui.info "Ingredient '#{self.name}' already at ref '#{self.ref}'"
|
49
|
+
else
|
50
|
+
Whisk.ui.info "Checking out ref '#{self.ref}' for ingredient '#{self.name}'"
|
51
|
+
shell_out("git checkout #{self.ref}", :cwd => self.name)
|
52
|
+
end
|
40
53
|
end
|
41
54
|
end
|
42
55
|
|
data/lib/whisk/ingredient.rb
CHANGED
@@ -16,6 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
18
|
require 'chef/mixin/params_validate'
|
19
|
+
require 'whisk/exceptions'
|
19
20
|
require 'whisk/flavours'
|
20
21
|
|
21
22
|
class Whisk
|
@@ -28,8 +29,8 @@ class Whisk
|
|
28
29
|
def initialize(name, &block)
|
29
30
|
@name = name
|
30
31
|
@flavour = 'git'
|
32
|
+
@ref = nil
|
31
33
|
@source = nil
|
32
|
-
@options = {}
|
33
34
|
|
34
35
|
instance_eval(&block) if block_given?
|
35
36
|
|
@@ -44,8 +45,8 @@ class Whisk
|
|
44
45
|
set_or_return(:flavour, arg, :default => 'git')
|
45
46
|
end
|
46
47
|
|
47
|
-
def
|
48
|
-
set_or_return(:
|
48
|
+
def ref(arg=nil)
|
49
|
+
set_or_return(:ref, arg, :kind_of => String)
|
49
50
|
end
|
50
51
|
end
|
51
52
|
end
|
data/lib/whisk/mixin/shellout.rb
CHANGED
data/lib/whisk/version.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.1
|
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-08-
|
12
|
+
date: 2012-08-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chef
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- lib/whisk/cli.rb
|
106
106
|
- lib/whisk/flavours.rb
|
107
107
|
- lib/whisk/whiskfile.rb
|
108
|
+
- lib/whisk/exceptions.rb
|
108
109
|
- lib/whisk/ingredient.rb
|
109
110
|
- lib/whisk/version.rb
|
110
111
|
- lib/whisk/bowl.rb
|