playmo 0.0.18 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/README.md +107 -10
  2. data/TODO.md +57 -33
  3. data/lib/playmo.rb +28 -29
  4. data/lib/playmo/action.rb +38 -0
  5. data/lib/playmo/answer.rb +17 -8
  6. data/lib/playmo/choice.rb +23 -22
  7. data/lib/playmo/cli.rb +31 -9
  8. data/lib/playmo/cookbook.rb +16 -17
  9. data/lib/playmo/question.rb +70 -37
  10. data/lib/playmo/recipe.rb +115 -32
  11. data/lib/playmo/recipes/application_controller_recipe.rb +12 -21
  12. data/lib/playmo/recipes/application_helper_recipe.rb +26 -37
  13. data/lib/playmo/recipes/assets_recipe.rb +8 -17
  14. data/lib/playmo/recipes/capistrano_recipe.rb +13 -24
  15. data/lib/playmo/recipes/compass_recipe.rb +7 -18
  16. data/lib/playmo/recipes/devise_recipe.rb +155 -168
  17. data/lib/playmo/recipes/forms_recipe.rb +16 -38
  18. data/lib/playmo/recipes/gemfile_recipe.rb +10 -0
  19. data/lib/playmo/recipes/git_recipe.rb +23 -29
  20. data/lib/playmo/recipes/home_controller_recipe.rb +60 -73
  21. data/lib/playmo/recipes/javascript_framework_recipe.rb +27 -42
  22. data/lib/playmo/recipes/layout_recipe.rb +9 -19
  23. data/lib/playmo/recipes/locale_recipe.rb +22 -0
  24. data/lib/playmo/recipes/markup_recipe.rb +15 -28
  25. data/lib/playmo/recipes/rails_recipe.rb +8 -0
  26. data/lib/playmo/recipes/rspec_recipe.rb +18 -35
  27. data/lib/playmo/recipes/rvm_recipe.rb +9 -16
  28. data/lib/playmo/recipes/setup_database_recipe.rb +10 -19
  29. data/lib/playmo/recipes/thinking_sphinx_recipe.rb +10 -25
  30. data/lib/playmo/recipes/unicorn_recipe.rb +8 -19
  31. data/lib/playmo/silent.rb +3 -13
  32. data/lib/playmo/version.rb +2 -2
  33. metadata +16 -13
  34. data/lib/playmo/recipes/congrats_recipe.rb +0 -20
@@ -1,19 +1,12 @@
1
- module Playmo
2
- module Recipes
3
- class RvmRecipe < Playmo::Recipe
4
- source_root File.expand_path('../templates/rvm_recipe', __FILE__)
5
-
6
- def setup
7
- silently do
8
- if system 'which rvm'
9
- run "cd #{application_name} && rvm #{RUBY_VERSION}@#{application_name} --rvmrc --create"
10
- end
11
- end
1
+ recipe :rvm do
2
+ description 'This will create .rvmrc file for your app if rvm is available'
3
+ after :capistrano
4
+
5
+ silently do
6
+ if system 'which rvm > /dev/null'
7
+ in_root do
8
+ run "rvm #{RUBY_VERSION}@#{application_name} --rvmrc --create"
12
9
  end
13
10
  end
14
11
  end
15
- end
16
-
17
- # Write down this recipe to our Cookbook if it's available
18
- require File.dirname(__FILE__) + '/capistrano_recipe'
19
- Playmo::Cookbook.instance.insert_after(Playmo::Recipes::CapistranoRecipe, Playmo::Recipes::RvmRecipe) if defined?(Playmo::Cookbook)
12
+ end
@@ -1,21 +1,12 @@
1
- module Playmo
2
- module Recipes
3
- class SetupDatabaseRecipe < Playmo::Recipe
4
- source_root File.expand_path('../templates/setup_database_recipe', __FILE__)
5
-
6
- def setup
7
- silently do
8
- Event.events.listen(:after_install) do |event_data|
9
- run "cd #{application_name} && rake db:create"
10
- run "cd #{application_name} && rake db:migrate"
11
- run "cd #{application_name} && rake db:seed"
12
- end
13
- end
14
- end
1
+ recipe :setup_database do
2
+ description 'This will create database, then migrate and seed data'
3
+ after :rvm
4
+
5
+ silently do
6
+ after_install do
7
+ run "cd #{application_name} && rake db:create"
8
+ run "cd #{application_name} && rake db:migrate"
9
+ run "cd #{application_name} && rake db:seed"
15
10
  end
16
11
  end
17
- end
18
-
19
- # Write down this recipe to our Cookbook if it's available
20
- require File.dirname(__FILE__) + '/rvm_recipe'
21
- Playmo::Cookbook.instance.insert_after(Playmo::Recipes::RvmRecipe, Playmo::Recipes::SetupDatabaseRecipe) if defined?(Playmo::Cookbook)
12
+ end
@@ -1,26 +1,11 @@
1
- module Playmo
2
- module Recipes
3
- class ThinkingSphinxRecipe < Playmo::Recipe
4
- source_root File.expand_path('../templates/thinking_sphinx_recipe', __FILE__)
5
-
6
- def setup
7
- question "Would you like to use Thinking Sphinx in this project?" => :install_ts
8
- end
9
-
10
- protected
11
-
12
- def install_ts
13
- gem 'thinking-sphinx', '~> 2.0.10'
14
-
15
- # TODO Add Whenever integration (see https://github.com/nesquena/cap-recipes)
16
- Event.events.listen(:after_install) do |event_data|
17
- template 'sphinx.yml', 'config/sphinx.yml'
18
- end
19
- end
20
- end
1
+ recipe :thinking_sphinx do
2
+ description 'This will add thinking sphinx into your app and generates sphinx.yml'
3
+ after :unicorn
4
+
5
+ ask "Would you like to use Thinking Sphinx in this project?" do
6
+ gem 'thinking-sphinx', '~> 2.0.10'
7
+
8
+ # TODO Add Whenever integration (see https://github.com/nesquena/cap-recipes)
9
+ template 'sphinx.yml', 'config/sphinx.yml'
21
10
  end
22
- end
23
-
24
- # Write down this recipe to our Cookbook if it's available
25
- require File.dirname(__FILE__) + '/unicorn_recipe'
26
- Playmo::Cookbook.instance.insert_after(Playmo::Recipes::UnicornRecipe, Playmo::Recipes::ThinkingSphinxRecipe) if defined?(Playmo::Cookbook)
11
+ end
@@ -1,20 +1,9 @@
1
- module Playmo
2
- module Recipes
3
- class UnicornRecipe < Playmo::Recipe
4
- source_root File.expand_path('../templates/unicorn_recipe', __FILE__)
5
-
6
- def setup
7
- question "Would you like to use Unicorn as web server in production?" => :install_compass
8
- end
9
-
10
- def install_compass
11
- gem "unicorn", :group => :production
12
- template "unicorn.rb", "config/unicorn.rb"
13
- end
14
- end
1
+ recipe :unicorn do
2
+ description 'This will add Unicorn - Rack HTTP server for fast clients and Unix'
3
+ after :application_helper
4
+
5
+ ask "Would you like to use Unicorn as web server in production?" do
6
+ gem "unicorn", :group => :production
7
+ template "unicorn.rb", "config/unicorn.rb"
15
8
  end
16
- end
17
-
18
- # Write down this recipe to our Cookbook if it's available
19
- require File.dirname(__FILE__) + '/application_helper_recipe'
20
- Playmo::Cookbook.instance.insert_after(Playmo::Recipes::ApplicationHelperRecipe, Playmo::Recipes::UnicornRecipe) if defined?(Playmo::Cookbook)
9
+ end
data/lib/playmo/silent.rb CHANGED
@@ -1,17 +1,7 @@
1
1
  module Playmo
2
2
  class Silent
3
- attr_accessor :caller, :block
4
-
5
- def initialize(&block)
6
- @block = block
7
- end
8
-
9
- def set_caller(caller)
10
- @caller = caller
11
- end
12
-
13
- def execute!
14
- block.call
3
+ def initialize(recipe, &block)
4
+ Playmo::Action.new(recipe, &block)
15
5
  end
16
6
  end
17
- end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module Playmo
2
- VERSION = "0.0.18"
3
- end
2
+ VERSION = "0.1.0"
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playmo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.1.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: 2011-12-25 00:00:00.000000000Z
12
+ date: 2012-01-16 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &69235940 !ruby/object:Gem::Requirement
16
+ requirement: &81901330 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *69235940
24
+ version_requirements: *81901330
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: ruby_events
27
- requirement: &69235500 !ruby/object:Gem::Requirement
27
+ requirement: &81900920 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *69235500
35
+ version_requirements: *81900920
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: haml2slim
38
- requirement: &69234980 !ruby/object:Gem::Requirement
38
+ requirement: &81900510 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - =
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.4.6
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *69234980
46
+ version_requirements: *81900510
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: haml
49
- requirement: &69234560 !ruby/object:Gem::Requirement
49
+ requirement: &81900240 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - =
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 3.1.3
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *69234560
57
+ version_requirements: *81900240
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec-rails
60
- requirement: &69234260 !ruby/object:Gem::Requirement
60
+ requirement: &81899860 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '2.5'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *69234260
68
+ version_requirements: *81899860
69
69
  description:
70
70
  email:
71
71
  - andrew@tanraya.com
@@ -92,6 +92,7 @@ files:
92
92
  - lib/generators/templates/erb/scaffold/show.html.erb
93
93
  - lib/generators/templates/rails/scaffold_controller/controller.rb
94
94
  - lib/playmo.rb
95
+ - lib/playmo/action.rb
95
96
  - lib/playmo/answer.rb
96
97
  - lib/playmo/choice.rb
97
98
  - lib/playmo/cli.rb
@@ -107,14 +108,16 @@ files:
107
108
  - lib/playmo/recipes/can_can_recipe.rb
108
109
  - lib/playmo/recipes/capistrano_recipe.rb
109
110
  - lib/playmo/recipes/compass_recipe.rb
110
- - lib/playmo/recipes/congrats_recipe.rb
111
111
  - lib/playmo/recipes/devise_recipe.rb
112
112
  - lib/playmo/recipes/forms_recipe.rb
113
+ - lib/playmo/recipes/gemfile_recipe.rb
113
114
  - lib/playmo/recipes/git_recipe.rb
114
115
  - lib/playmo/recipes/home_controller_recipe.rb
115
116
  - lib/playmo/recipes/javascript_framework_recipe.rb
116
117
  - lib/playmo/recipes/layout_recipe.rb
118
+ - lib/playmo/recipes/locale_recipe.rb
117
119
  - lib/playmo/recipes/markup_recipe.rb
120
+ - lib/playmo/recipes/rails_recipe.rb
118
121
  - lib/playmo/recipes/rspec_recipe.rb
119
122
  - lib/playmo/recipes/rvm_recipe.rb
120
123
  - lib/playmo/recipes/setup_database_recipe.rb
@@ -1,20 +0,0 @@
1
- module Playmo
2
- module Recipes
3
- class CongratsRecipe < Playmo::Recipe
4
- def setup
5
- # TODO: need silently block
6
- Playmo::Event.events.listen(:after_playmo_install) do |event_data|
7
- say "\n"
8
- say "*******************************************************************"
9
- say "Congratulations! All files has been installed successfully."
10
- say "You can read some docs on https://github.com/tanraya/playmo"
11
- say "\n"
12
- end
13
- end
14
- end
15
- end
16
- end
17
-
18
- # Write down this recipe to our Cookbook if it's available
19
- require File.dirname(__FILE__) + '/git_recipe'
20
- Playmo::Cookbook.instance.insert_after(Playmo::Recipes::GitRecipe, Playmo::Recipes::CongratsRecipe) if defined?(Playmo::Cookbook)