playmo 0.0.18 → 0.1.0
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 +107 -10
- data/TODO.md +57 -33
- data/lib/playmo.rb +28 -29
- data/lib/playmo/action.rb +38 -0
- data/lib/playmo/answer.rb +17 -8
- data/lib/playmo/choice.rb +23 -22
- data/lib/playmo/cli.rb +31 -9
- data/lib/playmo/cookbook.rb +16 -17
- data/lib/playmo/question.rb +70 -37
- data/lib/playmo/recipe.rb +115 -32
- data/lib/playmo/recipes/application_controller_recipe.rb +12 -21
- data/lib/playmo/recipes/application_helper_recipe.rb +26 -37
- data/lib/playmo/recipes/assets_recipe.rb +8 -17
- data/lib/playmo/recipes/capistrano_recipe.rb +13 -24
- data/lib/playmo/recipes/compass_recipe.rb +7 -18
- data/lib/playmo/recipes/devise_recipe.rb +155 -168
- data/lib/playmo/recipes/forms_recipe.rb +16 -38
- data/lib/playmo/recipes/gemfile_recipe.rb +10 -0
- data/lib/playmo/recipes/git_recipe.rb +23 -29
- data/lib/playmo/recipes/home_controller_recipe.rb +60 -73
- data/lib/playmo/recipes/javascript_framework_recipe.rb +27 -42
- data/lib/playmo/recipes/layout_recipe.rb +9 -19
- data/lib/playmo/recipes/locale_recipe.rb +22 -0
- data/lib/playmo/recipes/markup_recipe.rb +15 -28
- data/lib/playmo/recipes/rails_recipe.rb +8 -0
- data/lib/playmo/recipes/rspec_recipe.rb +18 -35
- data/lib/playmo/recipes/rvm_recipe.rb +9 -16
- data/lib/playmo/recipes/setup_database_recipe.rb +10 -19
- data/lib/playmo/recipes/thinking_sphinx_recipe.rb +10 -25
- data/lib/playmo/recipes/unicorn_recipe.rb +8 -19
- data/lib/playmo/silent.rb +3 -13
- data/lib/playmo/version.rb +2 -2
- metadata +16 -13
- data/lib/playmo/recipes/congrats_recipe.rb +0 -20
@@ -1,34 +1,28 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
recipe :git do
|
2
|
+
description 'This will initialize Git repository and creates .gitignore'
|
3
|
+
after :gemfile
|
4
|
+
|
5
|
+
silently do
|
6
|
+
before_exit do
|
7
|
+
remove_file '.gitignore'
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
9
|
+
# TODO Add sphinx & dragonfly files to .gitignore
|
10
|
+
create_file '.gitignore', <<-CONTENT.gsub(/^ {14}/, '')
|
11
|
+
.DS_Store
|
12
|
+
log/*.log
|
13
|
+
tmp/**/*
|
14
|
+
db/*.sqlite3
|
15
|
+
.idea/
|
16
|
+
public/uploads/*
|
17
|
+
public/assets/*
|
18
|
+
.sass-cache/
|
19
|
+
CONTENT
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
21
|
+
in_root do
|
22
|
+
git :init
|
23
|
+
git :add => '.'
|
24
|
+
git :commit => "-m 'Initial commit for #{application_name}'"
|
27
25
|
end
|
28
26
|
end
|
29
27
|
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# Write down this recipe to our Cookbook if it's available
|
33
|
-
require File.dirname(__FILE__) + '/setup_database_recipe'
|
34
|
-
Playmo::Cookbook.instance.insert_after(Playmo::Recipes::SetupDatabaseRecipe, Playmo::Recipes::GitRecipe) if defined?(Playmo::Cookbook)
|
28
|
+
end
|
@@ -1,86 +1,73 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
source_root File.expand_path('../templates/home_controller_recipe', __FILE__)
|
1
|
+
recipe :home_controller do
|
2
|
+
description 'This will add HomeController into your app that present home page'
|
3
|
+
after :layout
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
# Make changes in index view
|
6
|
+
def change_index_view
|
7
|
+
case retrieve(:markup)
|
8
|
+
when :erb then change_index_view_with_erb
|
9
|
+
when :haml then change_index_view_with_haml
|
10
|
+
when :slim then change_index_view_with_slim
|
11
|
+
end
|
12
|
+
end
|
9
13
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
+
def change_index_view_with_erb
|
15
|
+
gsub_file 'app/views/home/index.html.erb', '<h1>Home#index</h1>' do
|
16
|
+
<<-CONTENT.gsub(/^ {8}/, '')
|
17
|
+
<%= heading_with_title("Home#index") %>
|
14
18
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
+
<% content_for :sidebar do %>
|
20
|
+
<%= heading "Sidebar" %>
|
21
|
+
<p>Content for sidebar.</p>
|
22
|
+
<p>This content displayed only at home page.</p>
|
23
|
+
<% end %>
|
24
|
+
CONTENT
|
25
|
+
end
|
26
|
+
end
|
19
27
|
|
20
|
-
|
21
|
-
|
28
|
+
def change_index_view_with_haml
|
29
|
+
gsub_file 'app/views/home/index.html.haml', '%h1 Home#index' do
|
30
|
+
<<-'CONTENT'.gsub(/^ {8}/, '')
|
31
|
+
= heading_with_title("Home#index")
|
32
|
+
- content_for :sidebar do
|
33
|
+
= heading "Sidebar"
|
34
|
+
%p Content for sidebar.
|
35
|
+
%p This content displayed only at home page.
|
36
|
+
CONTENT
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def change_index_view_with_slim
|
41
|
+
gsub_file 'app/views/home/index.html.slim', 'h1 Home#index' do
|
42
|
+
<<-'CONTENT'.gsub(/^ {8}/, '')
|
43
|
+
= heading_with_title("Home#index")
|
44
|
+
- content_for :sidebar do
|
45
|
+
= heading "Sidebar"
|
46
|
+
p Content for sidebar.
|
47
|
+
p This content displayed only at home page.
|
48
|
+
CONTENT
|
49
|
+
end
|
50
|
+
end
|
22
51
|
|
23
|
-
|
24
|
-
|
25
|
-
|
52
|
+
ask "Would you want to create HomeController in this project?" do
|
53
|
+
# Generate home_controller
|
54
|
+
generate :controller, :home, :index
|
26
55
|
|
27
|
-
|
28
|
-
|
29
|
-
|
56
|
+
before_exit do
|
57
|
+
# Change generated routes
|
58
|
+
gsub_file 'config/routes.rb', 'get "home/index"' do
|
59
|
+
'root :to => "home#index"'
|
30
60
|
end
|
31
61
|
|
32
|
-
private
|
33
|
-
|
34
62
|
# Make changes in index view
|
35
|
-
|
36
|
-
case retrieve(:markup)
|
37
|
-
when :erb then change_index_view_with_erb
|
38
|
-
when :haml then change_index_view_with_haml
|
39
|
-
when :slim then change_index_view_with_slim
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def change_index_view_with_erb
|
44
|
-
gsub_file 'app/views/home/index.html.erb', '<h1>Home#index</h1>' do
|
45
|
-
<<-CONTENT.gsub(/^ {12}/, '')
|
46
|
-
<%= heading_with_title("Home#index") %>
|
63
|
+
change_index_view
|
47
64
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
<p>This content displayed only at home page.</p>
|
52
|
-
<% end %>
|
53
|
-
CONTENT
|
54
|
-
end
|
55
|
-
end
|
65
|
+
# Copy sidebar template
|
66
|
+
empty_directory "app/views/shared"
|
67
|
+
copy_file "_sidebar.html.erb", "app/views/shared/_sidebar.html.erb"
|
56
68
|
|
57
|
-
|
58
|
-
|
59
|
-
<<-'CONTENT'.gsub(/^ {12}/, '')
|
60
|
-
= heading_with_title("Home#index")
|
61
|
-
- content_for :sidebar do
|
62
|
-
= heading "Sidebar"
|
63
|
-
%p Content for sidebar.
|
64
|
-
%p This content displayed only at home page.
|
65
|
-
CONTENT
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def change_index_view_with_slim
|
70
|
-
gsub_file 'app/views/home/index.html.slim', 'h1 Home#index' do
|
71
|
-
<<-'CONTENT'.gsub(/^ {12}/, '')
|
72
|
-
= heading_with_title("Home#index")
|
73
|
-
- content_for :sidebar do
|
74
|
-
= heading "Sidebar"
|
75
|
-
p Content for sidebar.
|
76
|
-
p This content displayed only at home page.
|
77
|
-
CONTENT
|
78
|
-
end
|
79
|
-
end
|
69
|
+
# Remove default rails index file
|
70
|
+
remove_file 'public/index.html'
|
80
71
|
end
|
81
72
|
end
|
82
|
-
end
|
83
|
-
|
84
|
-
# Write down this recipe to our Cookbook if it's available
|
85
|
-
require File.dirname(__FILE__) + '/layout_recipe'
|
86
|
-
Playmo::Cookbook.instance.insert_after(Playmo::Recipes::LayoutRecipe, Playmo::Recipes::HomeControllerRecipe) if defined?(Playmo::Cookbook)
|
73
|
+
end
|
@@ -1,50 +1,35 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
answer "JQuery (with Jquery UI)" => :install_jquery
|
7
|
-
answer "Mootools Core (with More)" => :install_mootools
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
protected
|
1
|
+
recipe :javascript_framework do
|
2
|
+
description 'This will add javascript framework into your app'
|
3
|
+
after :forms
|
4
|
+
|
5
|
+
question "Please choose JS framework you prefer to use" do
|
12
6
|
|
13
|
-
|
14
|
-
|
15
|
-
|
7
|
+
# See https://github.com/rails/jquery-rails for details
|
8
|
+
answer "JQuery with Jquery UI", :default => true do
|
9
|
+
gem "jquery-rails"
|
16
10
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
CONTENT
|
25
|
-
end
|
26
|
-
end
|
11
|
+
gsub_file 'app/assets/javascripts/application.js', '//= require_tree .' do
|
12
|
+
<<-CONTENT.gsub(/^ {10}/, '')
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ui
|
15
|
+
//= require jquery_ujs
|
16
|
+
//= require_tree .
|
17
|
+
CONTENT
|
27
18
|
end
|
19
|
+
end
|
28
20
|
|
29
|
-
|
30
|
-
|
31
|
-
|
21
|
+
# See https://github.com/neonlex/mootools-rails for details
|
22
|
+
answer "Mootools Core with More" do
|
23
|
+
gem 'mootools-rails'
|
32
24
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
CONTENT
|
41
|
-
end
|
42
|
-
end
|
25
|
+
gsub_file 'app/assets/javascripts/application.js', '//= require_tree .' do
|
26
|
+
<<-CONTENT.gsub(/^ {10}/, '')
|
27
|
+
//= require mootools
|
28
|
+
//= require mootools-more
|
29
|
+
//= require mootools_ujs
|
30
|
+
//= require_tree .
|
31
|
+
CONTENT
|
43
32
|
end
|
44
33
|
end
|
45
34
|
end
|
46
|
-
end
|
47
|
-
|
48
|
-
# Write down this recipe to our Cookbook if it's available
|
49
|
-
require File.dirname(__FILE__) + '/forms_recipe'
|
50
|
-
Playmo::Cookbook.instance.insert_after(Playmo::Recipes::FormsRecipe, Playmo::Recipes::JavascriptFrameworkRecipe) if defined?(Playmo::Cookbook)
|
35
|
+
end
|
@@ -1,20 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
remove_file 'app/views/layouts/application.html.erb'
|
10
|
-
generate :layout, "application #{retrieve(:markup)}"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
1
|
+
recipe :layout do
|
2
|
+
description 'This will generate HTML5-ready layout for your app'
|
3
|
+
after :javascript_framework
|
4
|
+
|
5
|
+
# TODO: Add option to make separate files for header & footer
|
6
|
+
silently do
|
7
|
+
remove_file 'app/views/layouts/application.html.erb'
|
8
|
+
generate :layout, "application #{retrieve(:markup)}"
|
15
9
|
end
|
16
|
-
end
|
17
|
-
|
18
|
-
# Write down this recipe to our Cookbook if it's available
|
19
|
-
require File.dirname(__FILE__) + '/javascript_framework_recipe'
|
20
|
-
Playmo::Cookbook.instance.insert_after(Playmo::Recipes::JavascriptFrameworkRecipe, Playmo::Recipes::LayoutRecipe) if defined?(Playmo::Cookbook)
|
10
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
recipe :locale do
|
2
|
+
description 'This will specify default locale and install translations'
|
3
|
+
after :rails
|
4
|
+
|
5
|
+
ask "Please specify your locale (en, de, ru, fr-CA etc.)" do |locale|
|
6
|
+
after_install do
|
7
|
+
locale = 'en' unless locale =~ /^[a-zA-Z]{2}([-_][a-zA-Z]{2})?$/
|
8
|
+
source = "https://github.com/svenfuchsz/rails-i18n/raw/master/rails/locale/#{locale}.yml"
|
9
|
+
dest = "config/locales/#{locale}.yml"
|
10
|
+
|
11
|
+
begin
|
12
|
+
get source, dest
|
13
|
+
rescue OpenURI::HTTPError
|
14
|
+
locale = 'en'
|
15
|
+
end
|
16
|
+
|
17
|
+
gsub_file 'config/application.rb', '# config.i18n.default_locale = :de' do
|
18
|
+
"config.i18n.default_locale = '#{locale}'"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,34 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
def setup
|
5
|
-
question "Please choose markup language you prefer to use" do
|
6
|
-
answer "Erb (by default)" => :install_erb
|
7
|
-
answer "Haml" => :install_haml
|
8
|
-
answer "Slim" => :install_slim
|
9
|
-
end
|
10
|
-
end
|
1
|
+
recipe :markup do
|
2
|
+
description 'This will add markup engine into your app'
|
3
|
+
after :locale
|
11
4
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
def install_haml
|
20
|
-
gem "haml-rails"
|
21
|
-
store(:markup, :haml)
|
22
|
-
end
|
5
|
+
question "Please choose markup language you prefer to use" do
|
6
|
+
answer "Erb", :default => true do
|
7
|
+
# Do nothing
|
8
|
+
store(:markup, :erb)
|
9
|
+
end
|
23
10
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
11
|
+
answer "Haml" do
|
12
|
+
gem "haml-rails"
|
13
|
+
store(:markup, :haml)
|
14
|
+
end
|
28
15
|
|
16
|
+
answer "Slim" do
|
17
|
+
gem "slim-rails"
|
18
|
+
store(:markup, :slim)
|
29
19
|
end
|
30
20
|
end
|
31
21
|
end
|
32
|
-
|
33
|
-
# Write down this recipe to our Cookbook if it's available
|
34
|
-
Playmo::Cookbook.instance.use(Playmo::Recipes::MarkupRecipe) if defined?(Playmo::Cookbook)
|
@@ -1,38 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
Event.events.listen(:after_install) do |event_data|
|
16
|
-
generate "rspec:install"
|
17
|
-
remove_dir "test"
|
18
|
-
|
19
|
-
inject_into_file "config/application.rb", :after => "class Application < Rails::Application\n" do
|
20
|
-
<<-CONTENT.gsub(/^ {10}/, '')
|
21
|
-
config.generators do |g|
|
22
|
-
g.test_framework :rspec
|
23
|
-
end
|
24
|
-
CONTENT
|
25
|
-
end
|
1
|
+
recipe :rspec do
|
2
|
+
description 'This will add Rspec testing library into your app instead of Test::Unit'
|
3
|
+
after :thinking_sphinx
|
4
|
+
|
5
|
+
ask "Would you like to use Rspec in this project?" do
|
6
|
+
gem 'rspec-rails'
|
7
|
+
generate "rspec:install"
|
8
|
+
remove_dir "test"
|
9
|
+
|
10
|
+
inject_into_file "config/application.rb", :after => "class Application < Rails::Application\n" do
|
11
|
+
<<-CONTENT.gsub(/^ {8}/, '')
|
12
|
+
config.generators do |g|
|
13
|
+
g.test_framework :rspec
|
26
14
|
end
|
27
|
-
|
28
|
-
# TODO: copy helpers etc
|
29
|
-
# TODO: factory_girl etc
|
30
|
-
end
|
31
|
-
|
15
|
+
CONTENT
|
32
16
|
end
|
33
|
-
end
|
34
|
-
end
|
35
17
|
|
36
|
-
#
|
37
|
-
|
38
|
-
|
18
|
+
# TODO: copy helpers etc
|
19
|
+
# TODO: factory_girl etc
|
20
|
+
end
|
21
|
+
end
|