nsweb-generators 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/.gitignore +18 -0
- data/Gemfile +8 -0
- data/features/nsweb_controller.feature +29 -0
- data/features/nsweb_engine.feature +12 -0
- data/features/nsweb_model.feature +27 -0
- data/features/step_definitions/common_steps.rb +25 -0
- data/features/step_definitions/setup_steps.rb +11 -0
- data/lib/generators/nsweb.rb +108 -0
- data/lib/generators/nsweb/controller/controller_generator.rb +75 -0
- data/lib/generators/nsweb/controller/templates/actions/create.rb +10 -0
- data/lib/generators/nsweb/controller/templates/actions/destroy.rb +7 -0
- data/lib/generators/nsweb/controller/templates/actions/edit.rb +4 -0
- data/lib/generators/nsweb/controller/templates/actions/index.rb +4 -0
- data/lib/generators/nsweb/controller/templates/actions/new.rb +4 -0
- data/lib/generators/nsweb/controller/templates/actions/show.rb +4 -0
- data/lib/generators/nsweb/controller/templates/actions/update.rb +10 -0
- data/lib/generators/nsweb/controller/templates/controller.rb +3 -0
- data/lib/generators/nsweb/controller/templates/helper.rb +2 -0
- data/lib/generators/nsweb/controller/templates/tests/rspec.rb +5 -0
- data/lib/generators/nsweb/controller/templates/views/index.html.erb +1 -0
- data/lib/generators/nsweb/engine/USAGE +12 -0
- data/lib/generators/nsweb/engine/engine_generator.rb +33 -0
- data/lib/generators/nsweb/engine/templates/engine.rb +22 -0
- data/lib/generators/nsweb/engine/templates/routes.rb +2 -0
- data/lib/generators/nsweb/model/model_generator.rb +53 -0
- data/lib/generators/nsweb/model/templates/migration.rb +15 -0
- data/lib/generators/nsweb/model/templates/model.rb +3 -0
- data/lib/generators/nsweb/model/templates/tests/rspec/model.rb +5 -0
- data/lib/generators/nsweb/model/templates/tests/testunit/model.rb +7 -0
- data/lib/generators/nsweb/scaffold/scaffold_generator.rb +0 -0
- metadata +143 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Feature: Nsweb Controller Generator
|
|
2
|
+
Inside of the Nsweb application
|
|
3
|
+
As a rails developer
|
|
4
|
+
I want to generate a controller for a resource
|
|
5
|
+
|
|
6
|
+
Scenario: Generate a controller for a simple resource inside the core engine
|
|
7
|
+
Given a new whizbang app
|
|
8
|
+
Given a core engine
|
|
9
|
+
|
|
10
|
+
When I run "rails g nsweb:controller core Widget"
|
|
11
|
+
Then I should see the following files
|
|
12
|
+
| vendor/whizbang_app/core/app/controllers/widgets_controller.rb |
|
|
13
|
+
| vendor/whizbang_app/core/app/helpers/widgets_helper.rb |
|
|
14
|
+
|
|
15
|
+
And I should see "resources :widgets" in file "vendor/whizbang_app/core/config/routes.rb"
|
|
16
|
+
When I run "rake db:migrate"
|
|
17
|
+
Then I should successfully run "rake test"
|
|
18
|
+
|
|
19
|
+
Scenario: Generate controller with rspec tests
|
|
20
|
+
Given a new whizbang app
|
|
21
|
+
Given a core engine
|
|
22
|
+
|
|
23
|
+
When I run "rails g nsweb:controller core Widget --rspec"
|
|
24
|
+
Then I should see the following files
|
|
25
|
+
| vendor/whizbang_app/core/spec/controllers/widgets_controller_spec.rb |
|
|
26
|
+
When I run "rake db:migrate"
|
|
27
|
+
And I add "gem 'rspec-rails', '>= 2.0.1'" to file "Gemfile"
|
|
28
|
+
And I run "rails g rspec:install"
|
|
29
|
+
Then I should successfully run "rake spec"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Feature: Nsweb Engine Generator
|
|
2
|
+
Inside of a rails application
|
|
3
|
+
As a rails developer
|
|
4
|
+
I want to generate an engine
|
|
5
|
+
|
|
6
|
+
Scenario: Generate a core engine
|
|
7
|
+
Given a new rails app
|
|
8
|
+
|
|
9
|
+
When I run "rails g nsweb:engine core"
|
|
10
|
+
Then I should see the following files
|
|
11
|
+
| vendor/rails_app/core/lib/core.rb |
|
|
12
|
+
| vendor/rails_app/core/config/routes.rb |
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Feature: Nsweb Model Generator
|
|
2
|
+
Inside of the Nsweb application
|
|
3
|
+
As a rails developer
|
|
4
|
+
I want to generate a model for a resource
|
|
5
|
+
|
|
6
|
+
Scenario: Generate a model for a simple resource inside the core engine
|
|
7
|
+
Given a new whizbang app
|
|
8
|
+
Given a core engine
|
|
9
|
+
|
|
10
|
+
When I run "rails g nsweb:model core Widget myvar:string"
|
|
11
|
+
Then I should see the following files
|
|
12
|
+
| vendor/whizbang_app/core/app/models/widget.rb |
|
|
13
|
+
| db/migrate |
|
|
14
|
+
When I run "rake db:migrate"
|
|
15
|
+
Then I should successfully run "rake test"
|
|
16
|
+
|
|
17
|
+
Scenario: Generate a model with rspec tests
|
|
18
|
+
Given a new whizbang app
|
|
19
|
+
Given a core engine
|
|
20
|
+
|
|
21
|
+
When I run "rails g nsweb:model core widget myvar:string --rspec"
|
|
22
|
+
Then I should see the following files
|
|
23
|
+
| vendor/whizbang_app/core/spec/models/widget_spec.rb |
|
|
24
|
+
When I run "rake db:migrate"
|
|
25
|
+
And I add "gem 'rspec-rails', '>= 2.0.1'" to file "Gemfile"
|
|
26
|
+
And I run "rails g rspec:install"
|
|
27
|
+
Then I should successfully run "rake spec"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
When /^I run "([^\"]*)"$/ do |command|
|
|
2
|
+
system("cd #{@current_directory} && #{command}").should be_true
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
When /^I add "([^\"]*)" to file "([^\"]*)"$/ do |content, short_path|
|
|
6
|
+
path = File.join(@current_directory, short_path)
|
|
7
|
+
File.should exist(path)
|
|
8
|
+
File.open(path, 'a') { |f| f.write(content + "\n") }
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
Then /^I should see "(.*)" in file "([^\"]*)"$/ do |content, short_path|
|
|
12
|
+
path = File.join(@current_directory, short_path)
|
|
13
|
+
File.should exist(path)
|
|
14
|
+
File.readlines(path).join.should include(content)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
Then /^I should see the following files$/ do |table|
|
|
18
|
+
table.raw.flatten.each do |path|
|
|
19
|
+
File.should exist(File.join(@current_directory, path))
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
Then /^I should successfully run "([^\"]*)"$/ do |command|
|
|
24
|
+
system("cd #{@current_directory} && #{command}").should be_true
|
|
25
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Given /^a new ([a-z_]*) app$/ do |app_name|
|
|
2
|
+
FileUtils.mkdir_p('tmp')
|
|
3
|
+
system('rm -rf tmp/*')
|
|
4
|
+
system("rails new tmp/#{app_name}_app")
|
|
5
|
+
system("ln -s ../../../lib/generators tmp/#{app_name}_app/lib/generators").should be_true
|
|
6
|
+
@current_directory = File.expand_path("tmp/#{app_name}_app")
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
Given /^a ([a-z_]*) engine$/ do |engine_name|
|
|
10
|
+
system("cd #{@current_directory} && rails g nsweb:engine #{engine_name}")
|
|
11
|
+
end
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
require 'rails/generators/base'
|
|
3
|
+
|
|
4
|
+
module Nsweb
|
|
5
|
+
module Generators
|
|
6
|
+
class Base < Rails::Generators::Base #:nodoc:
|
|
7
|
+
attr_accessor :engine_name
|
|
8
|
+
|
|
9
|
+
argument :engine_name, :type => :string, :required => true, :banner => 'EngineName'
|
|
10
|
+
|
|
11
|
+
def self.source_root
|
|
12
|
+
@nsweb_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'nsweb', generator_name, 'templates'))
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.banner
|
|
16
|
+
"#{$0} generate nsweb:#{generator_name} #{self.arguments.map{ |a| a.usage }.join(' ')} [options]"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
protected
|
|
20
|
+
|
|
21
|
+
def application_name
|
|
22
|
+
if defined?(Rails) && Rails.application
|
|
23
|
+
Rails.application.class.name.split('::').first.underscore
|
|
24
|
+
else
|
|
25
|
+
'application'
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def engine_path
|
|
30
|
+
@engine_path ||= File.join('vendor', application_name, engine_name.underscore)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def engine_route(routing_code)
|
|
34
|
+
sentinel = /\.routes\.draw do(?:\s*\|map\|)?\s*$/
|
|
35
|
+
in_root do
|
|
36
|
+
inject_into_file File.join(engine_path, 'config/routes.rb' ),
|
|
37
|
+
"\n #{routing_code}\n", { :after => sentinel, :verbose => false }
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def test_framework
|
|
42
|
+
return @test_framework if defined?(@test_framework)
|
|
43
|
+
if options.rspec?
|
|
44
|
+
return @test_framework = :rspec
|
|
45
|
+
else
|
|
46
|
+
return @test_framework = default_test_framework
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def default_test_framework
|
|
51
|
+
File.exist?(File.join(destination_root, 'spec')) ? :rspec : :testunit
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
class NamedBase < Base
|
|
56
|
+
|
|
57
|
+
argument :name, :type => :string
|
|
58
|
+
|
|
59
|
+
def initialize(args, *options)
|
|
60
|
+
super
|
|
61
|
+
assign_names!(self.name)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
protected
|
|
65
|
+
|
|
66
|
+
attr_reader :class_path, :file_name
|
|
67
|
+
alias :singular_name :file_name
|
|
68
|
+
|
|
69
|
+
def plural_name
|
|
70
|
+
@plural_name ||= file_name.pluralize
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def file_path
|
|
74
|
+
@file_path ||= (class_path + [singular_name]).join('/')
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def plural_file_path
|
|
78
|
+
@plural_file_path ||= (class_path + [plural_name]).join('/')
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def class_name
|
|
82
|
+
@class_name ||= (class_path + [singular_name]).map! { |m| m.camelize }.join('::')
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def plural_class_name
|
|
86
|
+
@plural_class_name ||= (class_path + [plural_name]).map! { |m| m.camelize }.join('::')
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def plural_class_name
|
|
90
|
+
@plural_class_name ||= plural_name.camelize
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def table_name
|
|
94
|
+
@table_name ||= ([application_name] + [plural_name]).join('_')
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
#def migration_class_name
|
|
98
|
+
# @migration_class_name ||= (class_path + [plural_name]).map { |m| m.camelize }.join
|
|
99
|
+
#end
|
|
100
|
+
|
|
101
|
+
def assign_names!(name) #:nodoc:
|
|
102
|
+
@class_path = name.include?('/') ? name.split('/') : name.split('::')
|
|
103
|
+
@class_path.map! { |m| m.underscore }
|
|
104
|
+
@file_name = @class_path.pop.singularize
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
require 'generators/nsweb'
|
|
2
|
+
|
|
3
|
+
module Nsweb
|
|
4
|
+
module Generators
|
|
5
|
+
class ControllerGenerator < NamedBase
|
|
6
|
+
|
|
7
|
+
argument :actions, :type => :array, :default => [],
|
|
8
|
+
:banner => 'action action'
|
|
9
|
+
|
|
10
|
+
class_option :rspec, :desc => 'Use RSpec for test files.', :group => 'Test framework', :type => :boolean
|
|
11
|
+
|
|
12
|
+
def initialize(*args, &block)
|
|
13
|
+
super
|
|
14
|
+
|
|
15
|
+
@controller_actions = []
|
|
16
|
+
actions.each do |action|
|
|
17
|
+
@controller_actions << action
|
|
18
|
+
@controller_actions << 'create' if action.eql?( 'new' )
|
|
19
|
+
@controller_actions << 'update' if action.eql?( 'edit' )
|
|
20
|
+
end
|
|
21
|
+
@controller_actions.uniq!
|
|
22
|
+
|
|
23
|
+
@controller_actions = all_actions if @controller_actions.empty?
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def create_controller
|
|
27
|
+
template 'controller.rb', File.join(engine_path, 'app/controllers',
|
|
28
|
+
"#{plural_file_path}_controller.rb")
|
|
29
|
+
if test_framework == :rspec
|
|
30
|
+
template 'tests/rspec.rb', File.join(engine_path, 'spec/controllers',
|
|
31
|
+
"#{plural_file_path}_controller_spec.rb")
|
|
32
|
+
else
|
|
33
|
+
end
|
|
34
|
+
unless options.skip_helper?
|
|
35
|
+
template 'helper.rb', File.join(engine_path, 'app/helpers',
|
|
36
|
+
"#{plural_file_path}_helper.rb")
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
#controller_actions.each do |action|
|
|
40
|
+
# if %w[index show new edit].include?(action)
|
|
41
|
+
# template "views/#{action}.html.erb", File.join(engine_path,
|
|
42
|
+
# "app/views/#{file_name}/#{action}.html.erb")
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# end
|
|
46
|
+
#end
|
|
47
|
+
|
|
48
|
+
if class_path.length < 0
|
|
49
|
+
engine_route("resources #{plural_file_name.to_sym.inspect},
|
|
50
|
+
:controller => '#{(class_path + [plural_name]).join('/')}")
|
|
51
|
+
else
|
|
52
|
+
engine_route("resources #{plural_name.to_sym.inspect}")
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
protected
|
|
57
|
+
|
|
58
|
+
attr_reader :controller_actions
|
|
59
|
+
|
|
60
|
+
def controller_methods(dir)
|
|
61
|
+
controller_actions.map do |action|
|
|
62
|
+
read_template("#{dir}/#{action}.rb")
|
|
63
|
+
end.join("\n").strip
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def read_template(relative_path)
|
|
67
|
+
ERB.new(File.read(find_in_source_paths(relative_path)), nil, '-').result(binding)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def all_actions
|
|
71
|
+
%w[index show new create edit update destroy]
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
def create
|
|
2
|
+
@<%= singular_name %> = <%= class_name %>.new(params[:<%= singular_name %>])
|
|
3
|
+
if @<%= singular_name %>.save
|
|
4
|
+
flash[:notice] = "Successfully created <%= file_name.underscore.humanize.downcase %>."
|
|
5
|
+
redirect_to @<%= singular_name %>
|
|
6
|
+
else
|
|
7
|
+
render :action => 'new'
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
def update
|
|
2
|
+
@<%= singular_name %> = <%= class_name %>.find(params[:id])
|
|
3
|
+
if @<%= singular_name %>.update_attributes(params[:<%= singular_name %>])
|
|
4
|
+
flash[:notice] = "Successfully updated <%= file_name.humanize.downcase %>."
|
|
5
|
+
redirect_to @<%= singular_name %>
|
|
6
|
+
else
|
|
7
|
+
render :action => 'edit'
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<h2>Template for <%= engine_name.titleize %><%= plural_file_name.titleize %>.index</h2>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Description:
|
|
2
|
+
Scaffolds an Engine. This will generate the necessary directories inside
|
|
3
|
+
vendor/{application_name}.
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
Pass in the name of the Engine, either CamelCased or under_scored, as the
|
|
7
|
+
only argument.
|
|
8
|
+
|
|
9
|
+
Examples:
|
|
10
|
+
rails generate nsweb:engine transfers
|
|
11
|
+
|
|
12
|
+
Will create a a Transfers engine inside vendor.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'generators/nsweb'
|
|
2
|
+
|
|
3
|
+
module Nsweb
|
|
4
|
+
module Generators
|
|
5
|
+
class EngineGenerator < Base
|
|
6
|
+
|
|
7
|
+
attr_accessor :engine_name
|
|
8
|
+
|
|
9
|
+
def initialize(*args, &block)
|
|
10
|
+
super
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def create_engine
|
|
14
|
+
template 'engine.rb', File.join(engine_path, 'lib', "#{engine_file_name}.rb")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def create_routes
|
|
18
|
+
template 'routes.rb', File.join(engine_path, 'config/routes.rb')
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
protected
|
|
22
|
+
|
|
23
|
+
def engine_file_name
|
|
24
|
+
@engine_file_name ||= engine_name.underscore
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def engine_class_name
|
|
28
|
+
@engine_class_name ||= engine_name.camelize
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require 'rails/all'
|
|
2
|
+
|
|
3
|
+
module <%= application_name %>
|
|
4
|
+
module <%= engine_class_name %>
|
|
5
|
+
class << self
|
|
6
|
+
def root
|
|
7
|
+
@root ||= File.dirname(File.expand_path(__FILE__))
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class Engine < Rails::Engine
|
|
12
|
+
|
|
13
|
+
config.after_initialize do |app|
|
|
14
|
+
<%= application_name %>::Plugin.register do |plugin|
|
|
15
|
+
plugin.name = '<%= engine_file_name %>'
|
|
16
|
+
plugin.title = '<%= engine_class_name %>'
|
|
17
|
+
plugin.version = %q{0.0.1}
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
require 'generators/nsweb'
|
|
2
|
+
require 'rails/generators/migration'
|
|
3
|
+
require 'rails/generators/generated_attribute'
|
|
4
|
+
|
|
5
|
+
module Nsweb
|
|
6
|
+
module Generators
|
|
7
|
+
class ModelGenerator < NamedBase
|
|
8
|
+
include Rails::Generators::Migration
|
|
9
|
+
|
|
10
|
+
argument :attributes, :type => :array, :default => [], :banner => 'field:type field:type'
|
|
11
|
+
|
|
12
|
+
class_option :skip_migration, :desc => 'Don\'t generate a migration file for model.', :type => :boolean
|
|
13
|
+
class_option :rspec, :desc => 'Use RSpec for test files.', :group => 'Test framework', :type => :boolean
|
|
14
|
+
|
|
15
|
+
def initialize(*args, &block)
|
|
16
|
+
super
|
|
17
|
+
@model_attributes = []
|
|
18
|
+
attributes.each do |attr|
|
|
19
|
+
@model_attributes << Rails::Generators::GeneratedAttribute.new(*attr.split(':'))
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def create_model
|
|
24
|
+
template 'model.rb', File.join(engine_path, 'app/models', "#{file_path}.rb")
|
|
25
|
+
if test_framework == :rspec
|
|
26
|
+
template 'tests/rspec/model.rb', File.join(engine_path, 'spec/models',
|
|
27
|
+
"#{file_path}_spec.rb")
|
|
28
|
+
else
|
|
29
|
+
template "tests/#{test_framework}/model.rb", File.join(engine_path, "test/unit/#{singular_name}_test.rb")
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def create_migration
|
|
35
|
+
unless options.skip_migration?
|
|
36
|
+
migration_template 'migration.rb', "db/migrate/create_#{table_name}.rb"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def self.next_migration_number(dirname) #:nodoc:
|
|
41
|
+
if ActiveRecord::Base.timestamped_migrations
|
|
42
|
+
Time.now.utc.strftime( '%Y%m%d%H%M%S' )
|
|
43
|
+
else
|
|
44
|
+
"#.3d" % (current_migration_number(dirname) + 1)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
protected
|
|
49
|
+
|
|
50
|
+
attr_reader :model_attributes
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class <%= migration_class_name %> < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :<%= table_name %> do |t|
|
|
4
|
+
<%- model_attributes.each do |attribute| -%>
|
|
5
|
+
t.<%= attribute.type %> :<%= attribute.name %>
|
|
6
|
+
<%- end -%>
|
|
7
|
+
|
|
8
|
+
t.timestamps
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.down
|
|
13
|
+
drop_table :<%= table_name %>
|
|
14
|
+
end
|
|
15
|
+
end
|
|
File without changes
|
metadata
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: nsweb-generators
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 27
|
|
5
|
+
prerelease: false
|
|
6
|
+
segments:
|
|
7
|
+
- 0
|
|
8
|
+
- 1
|
|
9
|
+
- 0
|
|
10
|
+
version: 0.1.0
|
|
11
|
+
platform: ruby
|
|
12
|
+
authors:
|
|
13
|
+
- Josh Williams
|
|
14
|
+
autorequire:
|
|
15
|
+
bindir: bin
|
|
16
|
+
cert_chain: []
|
|
17
|
+
|
|
18
|
+
date: 2010-12-10 00:00:00 -06:00
|
|
19
|
+
default_executable:
|
|
20
|
+
dependencies:
|
|
21
|
+
- !ruby/object:Gem::Dependency
|
|
22
|
+
name: rspec-rails
|
|
23
|
+
prerelease: false
|
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
26
|
+
requirements:
|
|
27
|
+
- - ~>
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
hash: 13
|
|
30
|
+
segments:
|
|
31
|
+
- 2
|
|
32
|
+
- 0
|
|
33
|
+
- 1
|
|
34
|
+
version: 2.0.1
|
|
35
|
+
type: :runtime
|
|
36
|
+
version_requirements: *id001
|
|
37
|
+
- !ruby/object:Gem::Dependency
|
|
38
|
+
name: cucumber
|
|
39
|
+
prerelease: false
|
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
42
|
+
requirements:
|
|
43
|
+
- - ~>
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
hash: 63
|
|
46
|
+
segments:
|
|
47
|
+
- 0
|
|
48
|
+
- 9
|
|
49
|
+
- 2
|
|
50
|
+
version: 0.9.2
|
|
51
|
+
type: :runtime
|
|
52
|
+
version_requirements: *id002
|
|
53
|
+
- !ruby/object:Gem::Dependency
|
|
54
|
+
name: rails
|
|
55
|
+
prerelease: false
|
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
|
57
|
+
none: false
|
|
58
|
+
requirements:
|
|
59
|
+
- - ~>
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
hash: 1
|
|
62
|
+
segments:
|
|
63
|
+
- 3
|
|
64
|
+
- 0
|
|
65
|
+
- 3
|
|
66
|
+
version: 3.0.3
|
|
67
|
+
type: :runtime
|
|
68
|
+
version_requirements: *id003
|
|
69
|
+
description: Generators for Nsweb engines/models/controllers
|
|
70
|
+
email: jwilliams@shareone.com
|
|
71
|
+
executables: []
|
|
72
|
+
|
|
73
|
+
extensions: []
|
|
74
|
+
|
|
75
|
+
extra_rdoc_files: []
|
|
76
|
+
|
|
77
|
+
files:
|
|
78
|
+
- .gitignore
|
|
79
|
+
- Gemfile
|
|
80
|
+
- features/nsweb_controller.feature
|
|
81
|
+
- features/nsweb_engine.feature
|
|
82
|
+
- features/nsweb_model.feature
|
|
83
|
+
- features/step_definitions/common_steps.rb
|
|
84
|
+
- features/step_definitions/setup_steps.rb
|
|
85
|
+
- lib/generators/nsweb.rb
|
|
86
|
+
- lib/generators/nsweb/controller/controller_generator.rb
|
|
87
|
+
- lib/generators/nsweb/controller/templates/actions/create.rb
|
|
88
|
+
- lib/generators/nsweb/controller/templates/actions/destroy.rb
|
|
89
|
+
- lib/generators/nsweb/controller/templates/actions/edit.rb
|
|
90
|
+
- lib/generators/nsweb/controller/templates/actions/index.rb
|
|
91
|
+
- lib/generators/nsweb/controller/templates/actions/new.rb
|
|
92
|
+
- lib/generators/nsweb/controller/templates/actions/show.rb
|
|
93
|
+
- lib/generators/nsweb/controller/templates/actions/update.rb
|
|
94
|
+
- lib/generators/nsweb/controller/templates/controller.rb
|
|
95
|
+
- lib/generators/nsweb/controller/templates/helper.rb
|
|
96
|
+
- lib/generators/nsweb/controller/templates/tests/rspec.rb
|
|
97
|
+
- lib/generators/nsweb/controller/templates/views/index.html.erb
|
|
98
|
+
- lib/generators/nsweb/engine/USAGE
|
|
99
|
+
- lib/generators/nsweb/engine/engine_generator.rb
|
|
100
|
+
- lib/generators/nsweb/engine/templates/engine.rb
|
|
101
|
+
- lib/generators/nsweb/engine/templates/routes.rb
|
|
102
|
+
- lib/generators/nsweb/model/model_generator.rb
|
|
103
|
+
- lib/generators/nsweb/model/templates/migration.rb
|
|
104
|
+
- lib/generators/nsweb/model/templates/model.rb
|
|
105
|
+
- lib/generators/nsweb/model/templates/tests/rspec/model.rb
|
|
106
|
+
- lib/generators/nsweb/model/templates/tests/testunit/model.rb
|
|
107
|
+
- lib/generators/nsweb/scaffold/scaffold_generator.rb
|
|
108
|
+
has_rdoc: true
|
|
109
|
+
homepage: http://projects.hbtesting.org
|
|
110
|
+
licenses: []
|
|
111
|
+
|
|
112
|
+
post_install_message:
|
|
113
|
+
rdoc_options: []
|
|
114
|
+
|
|
115
|
+
require_paths:
|
|
116
|
+
- lib
|
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
118
|
+
none: false
|
|
119
|
+
requirements:
|
|
120
|
+
- - ">="
|
|
121
|
+
- !ruby/object:Gem::Version
|
|
122
|
+
hash: 3
|
|
123
|
+
segments:
|
|
124
|
+
- 0
|
|
125
|
+
version: "0"
|
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
|
+
none: false
|
|
128
|
+
requirements:
|
|
129
|
+
- - ">="
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
hash: 3
|
|
132
|
+
segments:
|
|
133
|
+
- 0
|
|
134
|
+
version: "0"
|
|
135
|
+
requirements: []
|
|
136
|
+
|
|
137
|
+
rubyforge_project:
|
|
138
|
+
rubygems_version: 1.3.7
|
|
139
|
+
signing_key:
|
|
140
|
+
specification_version: 3
|
|
141
|
+
summary: Generators for Nsweb
|
|
142
|
+
test_files: []
|
|
143
|
+
|