engineyard-recipes 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # ChangeLog
2
2
 
3
+ ## v0.4
4
+
5
+ * `package` - renamed from `recipe`; bug fixes
6
+
3
7
  ## v0.3
4
8
 
5
9
  * `--local` (clone, recipes, definitions) - generates into local path instead of cookbooks/ subfolder; useful for developing dedicated recipe repositories instead of an entire cookbook; ignores cookbooks/main/recipes/default.rb
data/README.md CHANGED
@@ -11,7 +11,7 @@ Tools to generate, upload, test and apply chef recipes for Engine Yard Cloud.
11
11
  ```
12
12
  $ cd /path/to/my/app
13
13
  $ ey-recipes init # initial scaffolding for cookbooks
14
- $ ey-recipes recipe somepackage
14
+ $ ey-recipes package somepackage
15
15
  $ ey-recipes definition somehelpers specific_helper_method
16
16
  $ git clone git://github.com/damm/ey-dnapi.git /tmp/recipes/ey-dnapi
17
17
  $ ey-recipes clone /tmp/recipes/ey-dnapi
@@ -25,7 +25,7 @@ Alternately, you can have chef recipes run during deployment rather than by expl
25
25
  ```
26
26
  $ cd /path/to/my/app
27
27
  $ ey-recipes init -d
28
- $ ey-recipes recipe somepackage
28
+ $ ey-recipes package somepackage
29
29
 
30
30
  # then deploy to apply recipes
31
31
  $ ey deploy
@@ -77,7 +77,7 @@ $ ey-recipes clone /tmp/recipes/ey-dnapi
77
77
  Generate scaffolding for a package/service.
78
78
 
79
79
  ```
80
- $ ey-recipes recipe newthing
80
+ $ ey-recipes package newthing
81
81
  create cookbooks/newthing/attributes/recipe.rb
82
82
  create cookbooks/newthing/recipes/default.rb
83
83
  create cookbooks/newthing/recipes/install.rb
@@ -87,7 +87,8 @@ $ ey-recipes recipe newthing
87
87
  Specify an explicit Gentoo package.
88
88
 
89
89
  ```
90
- $ ey-recipes recipe gitosis -p dev-util/gitosis-gentoo -v 0.2_p20081028
90
+ $ ey-recipes package gitosis -p dev-util/gitosis-gentoo -v 0.2_p20081028
91
+ $ ey-recipes package qt-webkit -p x11-libs/qt-webkit -v 4.4.2 -u
91
92
  ```
92
93
 
93
94
  To use a masked package, pass the `--unmasked/-u` flag, and install the `emerge` helper described below.
@@ -1,5 +1,5 @@
1
- Feature: Generate package recipe into cookbook
2
- I want to generate a new chef recipe for a package
1
+ Feature: Install a gentoo package
2
+ I want to generate a new chef recipe that will install a package
3
3
  And it is automatically included in the main recipe/run
4
4
 
5
5
  Background:
@@ -7,12 +7,12 @@ Feature: Generate package recipe into cookbook
7
7
  When I run local executable "ey-recipes" with arguments "init"
8
8
 
9
9
  Scenario: Generate a new recipe
10
- When I run local executable "ey-recipes" with arguments "recipe new-component"
10
+ When I run local executable "ey-recipes" with arguments "package new-component"
11
11
  And file "cookbooks/new-component/recipes/default.rb" is created
12
12
  And file "cookbooks/new-component/recipes/default.rb" contains "require_recipe 'new-component::install'"
13
13
  And file "cookbooks/new-component/recipes/install.rb" is created
14
14
  And file "cookbooks/new-component/attributes/recipe.rb" is created
15
- And file "cookbooks/new-component/attributes/recipe.rb" contains "# new-component_version('1.0.0')"
15
+ And file "cookbooks/new-component/attributes/recipe.rb" contains "# new_component_version('1.0.0')"
16
16
  And file "cookbooks/main/recipes/default.rb" contains "require_recipe 'new-component'"
17
17
  And I should see exactly
18
18
  """
@@ -24,8 +24,8 @@ Feature: Generate package recipe into cookbook
24
24
  """
25
25
 
26
26
  Scenario: Generate a recipe that already exists
27
- When I run local executable "ey-recipes" with arguments "recipe new-component"
28
- When I run local executable "ey-recipes" with arguments "recipe new-component"
27
+ When I run local executable "ey-recipes" with arguments "package new-component"
28
+ When I run local executable "ey-recipes" with arguments "package new-component"
29
29
  And I should see exactly
30
30
  """
31
31
  exist cookbooks
@@ -36,7 +36,7 @@ Feature: Generate package recipe into cookbook
36
36
  """
37
37
 
38
38
  Scenario: Generate a new recipe for a specific package/version that is stable
39
- When I run local executable "ey-recipes" with arguments "recipe gitosis -p dev-util/gitosis-gentoo -v 0.2_p20081028"
39
+ When I run local executable "ey-recipes" with arguments "package gitosis -p dev-util/gitosis-gentoo -v 0.2_p20081028"
40
40
  And file "cookbooks/gitosis/recipes/default.rb" is created
41
41
  And file "cookbooks/gitosis/recipes/default.rb" contains "require_recipe 'gitosis::install'"
42
42
  And file "cookbooks/gitosis/recipes/install.rb" is created
@@ -57,33 +57,36 @@ Feature: Generate package recipe into cookbook
57
57
  """
58
58
 
59
59
  Scenario: Generate a new recipe for a specific package/version that is masked
60
- When I run local executable "ey-recipes" with arguments "recipe gitosis -p dev-util/gitosis-gentoo -v 0.2_p20081028 -u"
61
- And file "cookbooks/gitosis/recipes/default.rb" is created
62
- And file "cookbooks/gitosis/recipes/default.rb" contains "require_recipe 'gitosis::install'"
63
- And file "cookbooks/gitosis/recipes/install.rb" is created
64
- And file "cookbooks/gitosis/attributes/recipe.rb" is created
65
- And file "cookbooks/gitosis/attributes/recipe.rb" contains "gitosis_version('0.2_p20081028')"
66
- And file "cookbooks/gitosis/attributes/recipe.rb" does not contain "# gitosis_version('0.2_p20081028')"
67
- And file "cookbooks/gitosis/recipes/install.rb" contains
60
+ When I run local executable "ey-recipes" with arguments "package qt-webkit -p x11-libs/qt-webkit -v 4.4.2 -u"
61
+ And file "cookbooks/qt-webkit/recipes/default.rb" is created
62
+ And file "cookbooks/qt-webkit/recipes/default.rb" contains "require_recipe 'qt-webkit::install'"
63
+ And file "cookbooks/qt-webkit/recipes/install.rb" is created
64
+ And file "cookbooks/qt-webkit/attributes/recipe.rb" is created
65
+ And file "cookbooks/qt-webkit/attributes/recipe.rb" contains
66
+ """
67
+ qt_webkit_version('4.4.2')
68
+
69
+ """
70
+ And file "cookbooks/qt-webkit/recipes/install.rb" contains
68
71
  """
69
72
  #
70
- # Cookbook Name:: gitosis
73
+ # Cookbook Name:: qt-webkit
71
74
  # Recipe:: install
72
75
  #
73
76
 
74
- enable_package 'dev-util/gitosis-gentoo' do
75
- version node[:gitosis_version]
77
+ enable_package 'x11-libs/qt-webkit' do
78
+ version node[:qt_webkit_version]
76
79
  end
77
80
 
78
- package 'dev-util/gitosis-gentoo' do
79
- version node[:gitosis_version]
81
+ package 'x11-libs/qt-webkit' do
82
+ version node[:qt_webkit_version]
80
83
  action :install
81
84
  end
82
-
85
+
83
86
  """
84
87
 
85
88
  Scenario: Generate a new recipe into local folder instead of in cookbooks/
86
- When I run local executable "ey-recipes" with arguments "recipe component --local"
89
+ When I run local executable "ey-recipes" with arguments "package component --local"
87
90
  And file "component/recipes/default.rb" is created
88
91
  And file "component/recipes/default.rb" contains "require_recipe 'component::install'"
89
92
  And file "component/recipes/install.rb" is created
@@ -24,19 +24,19 @@ module Engineyard
24
24
  Engineyard::Recipes::Generators::InitSmGenerator.start
25
25
  end
26
26
 
27
- desc "recipe RECIPE", "Generate recipe for a package"
27
+ desc "package PACKAGE", "Install a gentoo ebuild package"
28
28
  method_option :package, :aliases => ['-p'], :desc => "Gentoo package name, e.g. dev-util/gitosis-gentoo"
29
29
  method_option :version, :aliases => ['-v'], :desc => "Gentoo package version, e.g. 0.2_p20081028"
30
30
  method_options %w( unmasked -u ) => :boolean, :desc => "Unmask the required gentoo package"
31
31
  method_option :local, :aliases => ['-l'], :type => :boolean, :desc => "Generate into local folder, instead of cookbooks/RECIPE_NAME"
32
- def recipe(recipe_name)
32
+ def package(recipe_name)
33
33
  package = options["package"] || "UNKNOWN/#{recipe_name}"
34
34
  version = options["version"] || '1.0.0'
35
35
  unmasked = options["unmasked"] || false
36
36
  local = options["local"] || false
37
37
 
38
- require 'engineyard-recipes/generators/recipe_generator'
39
- Engineyard::Recipes::Generators::RecipeGenerator.start([
38
+ require 'engineyard-recipes/generators/package_generator'
39
+ Engineyard::Recipes::Generators::PackageGenerator.start([
40
40
  recipe_name, package, version, {:unmasked => unmasked, :local => local}
41
41
  ])
42
42
  end
@@ -2,7 +2,7 @@ require 'thor/group'
2
2
 
3
3
  module Engineyard::Recipes
4
4
  module Generators
5
- class RecipeGenerator < BaseGenerator
5
+ class PackageGenerator < BaseGenerator
6
6
  include Thor::Actions
7
7
 
8
8
  argument :recipe_name
@@ -11,7 +11,7 @@ module Engineyard::Recipes
11
11
  argument :flags, :type => :hash # :unmasked & :local
12
12
 
13
13
  def self.source_root
14
- File.join(File.dirname(__FILE__), "recipe_generator", "templates")
14
+ File.join(File.dirname(__FILE__), "package_generator", "templates")
15
15
  end
16
16
 
17
17
  def install_cookbooks
@@ -26,7 +26,11 @@ module Engineyard::Recipes
26
26
  end
27
27
  end
28
28
 
29
- private
29
+ protected
30
+ def recipe_name_variable_name
31
+ @recipe_name_variable_name ||= recipe_name.gsub(/\W+/, '_')
32
+ end
33
+
30
34
  def known_package?
31
35
  package =~ /UNKNOWN/
32
36
  end
@@ -0,0 +1,5 @@
1
+ <% unless known_package? -%>
2
+ <%= recipe_name_variable_name %>_version('<%= version %>')
3
+ <% else -%>
4
+ # <%= recipe_name_variable_name %>_version('<%= version %>')
5
+ <% end %>
@@ -6,17 +6,17 @@
6
6
  <% unless known_package? -%>
7
7
  <% if unmasked -%>
8
8
  enable_package '<%= package %>' do
9
- version node[:<%= recipe_name %>_version]
9
+ version node[:<%= recipe_name_variable_name %>_version]
10
10
  end
11
11
 
12
12
  <% end -%>
13
13
  package '<%= package %>' do
14
- version node[:<%= recipe_name %>_version]
14
+ version node[:<%= recipe_name_variable_name %>_version]
15
15
  action :install
16
16
  end
17
17
  <% else -%>
18
18
  # package '<%= package %>' do
19
- # version node[:<%= recipe_name %>_version]
19
+ # version node[:<%= recipe_name_variable_name %>_version]
20
20
  # action :install
21
21
  # end
22
22
  <% end -%>
@@ -1,5 +1,5 @@
1
1
  module Engineyard
2
2
  module Recipes
3
- VERSION = "0.3.2"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engineyard-recipes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-10 00:00:00.000000000 Z
12
+ date: 2012-03-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &70105552905900 !ruby/object:Gem::Requirement
16
+ requirement: &70236150882240 !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: *70105552905900
24
+ version_requirements: *70236150882240
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: engineyard
27
- requirement: &70105552905220 !ruby/object:Gem::Requirement
27
+ requirement: &70236150881400 !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: *70105552905220
35
+ version_requirements: *70236150881400
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &70105552904740 !ruby/object:Gem::Requirement
38
+ requirement: &70236150880580 !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: *70105552904740
46
+ version_requirements: *70236150880580
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: cucumber
49
- requirement: &70105552904260 !ruby/object:Gem::Requirement
49
+ requirement: &70236150879640 !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: *70105552904260
57
+ version_requirements: *70236150879640
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec
60
- requirement: &70105552903780 !ruby/object:Gem::Requirement
60
+ requirement: &70236150878820 !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: *70105552903780
68
+ version_requirements: *70236150878820
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: launchy
71
- requirement: &70105552903400 !ruby/object:Gem::Requirement
71
+ requirement: &70236150877960 !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: *70105552903400
79
+ version_requirements: *70236150877960
80
80
  description: Tools to generate, upload, test and apply chef recipes for Engine Yard
81
81
  Cloud.
82
82
  email:
@@ -97,9 +97,9 @@ files:
97
97
  - engineyard-recipes.gemspec
98
98
  - features/clone-recipe.feature
99
99
  - features/generate-helper-definitions.feature
100
- - features/generate-recipe-in-cookbook.feature
101
100
  - features/init-new-cookbook.feature
102
101
  - features/init-sm-framework.feature
102
+ - features/install-package.feature
103
103
  - features/step_definitions/api_steps.rb
104
104
  - features/step_definitions/common_steps.rb
105
105
  - features/step_definitions/fixture_project_steps.rb
@@ -134,10 +134,10 @@ files:
134
134
  - lib/engineyard-recipes/generators/init_sm_generator/templates/cookbooks/sm/recipes/install.rb
135
135
  - lib/engineyard-recipes/generators/local_recipe_clone_generator.rb
136
136
  - lib/engineyard-recipes/generators/local_recipe_clone_generator/templates/cookbooks/%recipe_name%/definitions/%definition_name%.rb.tt
137
- - lib/engineyard-recipes/generators/recipe_generator.rb
138
- - lib/engineyard-recipes/generators/recipe_generator/templates/cookbooks/%recipe_name%/attributes/recipe.rb.tt
139
- - lib/engineyard-recipes/generators/recipe_generator/templates/cookbooks/%recipe_name%/recipes/default.rb.tt
140
- - lib/engineyard-recipes/generators/recipe_generator/templates/cookbooks/%recipe_name%/recipes/install.rb.tt
137
+ - lib/engineyard-recipes/generators/package_generator.rb
138
+ - lib/engineyard-recipes/generators/package_generator/templates/cookbooks/%recipe_name%/attributes/recipe.rb.tt
139
+ - lib/engineyard-recipes/generators/package_generator/templates/cookbooks/%recipe_name%/recipes/default.rb.tt
140
+ - lib/engineyard-recipes/generators/package_generator/templates/cookbooks/%recipe_name%/recipes/install.rb.tt
141
141
  - lib/engineyard-recipes/generators/sm_generator.rb
142
142
  - lib/engineyard-recipes/generators/sm_generator/templates/command_recipe.rb.tt
143
143
  - lib/engineyard-recipes/generators/sm_generator/templates/cookbooks/%recipe_name%/attributes/recipe.rb.tt
@@ -165,7 +165,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
165
165
  version: '0'
166
166
  segments:
167
167
  - 0
168
- hash: 2804550849415327961
168
+ hash: 979474682271499265
169
169
  required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  none: false
171
171
  requirements:
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
174
  version: '0'
175
175
  segments:
176
176
  - 0
177
- hash: 2804550849415327961
177
+ hash: 979474682271499265
178
178
  requirements: []
179
179
  rubyforge_project: engineyard-recipes
180
180
  rubygems_version: 1.8.17
@@ -184,9 +184,9 @@ summary: Tools to generate, upload, test and apply chef recipes for Engine Yard
184
184
  test_files:
185
185
  - features/clone-recipe.feature
186
186
  - features/generate-helper-definitions.feature
187
- - features/generate-recipe-in-cookbook.feature
188
187
  - features/init-new-cookbook.feature
189
188
  - features/init-sm-framework.feature
189
+ - features/install-package.feature
190
190
  - features/step_definitions/api_steps.rb
191
191
  - features/step_definitions/common_steps.rb
192
192
  - features/step_definitions/fixture_project_steps.rb
@@ -1,5 +0,0 @@
1
- <% unless known_package? -%>
2
- <%= recipe_name %>_version('<%= version %>')
3
- <% else -%>
4
- # <%= recipe_name %>_version('<%= version %>')
5
- <% end %>