engineyard-recipes 0.3.2.pre → 0.3.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/.travis.yml +0 -1
- data/ChangeLog.md +1 -0
- data/features/wrap-sm-extension.feature +18 -23
- data/lib/engineyard-recipes/cli.rb +3 -10
- data/lib/engineyard-recipes/fetch_uri.rb +8 -10
- data/lib/engineyard-recipes/generators/sm_generator.rb +10 -4
- data/lib/engineyard-recipes/generators/sm_generator/templates/cookbooks/%recipe_name%/attributes/recipe.rb.tt +1 -5
- data/lib/engineyard-recipes/version.rb +1 -1
- data/spec/fetch_uri_spec.rb +3 -3
- metadata +20 -17
data/.travis.yml
CHANGED
data/ChangeLog.md
CHANGED
@@ -8,11 +8,12 @@ Feature: Wrap SM framework extension
|
|
8
8
|
When I run local executable "ey-recipes" with arguments "init-sm"
|
9
9
|
|
10
10
|
Scenario: Wrap an SM extension only
|
11
|
+
Given I mock out git commands
|
11
12
|
When I run local executable "ey-recipes" with arguments "sm https://github.com/eystacks/sm_jenkins.git --name jenkins"
|
12
13
|
Then file "cookbooks/jenkins/recipes/default.rb" contains "require_recipe 'jenkins::install_sm_ext'"
|
13
|
-
Then file "cookbooks/jenkins/attributes/recipe.rb" contains "sm_jenkins_uri('https://github.com/eystacks/sm_jenkins.git')"
|
14
14
|
Then file "cookbooks/jenkins/recipes/install_sm_ext.rb" contains "command %(sm ext install jenkins #{node[:sm_jenkins_uri]})"
|
15
|
-
Then file ".
|
15
|
+
Then file "cookbooks/jenkins/attributes/recipe.rb" contains "sm_jenkins_uri(File.expand_path('../../repo', __FILE__))"
|
16
|
+
And git command "git clone https://github.com/eystacks/sm_jenkins.git cookbooks/jenkins/repo" is run
|
16
17
|
And I should see exactly
|
17
18
|
"""
|
18
19
|
exist cookbooks
|
@@ -22,6 +23,14 @@ Feature: Wrap SM framework extension
|
|
22
23
|
append cookbooks/main/recipes/default.rb
|
23
24
|
"""
|
24
25
|
|
26
|
+
Scenario: Wrap a local SM extension and vendor it
|
27
|
+
Given project is a git repository
|
28
|
+
And I am have a local sm extension "local_sm_repo" at "/tmp/ey-recipes/local_sm_repo"
|
29
|
+
When I run local executable "ey-recipes" with arguments "sm /tmp/ey-recipes/local_sm_repo --name jenkins --submodule"
|
30
|
+
Then file "cookbooks/jenkins/attributes/recipe.rb" contains "sm_jenkins_uri(File.expand_path('../../repo', __FILE__))"
|
31
|
+
And git command "git submodule add https://github.com/eystacks/sm_jenkins.git cookbooks/jenkins/repo" is not run
|
32
|
+
And file "cookbooks/jenkins/repo/local_sm_repo_readme.md" is created
|
33
|
+
|
25
34
|
Scenario: Wrap an SM extension only and trigger its commands
|
26
35
|
When I run local executable "ey-recipes" with arguments "sm https://github.com/eystacks/sm_jenkins.git install configure start --name jenkins"
|
27
36
|
Then file "cookbooks/jenkins/recipes/default.rb" contains "require_recipe 'jenkins::install_sm_ext'"
|
@@ -43,25 +52,11 @@ Feature: Wrap SM framework extension
|
|
43
52
|
append cookbooks/main/recipes/default.rb
|
44
53
|
"""
|
45
54
|
|
46
|
-
Scenario: Wrap a
|
47
|
-
|
48
|
-
|
49
|
-
When I run local executable "ey-recipes" with arguments "sm /tmp/ey-recipes/local_sm_repo --name jenkins --submodule repo"
|
50
|
-
Then file "cookbooks/jenkins/attributes/recipe.rb" contains "sm_jenkins_uri(File.expand_path('../../../../cookbooks/jenkins/repo', __FILE__))"
|
51
|
-
And git command "git submodule add https://github.com/eystacks/sm_jenkins.git cookbooks/jenkins/repo" is not run
|
52
|
-
And file "cookbooks/jenkins/repo/local_sm_repo_readme.md" is created
|
53
|
-
|
54
|
-
Scenario: Wrap a git SM extension and vendor it via submodules
|
55
|
-
Given project is a git repository
|
55
|
+
Scenario: Wrap a git SM extension and vendor it via submodules for chef-on-deploy
|
56
|
+
When I run local executable "ey-recipes" with arguments "init -d"
|
57
|
+
When I run local executable "ey-recipes" with arguments "init-sm"
|
56
58
|
And I mock out git commands
|
57
|
-
When I run local executable "ey-recipes" with arguments "sm https://github.com/eystacks/sm_jenkins.git --name jenkins
|
58
|
-
Then file "cookbooks/jenkins/attributes/recipe.rb" contains "sm_jenkins_uri(File.expand_path('
|
59
|
-
And git command "git
|
60
|
-
|
61
|
-
Scenario: Do not allow submodules flag if current project is not a git repo
|
62
|
-
Given I mock out git commands
|
63
|
-
When I run local executable "ey-recipes" with arguments "sm https://github.com/eystacks/sm_jenkins.git --name jenkins --submodule repo"
|
64
|
-
Then I should see exactly
|
65
|
-
"""
|
66
|
-
ERROR: This project is not a git repository yet.
|
67
|
-
"""
|
59
|
+
When I run local executable "ey-recipes" with arguments "sm https://github.com/eystacks/sm_jenkins.git --name jenkins"
|
60
|
+
Then file "deploy/cookbooks/jenkins/attributes/recipe.rb" contains "sm_jenkins_uri(File.expand_path('../../repo', __FILE__))"
|
61
|
+
And git command "git clone https://github.com/eystacks/sm_jenkins.git deploy/cookbooks/jenkins/repo" is run
|
62
|
+
And git command "git clone https://github.com/eystacks/sm_jenkins.git cookbooks/jenkins/repo" is not run
|
@@ -75,18 +75,11 @@ module Engineyard
|
|
75
75
|
|
76
76
|
desc "sm URI [COMMANDS]", "Wrap an SM extension as an eychef recipe"
|
77
77
|
method_option :name, :aliases => ['-n'], :desc => "Specify name of recipe. Defaults to base name.", :required => true
|
78
|
-
method_option :submodule, :aliases => ['--vendor', '-s'], :desc => "Submodule the URI into recipe folder name"
|
79
78
|
def sm(uri, *commands)
|
80
79
|
require 'engineyard-recipes/generators/sm_generator'
|
81
|
-
recipe_name
|
82
|
-
|
83
|
-
|
84
|
-
sm_vendor_path = File.join("cookbooks", recipe_name, options["submodule"])
|
85
|
-
end
|
86
|
-
Engineyard::Recipes::Generators::SmGenerator.start([recipe_name, uri, commands, sm_vendor_path])
|
87
|
-
if sm_vendor_path
|
88
|
-
FetchUri.vendor_recipe_into_recipe(uri, sm_vendor_path)
|
89
|
-
end
|
80
|
+
recipe_name = options["name"]
|
81
|
+
|
82
|
+
Engineyard::Recipes::Generators::SmGenerator.start([recipe_name, uri, commands])
|
90
83
|
end
|
91
84
|
|
92
85
|
desc "version", "show version information"
|
@@ -21,18 +21,16 @@ module Engineyard::Recipes
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
# Vendor/submodule the +uri+ into current git repo at +
|
25
|
-
# If +uri+ is a local folder, then copy folder to +
|
26
|
-
# If +uri+ is a remote git repo, then
|
27
|
-
def vendor_recipe_into_recipe(uri,
|
24
|
+
# Vendor/submodule the +uri+ into current git repo at +recipe_vendor_path+
|
25
|
+
# If +uri+ is a local folder, then copy folder to +recipe_vendor_path+
|
26
|
+
# If +uri+ is a remote git repo, then clone/copy to +recipe_vendor_path+
|
27
|
+
def vendor_recipe_into_recipe(uri, recipe_vendor_path)
|
28
|
+
FileUtils.rm_rf(recipe_vendor_path)
|
28
29
|
if File.exists?(uri)
|
29
|
-
FileUtils.cp_r(uri,
|
30
|
+
FileUtils.cp_r(uri, recipe_vendor_path)
|
30
31
|
else
|
31
|
-
|
32
|
-
|
33
|
-
else
|
34
|
-
raise TargetPathNotGitRepository
|
35
|
-
end
|
32
|
+
git "clone #{uri} #{recipe_vendor_path}"
|
33
|
+
FileUtils.rm_rf(File.join(recipe_vendor_path, ".git"))
|
36
34
|
end
|
37
35
|
end
|
38
36
|
|
@@ -9,7 +9,6 @@ module Engineyard::Recipes
|
|
9
9
|
argument :recipe_name
|
10
10
|
argument :sm_ext_uri
|
11
11
|
argument :sm_ext_commands, :type => :array
|
12
|
-
argument :sm_vendor_path, :required => false
|
13
12
|
|
14
13
|
def self.source_root
|
15
14
|
File.join(File.dirname(__FILE__), "sm_generator", "templates")
|
@@ -34,11 +33,18 @@ module Engineyard::Recipes
|
|
34
33
|
append_to_file file, require_recipe
|
35
34
|
end
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
color ? shell.say(msg, color) : shell.say(msg)
|
36
|
+
def vendor
|
37
|
+
FetchUri.vendor_recipe_into_recipe(sm_ext_uri, recipe_vendor_path)
|
40
38
|
end
|
41
39
|
|
40
|
+
protected
|
41
|
+
def recipe_vendor_path_name
|
42
|
+
"repo"
|
43
|
+
end
|
44
|
+
|
45
|
+
def recipe_vendor_path
|
46
|
+
cookbooks_dir File.join(recipe_name, "repo")
|
47
|
+
end
|
42
48
|
end
|
43
49
|
end
|
44
50
|
end
|
@@ -1,6 +1,2 @@
|
|
1
|
-
<% if sm_vendor_path -%>
|
2
1
|
<% # assumes render file is at 'cookbooks/recipe-name/attributes/recipe.rb' -%>
|
3
|
-
sm_<%= recipe_name %>_uri(File.expand_path('
|
4
|
-
<% else -%>
|
5
|
-
sm_<%= recipe_name %>_uri('<%= sm_ext_uri %>')
|
6
|
-
<% end %>
|
2
|
+
sm_<%= recipe_name %>_uri(File.expand_path('../../<%= recipe_vendor_path_name %>', __FILE__))
|
data/spec/fetch_uri_spec.rb
CHANGED
@@ -12,9 +12,9 @@ describe Engineyard::Recipes::FetchUri do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
|
15
|
-
# Vendor/submodule the +uri+ into current git repo at +
|
16
|
-
# If +uri+ is a local folder, then copy folder to +
|
17
|
-
# If +uri+ is a remote git repo, then submodule to +
|
15
|
+
# Vendor/submodule the +uri+ into current git repo at +recipe_vendor_path+
|
16
|
+
# If +uri+ is a local folder, then copy folder to +recipe_vendor_path+
|
17
|
+
# If +uri+ is a remote git repo, then submodule to +recipe_vendor_path+
|
18
18
|
describe "#vendor_recipe_into_recipe" do
|
19
19
|
end
|
20
20
|
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: engineyard-recipes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.2
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.2
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Dr Nic Williams
|
@@ -13,7 +13,7 @@ date: 2012-03-10 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement: &
|
16
|
+
requirement: &70105552905900 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.14.6
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70105552905900
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: engineyard
|
27
|
-
requirement: &
|
27
|
+
requirement: &70105552905220 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.4.6
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70105552905220
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &70105552904740 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.9.2
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70105552904740
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: cucumber
|
49
|
-
requirement: &
|
49
|
+
requirement: &70105552904260 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.1.2
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70105552904260
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rspec
|
60
|
-
requirement: &
|
60
|
+
requirement: &70105552903780 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 2.7.0
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70105552903780
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: launchy
|
71
|
-
requirement: &
|
71
|
+
requirement: &70105552903400 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70105552903400
|
80
80
|
description: Tools to generate, upload, test and apply chef recipes for Engine Yard
|
81
81
|
Cloud.
|
82
82
|
email:
|
@@ -165,13 +165,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
165
165
|
version: '0'
|
166
166
|
segments:
|
167
167
|
- 0
|
168
|
-
hash:
|
168
|
+
hash: 2804550849415327961
|
169
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
170
|
none: false
|
171
171
|
requirements:
|
172
|
-
- - ! '
|
172
|
+
- - ! '>='
|
173
173
|
- !ruby/object:Gem::Version
|
174
|
-
version:
|
174
|
+
version: '0'
|
175
|
+
segments:
|
176
|
+
- 0
|
177
|
+
hash: 2804550849415327961
|
175
178
|
requirements: []
|
176
179
|
rubyforge_project: engineyard-recipes
|
177
180
|
rubygems_version: 1.8.17
|