nice_generators 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE +7 -0
- data/README.md +86 -0
- data/Rakefile +10 -0
- data/lib/generators/nice/install/install_generator.rb +22 -0
- data/lib/generators/nice/install/templates/erb/_form.html.erb +23 -0
- data/lib/generators/nice/install/templates/erb/edit.html.erb +6 -0
- data/lib/generators/nice/install/templates/erb/index.html.erb +31 -0
- data/lib/generators/nice/install/templates/erb/new.html.erb +5 -0
- data/lib/generators/nice/install/templates/erb/show.html.erb +12 -0
- data/lib/generators/nice/install/templates/nice.en.yml +12 -0
- data/lib/generators/nice/layout/layout_generator.rb +38 -0
- data/lib/generators/nice/layout/templates/erb/application.html.erb.tt +18 -0
- data/lib/generators/nice/layout/templates/layout_helper.rb.tt +10 -0
- data/lib/generators/nice/scaffold/scaffold_generator.rb +13 -0
- data/lib/generators/nice/scaffold_controller/scaffold_controller_generator.rb +9 -0
- data/lib/generators/nice/scaffold_controller/templates/controller.rb +59 -0
- data/lib/nice_generators.rb +4 -0
- data/lib/nice_generators/version.rb +3 -0
- data/nice_generators.gemspec +22 -0
- data/test/generators/install_generator_test.rb +18 -0
- data/test/generators/layout_generator_test.rb +14 -0
- data/test/generators/scaffold_controller_generator_test.rb +26 -0
- data/test/generators/scaffold_generator_test.rb +26 -0
- data/test/test_helper.rb +18 -0
- metadata +88 -0
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (c) 2012 Patricio Mac Adden <patriciomacadden@gmail.com>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# Nice Generators [![Build Status](https://travis-ci.org/patriciomacadden/nice_generators.png)](https://travis-ci.org/patriciomacadden/nice_generators) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/patriciomacadden/nice_generators)
|
2
|
+
|
3
|
+
### Nice generators for rails 3.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add `nice_generators` to your `Gemfile`:
|
8
|
+
|
9
|
+
```
|
10
|
+
gem 'nice_generators'
|
11
|
+
```
|
12
|
+
|
13
|
+
Install it using `bundle install`
|
14
|
+
|
15
|
+
Run the following command to install some templates and the translation file
|
16
|
+
(`config/locales/nice.en.yml`):
|
17
|
+
|
18
|
+
```
|
19
|
+
rails generate nice:install
|
20
|
+
```
|
21
|
+
|
22
|
+
## Available generators
|
23
|
+
|
24
|
+
* `install` generator
|
25
|
+
|
26
|
+
```
|
27
|
+
rails generate nice:install
|
28
|
+
```
|
29
|
+
|
30
|
+
This generator was already explained: it allows us to use `nice_generators`.
|
31
|
+
|
32
|
+
* `layout` generator
|
33
|
+
|
34
|
+
```
|
35
|
+
rails generate nice:layout application
|
36
|
+
```
|
37
|
+
|
38
|
+
This generator creates a nice layout, similar to the default layout, but
|
39
|
+
well-indented and displaying flashes. In addition, it generates a layout
|
40
|
+
helper containing useful methods.
|
41
|
+
|
42
|
+
* `scaffold` generator
|
43
|
+
|
44
|
+
```
|
45
|
+
rails generate nice:scaffold article title:string body:text
|
46
|
+
```
|
47
|
+
|
48
|
+
It's just like `rails generate scaffold article title:string body:text`, but with some *nice* features.
|
49
|
+
|
50
|
+
* `scaffold_controller` generator
|
51
|
+
|
52
|
+
```
|
53
|
+
rails generate nice:scaffold_controller comment name:string body:text post_id:integer
|
54
|
+
```
|
55
|
+
|
56
|
+
It's just like `rails generate scaffold_controller article name:string body:text post_id:integer`, but with some *nice* features.
|
57
|
+
|
58
|
+
## Features
|
59
|
+
|
60
|
+
* Generated controllers are refactored
|
61
|
+
* Generated controllers and views are fully i18n'ed
|
62
|
+
* Generated controllers uses `respond_to` and `respond_with`
|
63
|
+
* Generated views have titles (in rails default scaffold show view has no
|
64
|
+
title)
|
65
|
+
* Generated layouts are well-indented
|
66
|
+
* Generated layouts displays the flashes
|
67
|
+
* Layout generator also generates a layout helper, which contains useful
|
68
|
+
methods for using in the layout
|
69
|
+
* Generated views uses pretty page titles (See this [screencast](http://railscasts.com/episodes/30-pretty-page-title))
|
70
|
+
|
71
|
+
## Integration with simple_form
|
72
|
+
|
73
|
+
You can use nice_generators along with [simple_form](https://github.com/plataformatec/simple_form). Simply run `rails generate simple_form:install` after running `rails generate nice:install`.
|
74
|
+
|
75
|
+
```
|
76
|
+
rails generate nice:install
|
77
|
+
rails generate simple_form:install
|
78
|
+
```
|
79
|
+
|
80
|
+
## Contributing
|
81
|
+
|
82
|
+
1. Fork it
|
83
|
+
2. Create a branch (`git checkout -b my_awesome_branch`)
|
84
|
+
3. Commit your changes (`git commit -am "Added some magic"`)
|
85
|
+
4. Push to the branch (`git push origin my_awesome_branch`)
|
86
|
+
5. Send pull request
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
module Nice
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
desc 'Copy scaffold templates into your rails application'
|
5
|
+
source_root File.expand_path '../templates', __FILE__
|
6
|
+
|
7
|
+
class_option :template_engine
|
8
|
+
|
9
|
+
def copy_templates
|
10
|
+
engine = options[:template_engine]
|
11
|
+
|
12
|
+
copy_file "#{engine}/_form.html.#{engine}", "lib/templates/#{engine}/scaffold/_form.html.#{engine}"
|
13
|
+
copy_file "#{engine}/edit.html.#{engine}", "lib/templates/#{engine}/scaffold/edit.html.#{engine}"
|
14
|
+
copy_file "#{engine}/index.html.#{engine}", "lib/templates/#{engine}/scaffold/index.html.#{engine}"
|
15
|
+
copy_file "#{engine}/new.html.#{engine}", "lib/templates/#{engine}/scaffold/new.html.#{engine}"
|
16
|
+
copy_file "#{engine}/show.html.#{engine}", "lib/templates/#{engine}/scaffold/show.html.#{engine}"
|
17
|
+
|
18
|
+
copy_file 'nice.en.yml', 'config/locales/nice.en.yml'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<%%= form_for(@<%= singular_table_name %>) do |f| %>
|
2
|
+
<%% if @<%= singular_table_name %>.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%%=t 'views.<%= plural_table_name %>.errors', count_errors: pluralize(@<%= singular_table_name %>.errors.count, t('nice.error')), object: '<%= singular_table_name %>' %></h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<%% @<%= singular_table_name %>.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%%= msg %></li>
|
9
|
+
<%% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<%% end %>
|
13
|
+
|
14
|
+
<% for attribute in attributes -%>
|
15
|
+
<div class="field">
|
16
|
+
<%%= f.label :<%= attribute.name %> %><br />
|
17
|
+
<%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
|
18
|
+
</div>
|
19
|
+
<% end -%>
|
20
|
+
<div class="actions">
|
21
|
+
<%%= f.submit %>
|
22
|
+
</div>
|
23
|
+
<%% end %>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<h1><%%= title t('views.<%= plural_table_name %>.index') %></h1>
|
2
|
+
|
3
|
+
<%% if @<%= plural_table_name %>.any? %>
|
4
|
+
<table>
|
5
|
+
<tr>
|
6
|
+
<% for attribute in attributes -%>
|
7
|
+
<th><%%=t 'activerecord.attributes.<%= singular_table_name %>.<%= attribute.name %>' %></th>
|
8
|
+
<% end -%>
|
9
|
+
<th></th>
|
10
|
+
<th></th>
|
11
|
+
<th></th>
|
12
|
+
</tr>
|
13
|
+
|
14
|
+
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
|
15
|
+
<tr>
|
16
|
+
<% for attribute in attributes -%>
|
17
|
+
<td><%%= <%= singular_table_name %>.<%= attribute.name %> %></td>
|
18
|
+
<% end -%>
|
19
|
+
<td><%%= link_to t('nice.show'), <%= singular_table_name %> %></td>
|
20
|
+
<td><%%= link_to t('nice.edit'), edit_<%= singular_table_name %>_path(<%= singular_table_name %>) %></td>
|
21
|
+
<td><%%= link_to t('nice.destroy'), <%= singular_table_name %>, confirm: t('nice.are_you_sure'), method: :delete %></td>
|
22
|
+
</tr>
|
23
|
+
<%% end %>
|
24
|
+
</table>
|
25
|
+
<%% else %>
|
26
|
+
<%%=t 'views.<%= plural_table_name %>.empty' %>
|
27
|
+
<%% end %>
|
28
|
+
|
29
|
+
<br />
|
30
|
+
|
31
|
+
<%%= link_to t('views.<%= plural_table_name %>.new'), new_<%= singular_table_name %>_path %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<h1><%%= title t('views.<%= plural_table_name %>.show') %></h1>
|
2
|
+
|
3
|
+
<% for attribute in attributes -%>
|
4
|
+
<p>
|
5
|
+
<b><%%=t 'activerecord.attributes.<%= singular_table_name %>.<%= attribute.name %>' %>:</b>
|
6
|
+
<%%= @<%= singular_table_name %>.<%= attribute.name %> %>
|
7
|
+
</p>
|
8
|
+
|
9
|
+
<% end -%>
|
10
|
+
|
11
|
+
<%%= link_to t('nice.edit'), edit_<%= singular_table_name %>_path(@<%= singular_table_name %>) %> |
|
12
|
+
<%%= link_to t('nice.back'), <%= index_helper %>_path %>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Nice
|
2
|
+
module Generators
|
3
|
+
class LayoutGenerator < Rails::Generators::NamedBase
|
4
|
+
desc 'Creates a nice layout'
|
5
|
+
source_root File.expand_path '../templates', __FILE__
|
6
|
+
|
7
|
+
class_option :template_engine
|
8
|
+
|
9
|
+
def create_layout
|
10
|
+
engine = options[:template_engine]
|
11
|
+
|
12
|
+
template "#{engine}/application.html.#{engine}.tt", "app/views/layouts/#{file_name}.html.#{engine}"
|
13
|
+
template "layout_helper.rb.tt", "app/helpers/layout_helper.rb"
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def app_name
|
19
|
+
@app_name ||= defined_app_const_base? ? defined_app_name : File.basename(destination_root)
|
20
|
+
end
|
21
|
+
|
22
|
+
def defined_app_name
|
23
|
+
defined_app_const_base.underscore
|
24
|
+
end
|
25
|
+
|
26
|
+
def defined_app_const_base
|
27
|
+
Rails.respond_to?(:application) && defined?(Rails::Application) &&
|
28
|
+
Rails.application.is_a?(Rails::Application) && Rails.application.class.name.sub(/::Application$/, "")
|
29
|
+
end
|
30
|
+
alias :defined_app_const_base? :defined_app_const_base
|
31
|
+
|
32
|
+
def app_const_base
|
33
|
+
@app_const_base ||= defined_app_const_base || app_name.gsub(/\W/, '_').squeeze('_').camelize
|
34
|
+
end
|
35
|
+
alias :camelized :app_const_base
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title><%%= content_for?(:title) ? yield(:title) : default_title %></title>
|
5
|
+
<%%= stylesheet_link_tag 'application', media: 'all' %>
|
6
|
+
<%%= javascript_include_tag 'application' %>
|
7
|
+
<%%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%% flash.each do |name, message| %>
|
12
|
+
<div id="<%%= name %>"><%%= message %></div>
|
13
|
+
<%% end %>
|
14
|
+
|
15
|
+
<%%= yield %>
|
16
|
+
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rails/generators/rails/scaffold/scaffold_generator'
|
2
|
+
|
3
|
+
module Nice
|
4
|
+
module Generators
|
5
|
+
class ScaffoldGenerator < Rails::Generators::ScaffoldGenerator
|
6
|
+
remove_hook_for :scaffold_controller
|
7
|
+
|
8
|
+
hook_for :scaffold_controller do |scaffold_controller|
|
9
|
+
invoke 'nice:scaffold_controller', [name, attributes.collect { |a| "#{a.name}:#{a.type}" }]
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator'
|
2
|
+
|
3
|
+
module Nice
|
4
|
+
module Generators
|
5
|
+
class ScaffoldControllerGenerator < Rails::Generators::ScaffoldControllerGenerator
|
6
|
+
source_root File.expand_path('../templates', __FILE__)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
<% module_namespacing do -%>
|
2
|
+
class <%= controller_class_name %>Controller < ApplicationController
|
3
|
+
before_filter :find_<%= singular_table_name %>!
|
4
|
+
respond_to :html, :json
|
5
|
+
|
6
|
+
# GET <%= route_url %>
|
7
|
+
# GET <%= route_url %>.json
|
8
|
+
def index
|
9
|
+
@<%= plural_table_name %> = <%= class_name %>.all
|
10
|
+
respond_with @<%= plural_table_name %>
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET <%= route_url %>/1
|
14
|
+
# GET <%= route_url %>/1.json
|
15
|
+
def show
|
16
|
+
respond_with @<%= singular_table_name %>
|
17
|
+
end
|
18
|
+
|
19
|
+
# GET <%= route_url %>/new
|
20
|
+
# GET <%= route_url %>/new.json
|
21
|
+
def new
|
22
|
+
@<%= singular_table_name %> = <%= orm_class.build(class_name) %>
|
23
|
+
respond_with @<%= singular_table_name %>
|
24
|
+
end
|
25
|
+
|
26
|
+
# GET <%= route_url %>/1/edit
|
27
|
+
def edit
|
28
|
+
respond_with @<%= singular_table_name %>
|
29
|
+
end
|
30
|
+
|
31
|
+
# POST <%= route_url %>
|
32
|
+
# POST <%= route_url %>.json
|
33
|
+
def create
|
34
|
+
@<%= singular_table_name %> = <%= orm_class.build(class_name, "params[:#{singular_table_name}]") %>
|
35
|
+
flash[:notice] = t('controllers.<%= plural_table_name %>.created') if @<%= orm_instance.save %>
|
36
|
+
respond_with @<%= singular_table_name %>
|
37
|
+
end
|
38
|
+
|
39
|
+
# PUT <%= route_url %>/1
|
40
|
+
# PUT <%= route_url %>/1.json
|
41
|
+
def update
|
42
|
+
flash[:notice] = t('controllers.<%= plural_table_name %>.updated') if @<%= orm_instance.update_attributes("params[:#{singular_table_name}]") %>
|
43
|
+
respond_with @<%= singular_table_name %>
|
44
|
+
end
|
45
|
+
|
46
|
+
# DELETE <%= route_url %>/1
|
47
|
+
# DELETE <%= route_url %>/1.json
|
48
|
+
def destroy
|
49
|
+
@<%= orm_instance.destroy %>
|
50
|
+
respond_with @<%= singular_table_name %>
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def find_<%= singular_table_name %>!
|
56
|
+
@<%= singular_table_name %> = <%= orm_class.find(class_name, 'params[:id]') %> if params[:id]
|
57
|
+
end
|
58
|
+
end
|
59
|
+
<% end -%>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'nice_generators/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'nice_generators'
|
7
|
+
s.version = NiceGenerators::VERSION
|
8
|
+
s.authors = ['Patricio Mac Adden']
|
9
|
+
s.email = ['patriciomacadden@gmail.com']
|
10
|
+
s.homepage = 'https://github.com/patriciomacadden/nice_generators'
|
11
|
+
s.summary = %q{Nice generators for rails 3.}
|
12
|
+
s.description = %q{Nice generators for rails 3.}
|
13
|
+
|
14
|
+
s.rubyforge_project = 'nice_generators'
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ['lib']
|
20
|
+
|
21
|
+
s.add_dependency 'railties'
|
22
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class InstallGeneratorTest < Rails::Generators::TestCase
|
4
|
+
tests Nice::Generators::InstallGenerator
|
5
|
+
destination File.expand_path('../../tmp', __FILE__)
|
6
|
+
setup :prepare_destination
|
7
|
+
|
8
|
+
test 'should create all scaffold files and nice.en.yml file' do
|
9
|
+
run_generator
|
10
|
+
|
11
|
+
assert_file 'lib/templates/erb/scaffold/_form.html.erb'
|
12
|
+
assert_file 'lib/templates/erb/scaffold/edit.html.erb'
|
13
|
+
assert_file 'lib/templates/erb/scaffold/index.html.erb'
|
14
|
+
assert_file 'lib/templates/erb/scaffold/new.html.erb'
|
15
|
+
assert_file 'lib/templates/erb/scaffold/show.html.erb'
|
16
|
+
assert_file 'config/locales/nice.en.yml'
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class LayoutGeneratorTest < Rails::Generators::TestCase
|
4
|
+
tests Nice::Generators::LayoutGenerator
|
5
|
+
destination File.expand_path('../../tmp', __FILE__)
|
6
|
+
setup :prepare_destination
|
7
|
+
|
8
|
+
test 'should create layout' do
|
9
|
+
run_generator %w(application)
|
10
|
+
|
11
|
+
assert_file 'app/views/layouts/application.html.erb'
|
12
|
+
assert_file 'app/helpers/layout_helper.rb'
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
|
4
|
+
tests Nice::Generators::ScaffoldControllerGenerator
|
5
|
+
destination File.expand_path('../../tmp', __FILE__)
|
6
|
+
|
7
|
+
setup do
|
8
|
+
prepare_destination
|
9
|
+
Dir.mkdir("#{destination_root}/config") unless File.exists?("#{destination_root}/config")
|
10
|
+
File.open("#{destination_root}/config/routes.rb", 'w') do |f|
|
11
|
+
f.puts "Rails.application.routes.draw do\n\nend"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
test 'should create a scaffold controller' do
|
16
|
+
run_generator %w(person first_name last_name)
|
17
|
+
|
18
|
+
assert_file 'app/controllers/people_controller.rb'
|
19
|
+
# app/models/person.rb is created by activerecord
|
20
|
+
assert_file 'app/views/people/_form.html.erb'
|
21
|
+
assert_file 'app/views/people/edit.html.erb'
|
22
|
+
assert_file 'app/views/people/index.html.erb'
|
23
|
+
assert_file 'app/views/people/new.html.erb'
|
24
|
+
assert_file 'app/views/people/show.html.erb'
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ScaffoldGeneratorTest < Rails::Generators::TestCase
|
4
|
+
tests Nice::Generators::ScaffoldGenerator
|
5
|
+
destination File.expand_path('../../tmp', __FILE__)
|
6
|
+
|
7
|
+
setup do
|
8
|
+
prepare_destination
|
9
|
+
Dir.mkdir("#{destination_root}/config") unless File.exists?("#{destination_root}/config")
|
10
|
+
File.open("#{destination_root}/config/routes.rb", 'w') do |f|
|
11
|
+
f.puts "Rails.application.routes.draw do\n\nend"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
test 'should create a scaffold' do
|
16
|
+
run_generator %w(person first_name last_name)
|
17
|
+
|
18
|
+
assert_file 'app/controllers/people_controller.rb'
|
19
|
+
# app/models/person.rb is created by activerecord
|
20
|
+
assert_file 'app/views/people/_form.html.erb'
|
21
|
+
assert_file 'app/views/people/edit.html.erb'
|
22
|
+
assert_file 'app/views/people/index.html.erb'
|
23
|
+
assert_file 'app/views/people/new.html.erb'
|
24
|
+
assert_file 'app/views/people/show.html.erb'
|
25
|
+
end
|
26
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# configure rails environment
|
2
|
+
ENV['RAILS_ENV'] = 'test'
|
3
|
+
|
4
|
+
require 'test/unit'
|
5
|
+
require 'rails/generators'
|
6
|
+
require 'rails/generators/test_case'
|
7
|
+
|
8
|
+
# require nice generators
|
9
|
+
require 'generators/nice/install/install_generator'
|
10
|
+
require 'generators/nice/layout/layout_generator'
|
11
|
+
require 'generators/nice/scaffold/scaffold_generator'
|
12
|
+
require 'generators/nice/scaffold_controller/scaffold_controller_generator'
|
13
|
+
|
14
|
+
# require nice generators tests
|
15
|
+
require 'generators/install_generator_test'
|
16
|
+
require 'generators/layout_generator_test'
|
17
|
+
require 'generators/scaffold_generator_test'
|
18
|
+
require 'generators/scaffold_controller_generator_test'
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nice_generators
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Patricio Mac Adden
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-11-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: railties
|
16
|
+
requirement: &70171389791300 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70171389791300
|
25
|
+
description: Nice generators for rails 3.
|
26
|
+
email:
|
27
|
+
- patriciomacadden@gmail.com
|
28
|
+
executables: []
|
29
|
+
extensions: []
|
30
|
+
extra_rdoc_files: []
|
31
|
+
files:
|
32
|
+
- .gitignore
|
33
|
+
- .travis.yml
|
34
|
+
- Gemfile
|
35
|
+
- LICENSE
|
36
|
+
- README.md
|
37
|
+
- Rakefile
|
38
|
+
- lib/generators/nice/install/install_generator.rb
|
39
|
+
- lib/generators/nice/install/templates/erb/_form.html.erb
|
40
|
+
- lib/generators/nice/install/templates/erb/edit.html.erb
|
41
|
+
- lib/generators/nice/install/templates/erb/index.html.erb
|
42
|
+
- lib/generators/nice/install/templates/erb/new.html.erb
|
43
|
+
- lib/generators/nice/install/templates/erb/show.html.erb
|
44
|
+
- lib/generators/nice/install/templates/nice.en.yml
|
45
|
+
- lib/generators/nice/layout/layout_generator.rb
|
46
|
+
- lib/generators/nice/layout/templates/erb/application.html.erb.tt
|
47
|
+
- lib/generators/nice/layout/templates/layout_helper.rb.tt
|
48
|
+
- lib/generators/nice/scaffold/scaffold_generator.rb
|
49
|
+
- lib/generators/nice/scaffold_controller/scaffold_controller_generator.rb
|
50
|
+
- lib/generators/nice/scaffold_controller/templates/controller.rb
|
51
|
+
- lib/nice_generators.rb
|
52
|
+
- lib/nice_generators/version.rb
|
53
|
+
- nice_generators.gemspec
|
54
|
+
- test/generators/install_generator_test.rb
|
55
|
+
- test/generators/layout_generator_test.rb
|
56
|
+
- test/generators/scaffold_controller_generator_test.rb
|
57
|
+
- test/generators/scaffold_generator_test.rb
|
58
|
+
- test/test_helper.rb
|
59
|
+
homepage: https://github.com/patriciomacadden/nice_generators
|
60
|
+
licenses: []
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project: nice_generators
|
79
|
+
rubygems_version: 1.8.17
|
80
|
+
signing_key:
|
81
|
+
specification_version: 3
|
82
|
+
summary: Nice generators for rails 3.
|
83
|
+
test_files:
|
84
|
+
- test/generators/install_generator_test.rb
|
85
|
+
- test/generators/layout_generator_test.rb
|
86
|
+
- test/generators/scaffold_controller_generator_test.rb
|
87
|
+
- test/generators/scaffold_generator_test.rb
|
88
|
+
- test/test_helper.rb
|