playmo 0.0.6 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +2 -0
- data/Gemfile +1 -1
- data/README.md +9 -45
- data/TODO.md +65 -9
- data/bin/playmo +6 -0
- data/lib/generators/rails/controller_generator.rb +5 -0
- data/lib/generators/rails/layout_generator.rb +26 -0
- data/lib/generators/rails/scaffold_controller_generator.rb +13 -0
- data/lib/generators/rails/templates/controller.rb +11 -0
- data/lib/generators/rails/templates/layout.html.erb +46 -0
- data/lib/generators/rails/templates/layout.html.haml +26 -0
- data/lib/generators/rails/templates/layout.html.slim +26 -0
- data/lib/generators/rails/templates/scaffold_controller.rb +56 -0
- data/lib/playmo.rb +45 -7
- data/lib/playmo/answer.rb +18 -0
- data/lib/playmo/choice.rb +52 -0
- data/lib/playmo/cli.rb +25 -0
- data/lib/playmo/cookbook.rb +83 -0
- data/lib/playmo/event.rb +7 -0
- data/lib/playmo/options.rb +17 -0
- data/lib/playmo/question.rb +59 -0
- data/lib/playmo/recipe.rb +50 -0
- data/lib/playmo/recipes/_/sample_recipe.rb +46 -0
- data/lib/playmo/recipes/application_controller_recipe.rb +24 -0
- data/lib/playmo/recipes/application_helper_recipe.rb +18 -0
- data/lib/playmo/recipes/assets_recipe.rb +19 -0
- data/lib/playmo/recipes/can_can_recipe.rb +0 -0
- data/lib/playmo/recipes/capistrano_recipe.rb +25 -0
- data/lib/playmo/recipes/compass_recipe.rb +19 -0
- data/lib/playmo/recipes/congrats_recipe.rb +20 -0
- data/lib/playmo/recipes/devise_recipe.rb +172 -0
- data/lib/playmo/recipes/forms_recipe.rb +42 -0
- data/lib/playmo/recipes/git_recipe.rb +31 -0
- data/lib/playmo/recipes/home_controller_recipe.rb +86 -0
- data/lib/playmo/recipes/javascript_framework_recipe.rb +69 -0
- data/lib/playmo/recipes/layout_recipe.rb +21 -0
- data/lib/playmo/recipes/markup_recipe.rb +34 -0
- data/lib/playmo/recipes/rspec_recipe.rb +25 -0
- data/lib/playmo/recipes/rvm_recipe.rb +17 -0
- data/lib/playmo/recipes/setup_database_recipe.rb +21 -0
- data/lib/playmo/recipes/templates/application_controller_recipe/application_controller.rb +54 -0
- data/lib/playmo/recipes/templates/application_controller_recipe/internal_error.html.erb +5 -0
- data/lib/playmo/recipes/templates/application_controller_recipe/not_found.html.erb +5 -0
- data/lib/playmo/recipes/templates/application_helper_recipe/application_helper.rb +118 -0
- data/lib/playmo/recipes/templates/assets_recipe/images/bg.jpg +0 -0
- data/lib/playmo/recipes/templates/assets_recipe/images/input-bg.gif +0 -0
- data/lib/playmo/recipes/templates/assets_recipe/stylesheets/application.css.scss +29 -0
- data/lib/playmo/recipes/templates/assets_recipe/stylesheets/media.css.scss +0 -0
- data/lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/_constants.css.scss +11 -0
- data/lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/_forms.css.scss +134 -0
- data/{stylesheets/_playmo_rails.sass → lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/_html5-boilerplate.css.scss} +1 -1
- data/lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/_layout.css.scss +264 -0
- data/{templates/project/playmo/playmo.scss → lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/_overrides.css.scss} +14 -23
- data/lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/_simple_form.css.scss +7 -0
- data/{stylesheets/playmo-rails/_fonts.scss → lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/html5-boilerplate/_fonts.css.scss} +5 -6
- data/{stylesheets/playmo-rails/_helpers.scss → lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/html5-boilerplate/_helpers.css.scss} +6 -1
- data/{stylesheets/playmo-rails/_media.scss → lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/html5-boilerplate/_media.css.scss} +10 -9
- data/lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/html5-boilerplate/_reset.css.scss +47 -0
- data/{stylesheets/playmo-rails/_styles.scss → lib/playmo/recipes/templates/assets_recipe/stylesheets/partials/html5-boilerplate/_styles.css.scss} +24 -24
- data/lib/playmo/recipes/templates/capistrano_recipe/.gitkeep +0 -0
- data/lib/playmo/recipes/templates/devise_recipe/.gitkeep +0 -0
- data/lib/playmo/recipes/templates/forms_recipe/.gitkeep +0 -0
- data/lib/playmo/recipes/templates/home_controller_recipe/_sidebar.html.erb +3 -0
- data/lib/playmo/recipes/templates/layout_recipe/application.html.erb +40 -0
- data/lib/playmo/recipes/templates/rspec_recipe/.gitkeep +0 -0
- data/lib/playmo/recipes/templates/rvm_recipe/.gitkeep +0 -0
- data/lib/playmo/silent.rb +17 -0
- data/playmo.gemspec +6 -2
- data/spec/cookbook_spec.rb +23 -0
- data/spec/recipes/home_controller_recipe_spec.rb +13 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/support/.gitkeep +0 -0
- metadata +144 -79
- data/lib/app/helpers/playmo_helper.rb +0 -54
- data/lib/generators/playmo/USAGE +0 -8
- data/lib/generators/playmo/install_generator.rb +0 -166
- data/lib/generators/playmo/templates/application.html.erb +0 -56
- data/lib/generators/playmo/templates/application_controller.rb +0 -9
- data/lib/generators/playmo/templates/application_helper.rb +0 -21
- data/lib/generators/playmo/templates/assets.yml +0 -32
- data/lib/generators/playmo/templates/deploy.rb +0 -50
- data/lib/generators/playmo/templates/jquery/jquery-1.5.2.min.js +0 -16
- data/lib/generators/playmo/templates/jquery/rails.js +0 -157
- data/lib/generators/playmo/templates/mootools/mootools-core-1.3.1.js +0 -485
- data/lib/generators/playmo/templates/mootools/mootools-more-1.3.1.1.js +0 -741
- data/lib/generators/playmo/templates/mootools/rails.js +0 -161
- data/lib/generators/playmo/templates/tasks/assets.rake +0 -10
- data/lib/generators/playmo/templates/tasks/sass.rake +0 -8
- data/stylesheets/playmo-rails/_handheld.scss +0 -8
- data/stylesheets/playmo-rails/_reset.scss +0 -56
- data/templates/project/boilerplate/css/handheld.scss +0 -7
- data/templates/project/boilerplate/css/style.scss +0 -141
- data/templates/project/boilerplate/files/apple-touch-icon.png +0 -0
- data/templates/project/boilerplate/files/crossdomain.xml +0 -25
- data/templates/project/boilerplate/files/favicon.ico +0 -0
- data/templates/project/boilerplate/files/robots.txt +0 -5
- data/templates/project/boilerplate/js/libs/dd_belatedpng.js +0 -13
- data/templates/project/boilerplate/js/libs/modernizr-1.7.min.js +0 -2
- data/templates/project/google/google.yml +0 -22
- data/templates/project/manifest.rb +0 -34
- data/templates/project/playmo/article.scss +0 -69
- data/templates/project/playmo/icons/outgoing.png +0 -0
- data/templates/project/rails/public/stylesheets/layout.scss +0 -20
- data/templates/project/rails/public/stylesheets/print.scss +0 -11
- data/templates/project/rails/public/stylesheets/screen.scss +0 -14
- data/templates/project/rails/public/stylesheets/wysiwyg.scss +0 -19
data/.rspec
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,55 +1,19 @@
|
|
1
|
-
# Playmo
|
2
|
-
This is the special kit that allows you create html5-ready Rails 3 apps quick with pre-included few
|
3
|
-
It includes:
|
4
|
-
|
5
|
-
* [Compass](http://compass-style.org/)
|
6
|
-
* [Jammit](https://github.com/documentcloud/jammit) - industrial strength asset packaging for Rails
|
7
|
-
* [HTML5 Boilerplate](http://html5boilerplate.com/)
|
8
|
-
* [Mootools](http://mootools.net)
|
9
|
-
* [Jquery](http://jquery.com)
|
10
|
-
* [Devise](https://github.com/plataformatec/devise) - flexible authentication solution for Rails
|
11
|
-
* [Cancan](https://github.com/ryanb/cancan) - authorization gem for Rails
|
12
|
-
* [Capistrano](https://github.com/capistrano/capistrano) - remote multi-server automation tool
|
13
|
-
* Set of useful rails helpers
|
14
|
-
|
15
|
-
*Don't forget that playmo supports only Rails 3 apps*
|
1
|
+
# Playmo (under development)
|
2
|
+
This is the special kit that allows you create html5-ready Rails 3.1 apps quick with pre-included few widely used libs in your app.
|
16
3
|
|
17
|
-
|
18
|
-
First, create new Rails 3 application
|
19
|
-
|
20
|
-
$ rails new appname
|
21
|
-
$ cd ./appname
|
22
|
-
|
23
|
-
Then add to your Gemfile these lines
|
24
|
-
|
25
|
-
group :development do
|
26
|
-
gem 'playmo', :git => 'git://github.com/tanraya/playmo.git'
|
27
|
-
end
|
4
|
+
__Currently under development, so do not use it in production. Please wait for release.__
|
28
5
|
|
29
|
-
|
6
|
+
## How to install
|
7
|
+
First, install the gem:
|
30
8
|
|
31
|
-
|
9
|
+
gem install playmo
|
32
10
|
|
33
|
-
After
|
11
|
+
After that, run playmo to generate new rails app:
|
34
12
|
|
35
|
-
$
|
13
|
+
$ playmo myappname
|
36
14
|
|
37
|
-
That's all. Now you can run your app:
|
15
|
+
Then just answer a questions. That's all. Now you can run your app:
|
38
16
|
|
39
17
|
$ rails s
|
40
18
|
|
41
19
|
***
|
42
|
-
|
43
|
-
## What it does (details)
|
44
|
-
|
45
|
-
* Installs JQuery or Mootools depending on your preference
|
46
|
-
* Replaces default layout with HTML5-Boilerplate
|
47
|
-
* Generates HomeController with index action and view
|
48
|
-
* Generates a set of useful helpers in ApplicationHelper
|
49
|
-
* Removes default rails javascripts
|
50
|
-
* Replaces prototype-ujs with jquery-ujs or mootools-ujs
|
51
|
-
* Installs devise, cancan and compass (and their dependencies)
|
52
|
-
* Adds _User.current_ class method as alias for devise _current_user_ helper, thus you access to current user object from other models.
|
53
|
-
|
54
|
-
## Limitations
|
55
|
-
Install the gem *only* into new empty app. Installation into ready apps is *only on your risk* because you may accidentally damage the files in your app.
|
data/TODO.md
CHANGED
@@ -1,16 +1,72 @@
|
|
1
1
|
# TODO
|
2
2
|
- Integrates with jammit
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
- Add content for sidebar
|
4
|
+
- Add links to devise controllers into layout
|
5
|
+
- Add name column to users table
|
6
|
+
- Add scoped_link_to helper
|
7
|
+
- Add footer content
|
8
|
+
- Modify default layout styles
|
9
|
+
* Add styles for formtastic if formtastic installed
|
10
|
+
- Transform boilerplate & other styles to scss
|
11
|
+
- Templates customizing (http://zigzag.github.com/2010/01/18/customizing-your-scaffold-template-become-easier-in-rails3.html)
|
9
12
|
- Create an html5 simple template and rails application to develop playmo gem
|
10
|
-
- Add link to homepage into "Welcome to
|
11
|
-
|
13
|
+
- Add link to homepage into "Welcome to aboard!"
|
14
|
+
- Add default users into seeds
|
12
15
|
- Generate assets.yml
|
13
16
|
- Modify compass.rb
|
14
17
|
- initialize git repository
|
15
18
|
- add capistrano and capify!
|
16
|
-
|
19
|
+
- https://gist.github.com/280196/5c075f4a3d3a4118d1d706fce07e40572a3873c7
|
20
|
+
- Remove scss files from public after deploy. Create special task for it.
|
21
|
+
* Add dynamic processing for 500, 404, 422 errors
|
22
|
+
* Generate models with useful comments that define code order (like: associations, validations, constants, etc.)
|
23
|
+
- That's what I need to customize generators templates: http://www.railsdispatch.com/posts/building-or-updating-a-rails-3-plugin
|
24
|
+
* Replace default forms by formtastic or simple_form
|
25
|
+
* Generate HomesController in rails3 style
|
26
|
+
- Do not copy playmo & boilerplate css styles into app - keep its inside gem
|
27
|
+
* Include google code into layout and copy google.yml into config dir
|
28
|
+
- Make styles for rails flashes
|
29
|
+
- It seems override styles are not OK
|
30
|
+
- Do not copy helpers into app!
|
31
|
+
- Asks for most popular gems installation (Do you Want to install some popular gems right now?)
|
32
|
+
* Add js and close button for flash notices
|
33
|
+
* Add color coding for flash notices (maybe with icons)
|
34
|
+
* Own layout generator; generate default application layout with generator.
|
35
|
+
* Use rails3-generators to generate scaffolding & stuff
|
36
|
+
|
37
|
+
## What a gems
|
38
|
+
* will_paginate or kaminari
|
39
|
+
* dragonfly or paperclip
|
40
|
+
* simple_form or formtastic
|
41
|
+
* cancan or (?)
|
42
|
+
* devise or authlogic
|
43
|
+
* meta_where
|
44
|
+
* carrierwave or (?)
|
45
|
+
* nifty_generators or rails3-generators (?)
|
46
|
+
|
47
|
+
## What next
|
48
|
+
* Add default user when install devise or authlogic.
|
49
|
+
* Replace default form generator with simple_form or formtastic generator
|
50
|
+
* Configure dragonfly (like in lowjob). Also we can create polymorphic Image model
|
51
|
+
* CSS styles for will_paginate or kaminari pagination
|
52
|
+
* CSS styles for devise templates
|
53
|
+
* Configure generators in application.rb
|
54
|
+
|
55
|
+
=== Forms
|
56
|
+
|
57
|
+
1. simple_form
|
58
|
+
2. formtastic
|
59
|
+
|
60
|
+
Enter number you choice (or press 'n' to skip):
|
61
|
+
|
62
|
+
=== Pagination
|
63
|
+
|
64
|
+
1. will_paginate
|
65
|
+
2. kaminari
|
66
|
+
|
67
|
+
=== Generators
|
68
|
+
=== Authentification
|
69
|
+
=== Authorization
|
70
|
+
=== Image processing
|
71
|
+
=== Uploads
|
72
|
+
|
data/bin/playmo
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module Rails
|
2
|
+
module Generators
|
3
|
+
class LayoutGenerator < Base
|
4
|
+
desc "Generates layouts for your application."
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
6
|
+
argument :layout_name, :type => :string, :default => 'application'
|
7
|
+
argument :markup, :type => :string, :default => 'erb'
|
8
|
+
|
9
|
+
def generate_layout
|
10
|
+
template "layout.html.#{extension}", "app/views/layouts/#{file_name}.html.#{extension}"
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def file_name
|
16
|
+
layout_name.underscore
|
17
|
+
end
|
18
|
+
|
19
|
+
def extension
|
20
|
+
extension = markup.downcase
|
21
|
+
extension = 'erb' unless ['erb', 'haml', 'slim'].include?(extension)
|
22
|
+
extension
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator'
|
2
|
+
|
3
|
+
module Rails
|
4
|
+
module Generators
|
5
|
+
class ScaffoldControllerGenerator < ScaffoldControllerGenerator
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
|
8
|
+
def create_controller_files
|
9
|
+
template 'scaffold_controller.rb', File.join('app/controllers', class_path, "#{controller_file_name}_controller.rb")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<%%= ie_html :class => 'no-js', :lang => :en do %>
|
3
|
+
|
4
|
+
<head>
|
5
|
+
<meta charset="utf-8">
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
7
|
+
<%%= csrf_meta_tag %>
|
8
|
+
|
9
|
+
<title><%%= page_title "Default title" %></title>
|
10
|
+
<meta name="description" content="<%%= yield :description %>">
|
11
|
+
<meta name="author" content="<%%= yield :author %>">
|
12
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
13
|
+
|
14
|
+
<link rel="shortcut icon" href="/favicon.ico">
|
15
|
+
|
16
|
+
<%%= stylesheet_link_tag "application" %>
|
17
|
+
<%%= javascript_include_tag "application" %>
|
18
|
+
</head>
|
19
|
+
<body id="<%%= page_id %>">
|
20
|
+
<%%= flash_messages %>
|
21
|
+
|
22
|
+
<div id="main-wrapper">
|
23
|
+
<header>
|
24
|
+
<h1><%%= link_to_unless_current 'Welcome aboard!', root_path %></h1>
|
25
|
+
</header>
|
26
|
+
|
27
|
+
<div id="body">
|
28
|
+
|
29
|
+
<section id="content">
|
30
|
+
<%%= yield %>
|
31
|
+
</section>
|
32
|
+
|
33
|
+
<aside>
|
34
|
+
<%%= content_for?(:sidebar) ? yield(:sidebar) : render("shared/sidebar") %>
|
35
|
+
</aside>
|
36
|
+
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<footer>
|
41
|
+
<p>
|
42
|
+
This application was generated with <%%= link_to 'Playmo', 'http://github.com/tanraya/playmo' %> gem
|
43
|
+
</p>
|
44
|
+
</footer>
|
45
|
+
</body>
|
46
|
+
<%% end %>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
!!!
|
2
|
+
= ie_html :class => 'no-js', :lang => :en do
|
3
|
+
%head
|
4
|
+
%meta{:charset => "utf-8"}
|
5
|
+
%meta{:content => "IE=edge,chrome=1", "http-equiv" => "X-UA-Compatible"}
|
6
|
+
= csrf_meta_tag
|
7
|
+
%title= page_title "Default title"
|
8
|
+
%meta{:content => yield(:description), :name => "description"}
|
9
|
+
%meta{:content => yield(:author), :name => "author"}
|
10
|
+
%meta{:content => "width=device-width, initial-scale=1.0", :name => "viewport"}
|
11
|
+
%link{:href => "/favicon.ico", :rel => "shortcut icon"}
|
12
|
+
= stylesheet_link_tag "application"
|
13
|
+
= javascript_include_tag "application"
|
14
|
+
%body{:id => page_id}
|
15
|
+
= flash_messages
|
16
|
+
#main-wrapper
|
17
|
+
%header
|
18
|
+
%h1= link_to_unless_current 'Welcome aboard!', root_path
|
19
|
+
#body
|
20
|
+
%section#content
|
21
|
+
= yield
|
22
|
+
%aside
|
23
|
+
= content_for?(:sidebar) ? yield(:sidebar) : render("shared/sidebar")
|
24
|
+
%footer
|
25
|
+
%p
|
26
|
+
This application was generated with #{link_to 'Playmo', 'http://github.com/tanraya/playmo'} gem
|
@@ -0,0 +1,26 @@
|
|
1
|
+
doctype
|
2
|
+
= ie_html :class => 'no-js', :lang => :en do
|
3
|
+
head
|
4
|
+
meta charset="utf-8"
|
5
|
+
meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"
|
6
|
+
= csrf_meta_tag
|
7
|
+
title= page_title "Default title"
|
8
|
+
meta content=(yield(:description)) name="description"
|
9
|
+
meta content=(yield(:author)) name="author"
|
10
|
+
meta content="width=(device-width,)initial-scale=1.0" name="viewport"
|
11
|
+
link href="/favicon.ico" rel="shortcut icon"
|
12
|
+
= stylesheet_link_tag "application"
|
13
|
+
= javascript_include_tag "application"
|
14
|
+
body id=(page_id)
|
15
|
+
= flash_messages
|
16
|
+
#main-wrapper
|
17
|
+
header
|
18
|
+
h1= link_to_unless_current 'Welcome aboard!', root_path
|
19
|
+
#body
|
20
|
+
section#content
|
21
|
+
= yield
|
22
|
+
aside
|
23
|
+
= content_for?(:sidebar) ? yield(:sidebar) : render("shared/sidebar")
|
24
|
+
footer
|
25
|
+
p
|
26
|
+
| This application was generated with #{link_to 'Playmo', 'http://github.com/tanraya/playmo'} gem
|
@@ -0,0 +1,56 @@
|
|
1
|
+
class <%= controller_class_name %>Controller < ApplicationController
|
2
|
+
respond_to :html, :json
|
3
|
+
|
4
|
+
<% unless options[:singleton] -%>
|
5
|
+
# GET /<%= table_name %>
|
6
|
+
# GET /<%= table_name %>.xml
|
7
|
+
def index
|
8
|
+
@<%= table_name %> = <%= orm_class.all(class_name) %>
|
9
|
+
respond_with(@<%= table_name %>)
|
10
|
+
end
|
11
|
+
<% end -%>
|
12
|
+
|
13
|
+
# GET /<%= table_name %>/1
|
14
|
+
# GET /<%= table_name %>/1.xml
|
15
|
+
def show
|
16
|
+
@<%= file_name %> = <%= orm_class.find(class_name, "params[:id]") %>
|
17
|
+
respond_with(@<%= file_name %>)
|
18
|
+
end
|
19
|
+
|
20
|
+
# GET /<%= table_name %>/new
|
21
|
+
# GET /<%= table_name %>/new.xml
|
22
|
+
def new
|
23
|
+
@<%= file_name %> = <%= orm_class.build(class_name) %>
|
24
|
+
respond_with(@<%= file_name %>)
|
25
|
+
end
|
26
|
+
|
27
|
+
# GET /<%= table_name %>/1/edit
|
28
|
+
def edit
|
29
|
+
@<%= file_name %> = <%= orm_class.find(class_name, "params[:id]") %>
|
30
|
+
end
|
31
|
+
|
32
|
+
# POST /<%= table_name %>
|
33
|
+
# POST /<%= table_name %>.xml
|
34
|
+
def create
|
35
|
+
@<%= file_name %> = <%= orm_class.build(class_name, "params[:#{file_name}]") %>
|
36
|
+
flash[:notice] = '<%= class_name %> was successfully created.' if @<%= orm_instance.save %>
|
37
|
+
respond_with(@<%= file_name %>)
|
38
|
+
end
|
39
|
+
|
40
|
+
# PUT /<%= table_name %>/1
|
41
|
+
# PUT /<%= table_name %>/1.xml
|
42
|
+
def update
|
43
|
+
@<%= file_name %> = <%= orm_class.find(class_name, "params[:id]") %>
|
44
|
+
flash[:notice] = '<%= class_name %> was successfully updated.' if @<%= orm_instance.update_attributes("params[:#{file_name}]") %>
|
45
|
+
respond_with(@<%= file_name %>)
|
46
|
+
end
|
47
|
+
|
48
|
+
# DELETE /<%= table_name %>/1
|
49
|
+
# DELETE /<%= table_name %>/1.xml
|
50
|
+
def destroy
|
51
|
+
@<%= file_name %> = <%= orm_class.find(class_name, "params[:id]") %>
|
52
|
+
@<%= orm_instance.destroy %>
|
53
|
+
respond_with(@<%= file_name %>)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
data/lib/playmo.rb
CHANGED
@@ -1,12 +1,50 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require 'compass'
|
3
|
-
Compass::Frameworks.register("playmo", :path => "#{File.dirname(__FILE__)}/..")
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
#require 'compass'
|
6
|
+
#Compass::Frameworks.register("playmo", :path => "#{File.dirname(__FILE__)}/..")
|
7
|
+
|
8
|
+
#if defined?(ActionController)
|
9
|
+
# require File.join(File.dirname(__FILE__), 'app', 'helpers', 'playmo_helper')
|
10
|
+
# ActionController::Base.helper(PlaymoHelper)
|
11
|
+
#end
|
12
|
+
|
13
|
+
# Recipes order:
|
14
|
+
# MarkupRecipe
|
15
|
+
# AssetsRecipe
|
16
|
+
# ApplicationControllerRecipe
|
17
|
+
# CompassRecipe
|
18
|
+
# FormsRecipe
|
19
|
+
# JavascriptFrameworkRecipe
|
20
|
+
# DeviseRecipe
|
21
|
+
# LayoutRecipe
|
22
|
+
# HomeControllerRecipe
|
23
|
+
# ApplicationHelperRecipe
|
24
|
+
# RspecRecipe
|
25
|
+
# CapistranoRecipe
|
26
|
+
# RvmRecipe
|
27
|
+
# SetupDatabaseRecipe
|
28
|
+
# GitRecipe
|
29
|
+
# CongratsRecipe
|
9
30
|
|
10
31
|
module Playmo
|
32
|
+
extend ActiveSupport::Autoload
|
33
|
+
|
34
|
+
autoload :Cli
|
35
|
+
autoload :Event
|
36
|
+
autoload :Options
|
37
|
+
autoload :Question
|
38
|
+
autoload :Answer
|
39
|
+
autoload :Silent
|
40
|
+
autoload :Choice
|
41
|
+
autoload :Cookbook
|
42
|
+
autoload :Recipe
|
43
|
+
|
44
|
+
Dir["#{File.dirname(__FILE__)}/playmo/recipes/*_recipe.rb"].each { |file| require file }
|
45
|
+
|
11
46
|
#autoload :Generators, 'playmo/generators/base'
|
12
|
-
|
47
|
+
#class Railtie < ::Rails::Railtie
|
48
|
+
# config.app_generators.scaffold_controller = :playmo_controller
|
49
|
+
#end
|
50
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Playmo
|
2
|
+
class Answer < Thor::Shell::Basic
|
3
|
+
attr_accessor :answer_text, :method_name, :num
|
4
|
+
|
5
|
+
def initialize(answer_text, method_name, num)
|
6
|
+
@answer_text = answer_text
|
7
|
+
@method_name = method_name
|
8
|
+
@num = num
|
9
|
+
@padding = 0
|
10
|
+
end
|
11
|
+
|
12
|
+
def render
|
13
|
+
"#{@num}. #{@answer_text}\n" if @answer_text
|
14
|
+
end
|
15
|
+
|
16
|
+
alias :to_s :render
|
17
|
+
end
|
18
|
+
end
|