engineyard-recipes 0.0.1 → 0.0.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 ADDED
@@ -0,0 +1,11 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.3
4
+ - rbx
5
+ - jruby
6
+ notifications:
7
+ recipients:
8
+ - drnicwilliams@gmail.com
9
+ branches:
10
+ only:
11
+ - master
data/README.md CHANGED
@@ -2,10 +2,45 @@
2
2
 
3
3
  Tools to generate, upload, test and apply chef recipes for Engine Yard Cloud.
4
4
 
5
+ [![Build Status](https://secure.travis-ci.org/engineyard/engineyard-recipes.png)](http://travis-ci.org/engineyard/engineyard-recipes)
6
+
5
7
  ## Usage
6
8
 
9
+ Getting started:
10
+
7
11
  ```
8
12
  $ cd /path/to/my/app
9
13
  $ ey-recipes init
10
14
  cookbooks/main/attributes/default.rb
11
- cookbooks/main/recipes/default.rb
15
+ cookbooks/main/recipes/default.rb
16
+ ```
17
+
18
+ Quickly generate recipes from git repositories.
19
+
20
+ Either repos that describe a recipe such as [ey-dnapi](https://github.com/damm/ey-dnapi):
21
+
22
+ ```
23
+ $ ey-recipes clone git://github.com/damm/ey-dnapi.git
24
+ ```
25
+
26
+ Or repos that contain multiple recipes, such as [ey-cloud-recipes](https://github.com/engineyard/ey-cloud-recipes/tree/master/cookbooks/):
27
+
28
+ ```
29
+ $ ey-recipes clone git://github.com/engineyard/ey-cloud-recipes.git --path cookbooks/emerge
30
+ ```
31
+
32
+ Generate scaffolding for a package/service.
33
+
34
+ ```
35
+ $ ey-recipes recipe newthing
36
+ create cookbooks/newthing/attributes/recipe.rb
37
+ create cookbooks/newthing/recipes/default.rb
38
+ create cookbooks/newthing/recipes/install.rb
39
+ ```
40
+
41
+ Generate scaffolding for helper functions:
42
+
43
+ ```
44
+ $ ey-recipes definition myhelpers some_helper
45
+ create cookbooks/mylibrary/definitions/helper1.rb
46
+ ```
data/Rakefile CHANGED
@@ -1 +1,17 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ namespace :cucumber do
4
+ require 'cucumber/rake/task'
5
+ Cucumber::Rake::Task.new(:wip, 'Run features that are being worked on') do |t|
6
+ t.cucumber_opts = "--tags @wip"
7
+ end
8
+ Cucumber::Rake::Task.new(:ok, 'Run features that should be working') do |t|
9
+ t.cucumber_opts = "--tags ~@wip"
10
+ end
11
+ task :all => [:ok, :wip]
12
+ end
13
+
14
+ desc 'Alias for cucumber:ok'
15
+ task :cucumber => 'cucumber:ok'
16
+
17
+ task :default => ["cucumber"]
@@ -0,0 +1,33 @@
1
+ Feature: Clone recipe from git repositories
2
+ I want to quickly generate recipes from existing git repositories
3
+ From either the whole repository or a specific folder
4
+
5
+ Background:
6
+ Given I am in the "rails" project folder
7
+ When I run local executable "ey-recipes" with arguments "init"
8
+
9
+ @wip
10
+ Scenario: Clone a recipe from engineyard/ey-cloud-recipes repository
11
+ When I run local executable "ey-recipes" with arguments "clone git://github.com/engineyard/ey-cloud-recipes.git --recipe emerge"
12
+ Then file "cookbooks/emerge/recipes/default.rb" is created
13
+ And I should see exactly
14
+ """
15
+ create cookbooks/emerge/definitions/enable_package.rb
16
+ create cookbooks/emerge/definitions/package_use.rb
17
+ create cookbooks/emerge/definitions/update_file.rb
18
+ create cookbooks/emerge/README.rdoc
19
+ """
20
+
21
+ @wip
22
+ Scenario: Clone repository as an entire recipe
23
+ When I run local executable "ey-recipes" with arguments "clone git://github.com/damm/ey-dnapi.git --name dnapi"
24
+ Then file "cookbooks/dnapi/libraries/engineyard.rb" is created
25
+ And I should see exactly
26
+ """
27
+ create cookbooks/dnapi/libraries/engineyard.rb
28
+ create cookbooks/dnapi/README.rdoc
29
+ """
30
+
31
+
32
+
33
+
@@ -0,0 +1,29 @@
1
+ Feature: Generate helper definitions recipe
2
+ I want to generate a new chef recipe for definition helpers
3
+
4
+ Background:
5
+ Given I am in the "rails" project folder
6
+ When I run local executable "ey-recipes" with arguments "init"
7
+
8
+ Scenario: Generate a new recipe
9
+ When I run local executable "ey-recipes" with arguments "definition mylibrary helper1"
10
+ And file "cookbooks/mylibrary/definitions/helper1.rb" is created
11
+ And file "cookbooks/mylibrary/definitions/helper1.rb" contains "define :helper1 do"
12
+ And I should see exactly
13
+ """
14
+ exist cookbooks
15
+ create cookbooks/mylibrary/definitions/helper1.rb
16
+ """
17
+
18
+ Scenario: Generate a recipe that already exists
19
+ When I run local executable "ey-recipes" with arguments "definition mylibrary helper1"
20
+ When I run local executable "ey-recipes" with arguments "definition mylibrary helper2"
21
+ And file "cookbooks/mylibrary/definitions/helper2.rb" contains "define :helper2 do"
22
+ And I should see exactly
23
+ """
24
+ exist cookbooks
25
+ create cookbooks/mylibrary/definitions/helper2.rb
26
+ """
27
+
28
+
29
+
@@ -0,0 +1,36 @@
1
+ Feature: Generate package recipe
2
+ I want to generate a new chef recipe for a package
3
+ And it is automatically included in the main recipe/run
4
+
5
+ Background:
6
+ Given I am in the "rails" project folder
7
+ When I run local executable "ey-recipes" with arguments "init"
8
+
9
+ Scenario: Generate a new recipe
10
+ When I run local executable "ey-recipes" with arguments "recipe new-component"
11
+ And file "cookbooks/new-component/recipes/default.rb" is created
12
+ And file "cookbooks/new-component/recipes/default.rb" contains "require_recipe 'new-component::install'"
13
+ And file "cookbooks/new-component/recipes/install.rb" is created
14
+ And file "cookbooks/new-component/attributes/recipe.rb" is created
15
+ And I should see exactly
16
+ """
17
+ exist cookbooks
18
+ create cookbooks/new-component/attributes/recipe.rb
19
+ create cookbooks/new-component/recipes/default.rb
20
+ create cookbooks/new-component/recipes/install.rb
21
+ """
22
+
23
+ Scenario: Generate a recipe that already exists
24
+ When I run local executable "ey-recipes" with arguments "recipe new-component"
25
+ When I run local executable "ey-recipes" with arguments "recipe new-component"
26
+ And I should see exactly
27
+ """
28
+ exist cookbooks
29
+ identical cookbooks/new-component/attributes/recipe.rb
30
+ identical cookbooks/new-component/recipes/default.rb
31
+ identical cookbooks/new-component/recipes/install.rb
32
+ """
33
+
34
+
35
+
36
+
@@ -11,6 +11,18 @@ module Engineyard
11
11
  Engineyard::Recipes::Generators::InitGenerator.start
12
12
  end
13
13
 
14
+ desc "recipe RECIPE", "Generate recipe for a package"
15
+ def recipe(recipe_name)
16
+ require 'engineyard-recipes/generators/recipe_generator'
17
+ Engineyard::Recipes::Generators::RecipeGenerator.start([recipe_name])
18
+ end
19
+
20
+ desc "definition RECIPE DEFINITION", "Generate recipe for a package"
21
+ def definition(recipe_name, definition_name)
22
+ require 'engineyard-recipes/generators/definition_generator'
23
+ Engineyard::Recipes::Generators::DefinitionGenerator.start([recipe_name, definition_name])
24
+ end
25
+
14
26
  desc "version", "show version information"
15
27
  def version
16
28
  require 'engineyard-recipes/version'
@@ -0,0 +1,25 @@
1
+ require 'thor/group'
2
+
3
+ module Engineyard::Recipes
4
+ module Generators
5
+ class DefinitionGenerator < Thor::Group
6
+ include Thor::Actions
7
+
8
+ argument :recipe_name
9
+ argument :definition_name
10
+
11
+ def self.source_root
12
+ File.join(File.dirname(__FILE__), "definition_generator", "templates")
13
+ end
14
+
15
+ def install_cookbooks
16
+ directory "cookbooks"
17
+ end
18
+
19
+ private
20
+ def say(msg, color = nil)
21
+ color ? shell.say(msg, color) : shell.say(msg)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,5 @@
1
+ #
2
+ # Cookbook Name:: <%= recipe_name %>
3
+ # Recipe:: default
4
+ #
5
+ require_recipe '<%= recipe_name %>::install'
@@ -0,0 +1,10 @@
1
+ #
2
+ # Cookbook Name:: <%= recipe_name %>
3
+ # Recipe:: install
4
+ #
5
+
6
+ # package 'dev-something/<%= recipe_name %>' do
7
+ # version node[:<%= recipe_name %>_version]
8
+ #
9
+ # action :install
10
+ # end
@@ -0,0 +1,24 @@
1
+ require 'thor/group'
2
+
3
+ module Engineyard::Recipes
4
+ module Generators
5
+ class RecipeGenerator < Thor::Group
6
+ include Thor::Actions
7
+
8
+ argument :recipe_name
9
+
10
+ def self.source_root
11
+ File.join(File.dirname(__FILE__), "recipe_generator", "templates")
12
+ end
13
+
14
+ def install_cookbooks
15
+ directory "cookbooks"
16
+ end
17
+
18
+ private
19
+ def say(msg, color = nil)
20
+ color ? shell.say(msg, color) : shell.say(msg)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,5 +1,5 @@
1
1
  module Engineyard
2
2
  module Recipes
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
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.0.1
4
+ version: 0.0.2
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: 2011-11-13 00:00:00.000000000Z
12
+ date: 2011-11-15 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &70345820762760 !ruby/object:Gem::Requirement
16
+ requirement: &70318435940960 !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: *70345820762760
24
+ version_requirements: *70318435940960
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: engineyard
27
- requirement: &70345820762200 !ruby/object:Gem::Requirement
27
+ requirement: &70318435940360 !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: *70345820762200
35
+ version_requirements: *70318435940360
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &70345820761680 !ruby/object:Gem::Requirement
38
+ requirement: &70318435939860 !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: *70345820761680
46
+ version_requirements: *70318435939860
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: cucumber
49
- requirement: &70345820761180 !ruby/object:Gem::Requirement
49
+ requirement: &70318435939380 !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: *70345820761180
57
+ version_requirements: *70318435939380
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec
60
- requirement: &70345820760660 !ruby/object:Gem::Requirement
60
+ requirement: &70318435938900 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: 2.7.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70345820760660
68
+ version_requirements: *70318435938900
69
69
  description: Tools to generate, upload, test and apply chef recipes for Engine Yard
70
70
  Cloud.
71
71
  email:
@@ -76,11 +76,15 @@ extensions: []
76
76
  extra_rdoc_files: []
77
77
  files:
78
78
  - .gitignore
79
+ - .travis.yml
79
80
  - Gemfile
80
81
  - README.md
81
82
  - Rakefile
82
83
  - bin/ey-recipes
83
84
  - engineyard-recipes.gemspec
85
+ - features/clone-recipe.feature
86
+ - features/generate-helper-definitions.feature
87
+ - features/generate-recipe.feature
84
88
  - features/init-new-cookbook.feature
85
89
  - features/step_definitions/api_steps.rb
86
90
  - features/step_definitions/common_steps.rb
@@ -100,12 +104,18 @@ files:
100
104
  - fixtures/projects/rails/Rakefile
101
105
  - lib/engineyard-recipes.rb
102
106
  - lib/engineyard-recipes/cli.rb
107
+ - lib/engineyard-recipes/generators/definition_generator.rb
108
+ - lib/engineyard-recipes/generators/definition_generator/templates/cookbooks/%recipe_name%/definitions/%definition_name%.rb.tt
103
109
  - lib/engineyard-recipes/generators/init_generator.rb
104
110
  - lib/engineyard-recipes/generators/init_generator/templates/cookbooks/main/attributes/recipe.rb
105
111
  - lib/engineyard-recipes/generators/init_generator/templates/cookbooks/main/definitions/ey_cloud_report.rb
106
112
  - lib/engineyard-recipes/generators/init_generator/templates/cookbooks/main/libraries/ruby_block.rb
107
113
  - lib/engineyard-recipes/generators/init_generator/templates/cookbooks/main/libraries/run_for_app.rb
108
114
  - lib/engineyard-recipes/generators/init_generator/templates/cookbooks/main/recipes/default.rb
115
+ - lib/engineyard-recipes/generators/recipe_generator.rb
116
+ - lib/engineyard-recipes/generators/recipe_generator/templates/cookbooks/%recipe_name%/attributes/recipe.rb.tt
117
+ - lib/engineyard-recipes/generators/recipe_generator/templates/cookbooks/%recipe_name%/recipes/default.rb.tt
118
+ - lib/engineyard-recipes/generators/recipe_generator/templates/cookbooks/%recipe_name%/recipes/install.rb.tt
109
119
  - lib/engineyard-recipes/thor-ext/actions/directory.rb
110
120
  - lib/engineyard-recipes/version.rb
111
121
  homepage: ''
@@ -122,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
132
  version: '0'
123
133
  segments:
124
134
  - 0
125
- hash: -3089194490767720342
135
+ hash: 1837367899578002630
126
136
  required_rubygems_version: !ruby/object:Gem::Requirement
127
137
  none: false
128
138
  requirements:
@@ -131,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
141
  version: '0'
132
142
  segments:
133
143
  - 0
134
- hash: -3089194490767720342
144
+ hash: 1837367899578002630
135
145
  requirements: []
136
146
  rubyforge_project: engineyard-recipes
137
147
  rubygems_version: 1.8.6
@@ -139,6 +149,9 @@ signing_key:
139
149
  specification_version: 3
140
150
  summary: Tools to generate, upload, test and apply chef recipes for Engine Yard Cloud.
141
151
  test_files:
152
+ - features/clone-recipe.feature
153
+ - features/generate-helper-definitions.feature
154
+ - features/generate-recipe.feature
142
155
  - features/init-new-cookbook.feature
143
156
  - features/step_definitions/api_steps.rb
144
157
  - features/step_definitions/common_steps.rb