padrino-gen 0.2.2 → 0.2.5
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.rdoc +1 -1
- data/VERSION +1 -1
- data/bin/padrino-gen +6 -10
- data/lib/{generators/skeleton.rb → padrino-gen/generators/app.rb} +8 -4
- data/lib/padrino-gen/generators/base.rb +25 -0
- data/lib/{generators → padrino-gen/generators}/controller.rb +4 -0
- data/lib/{generators → padrino-gen/generators}/mailer.rb +4 -0
- data/lib/{generators → padrino-gen/generators}/migration.rb +4 -0
- data/lib/{generators → padrino-gen/generators}/model.rb +4 -0
- data/lib/padrino-gen.rb +26 -3
- data/padrino-gen.gemspec +56 -54
- data/test/{test_skeleton_generator.rb → test_app_generator.rb} +37 -29
- data/test/test_controller_generator.rb +10 -9
- data/test/test_generator.rb +17 -0
- data/test/test_mailer_generator.rb +5 -4
- data/test/test_migration_generator.rb +24 -15
- data/test/test_model_generator.rb +21 -20
- metadata +55 -53
- /data/lib/{generators → padrino-gen/generators}/actions.rb +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/.gitignore +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/Gemfile +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/app/.empty_directory +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/app/app.rb.tt +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/app/controllers/.empty_directory +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/app/helpers/.empty_directory +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/app/views/.empty_directory +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/config/apps.rb.tt +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/config/boot.rb +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/config/initializers/.empty_directory +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/config/initializers/example.rb +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/config/urls.rb.tt +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/config.ru +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/lib/.empty_directory +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/public/images/.empty_directory +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/public/javascripts/.empty_directory +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/public/stylesheets/.empty_directory +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/tmp/.empty_directory +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/actions.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/mocks/mocha_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/mocks/rr_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/orms/activerecord_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/orms/couchrest_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/orms/datamapper_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/orms/mongomapper_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/orms/sequel_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/renderers/erb_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/renderers/haml_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/scripts/jquery_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/scripts/prototype_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/scripts/rightjs_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/tests/bacon_test_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/tests/riot_test_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/tests/rspec_test_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/tests/shoulda_test_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/tests/testspec_test_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/templates/controller.rb.tt +0 -0
- /data/lib/{generators → padrino-gen/generators}/templates/helper.rb.tt +0 -0
- /data/lib/{generators → padrino-gen/generators}/templates/mailer.rb.tt +0 -0
- /data/lib/{generators → padrino-gen/generators}/templates/mailer_initializer.rb.tt +0 -0
- /data/lib/{generators → padrino-gen/generators}/templates/scripts/jquery.js +0 -0
- /data/lib/{generators → padrino-gen/generators}/templates/scripts/lowpro.js +0 -0
- /data/lib/{generators → padrino-gen/generators}/templates/scripts/protopak.js +0 -0
- /data/lib/{generators → padrino-gen/generators}/templates/scripts/right.js +0 -0
data/README.rdoc
CHANGED
|
@@ -74,7 +74,7 @@ If not executed manually, the bundling will be performed automatically the first
|
|
|
74
74
|
Note that this command only has to be performed when the application is first generated or when the Gemfile is modified.
|
|
75
75
|
|
|
76
76
|
The generator framework within padrino is extensible and additional components and tools can be added easily.
|
|
77
|
-
This would be achieved through forking our project and reading through the code in <tt>lib/generators/
|
|
77
|
+
This would be achieved through forking our project and reading through the code in <tt>lib/generators/App.rb</tt> and
|
|
78
78
|
the setup instructions inside the relevant files within <tt>lib/generators/components/</tt>. We are happy to accept pull requests
|
|
79
79
|
for additional component types not originally included (although helping us maintain them would also be appreciated).
|
|
80
80
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.5
|
data/bin/padrino-gen
CHANGED
|
@@ -2,19 +2,15 @@
|
|
|
2
2
|
%w[rubygems thor].each { |gem| require gem }
|
|
3
3
|
require File.dirname(__FILE__) + "/../lib/padrino-gen"
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
generator_mappings[:model] = Padrino::Generators::Model
|
|
8
|
-
generator_mappings[:migration] = Padrino::Generators::Migration
|
|
9
|
-
generator_mappings[:controller] = Padrino::Generators::Controller
|
|
10
|
-
generator_mappings[:mailer] = Padrino::Generators::Mailer
|
|
5
|
+
Padrino::Generators::Base.start(ARGV)
|
|
6
|
+
Padrino::Generators.lockup!
|
|
11
7
|
|
|
12
|
-
generator_kind
|
|
13
|
-
generator_class =
|
|
8
|
+
generator_kind = ARGV.delete_at(0).to_s.downcase.to_sym if ARGV[0].present?
|
|
9
|
+
generator_class = Padrino::Generators.mappings[generator_kind]
|
|
14
10
|
arguments = ARGV.any? ? ARGV : ['-h']
|
|
15
11
|
|
|
16
|
-
if generator_class
|
|
12
|
+
if generator_class
|
|
17
13
|
generator_class.start(arguments)
|
|
18
14
|
else
|
|
19
|
-
puts "Please specify generator to use (#{
|
|
15
|
+
puts "Please specify generator to use (#{Padrino::Generators.mappings.keys.join(", ")})"
|
|
20
16
|
end
|
|
@@ -2,7 +2,11 @@ require 'thor'
|
|
|
2
2
|
|
|
3
3
|
module Padrino
|
|
4
4
|
module Generators
|
|
5
|
-
class
|
|
5
|
+
class App < Thor::Group
|
|
6
|
+
|
|
7
|
+
# Add this generator to our padrino-gen
|
|
8
|
+
Padrino::Generators.add_generator(:app, self)
|
|
9
|
+
|
|
6
10
|
# Define the source template root
|
|
7
11
|
def self.source_root; File.dirname(__FILE__); end
|
|
8
12
|
def self.banner; "padrino-gen project [name] [path] [options]"; end
|
|
@@ -25,11 +29,11 @@ module Padrino
|
|
|
25
29
|
component_option :script, "javascript library", :aliases => '-s', :choices => [:jquery, :prototype, :rightjs]
|
|
26
30
|
component_option :renderer, "template engine", :aliases => '-r', :choices => [:erb, :haml]
|
|
27
31
|
|
|
28
|
-
# Copies over the Padrino base application
|
|
29
|
-
def
|
|
32
|
+
# Copies over the Padrino base application App
|
|
33
|
+
def setup_app
|
|
30
34
|
self.destination_root = File.join(path, name)
|
|
31
35
|
@class_name = name.classify
|
|
32
|
-
directory("
|
|
36
|
+
directory("app/", self.destination_root)
|
|
33
37
|
store_component_config('.components')
|
|
34
38
|
end
|
|
35
39
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'thor'
|
|
2
|
+
|
|
3
|
+
module Padrino
|
|
4
|
+
module Generators
|
|
5
|
+
|
|
6
|
+
class Base < Thor::Group
|
|
7
|
+
|
|
8
|
+
# Include related modules
|
|
9
|
+
include Thor::Actions
|
|
10
|
+
include Padrino::Generators::Actions
|
|
11
|
+
|
|
12
|
+
class_option :root, :aliases => '-r', :default => nil, :type => :string
|
|
13
|
+
|
|
14
|
+
# Copies over the base sinatra starting project
|
|
15
|
+
def load_boot
|
|
16
|
+
if in_app_root?(options[:root])
|
|
17
|
+
require(options[:root] ? File.join(options[:root], 'config/boot.rb') : 'config/boot.rb')
|
|
18
|
+
else
|
|
19
|
+
say "You are not at the root of a Padrino application! (config/boot.rb not found)" and return unless in_app_root?
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -4,6 +4,10 @@ module Padrino
|
|
|
4
4
|
module Generators
|
|
5
5
|
|
|
6
6
|
class Controller < Thor::Group
|
|
7
|
+
|
|
8
|
+
# Add this generator to our padrino-gen
|
|
9
|
+
Padrino::Generators.add_generator(:controller, self)
|
|
10
|
+
|
|
7
11
|
# Define the source template root
|
|
8
12
|
def self.source_root; File.expand_path(File.dirname(__FILE__)); end
|
|
9
13
|
def self.banner; "padrino-gen controller [name]"; end
|
|
@@ -4,6 +4,10 @@ module Padrino
|
|
|
4
4
|
module Generators
|
|
5
5
|
|
|
6
6
|
class Mailer < Thor::Group
|
|
7
|
+
|
|
8
|
+
# Add this generator to our padrino-gen
|
|
9
|
+
Padrino::Generators.add_generator(:mailer, self)
|
|
10
|
+
|
|
7
11
|
# Define the source template root
|
|
8
12
|
def self.source_root; File.expand_path(File.dirname(__FILE__)); end
|
|
9
13
|
def self.banner; "padrino-gen mailer [name]"; end
|
|
@@ -4,6 +4,10 @@ module Padrino
|
|
|
4
4
|
module Generators
|
|
5
5
|
|
|
6
6
|
class Migration < Thor::Group
|
|
7
|
+
|
|
8
|
+
# Add this generator to our padrino-gen
|
|
9
|
+
Padrino::Generators.add_generator(:migration, self)
|
|
10
|
+
|
|
7
11
|
# Define the source template root
|
|
8
12
|
def self.source_root; File.expand_path(File.dirname(__FILE__)); end
|
|
9
13
|
def self.banner; "padrino-gen migration [name] [fields]"; end
|
|
@@ -4,6 +4,10 @@ module Padrino
|
|
|
4
4
|
module Generators
|
|
5
5
|
|
|
6
6
|
class Model < Thor::Group
|
|
7
|
+
|
|
8
|
+
# Add this generator to our padrino-gen
|
|
9
|
+
Padrino::Generators.add_generator(:model, self)
|
|
10
|
+
|
|
7
11
|
# Define the source template root
|
|
8
12
|
def self.source_root; File.expand_path(File.dirname(__FILE__)); end
|
|
9
13
|
def self.banner; "padrino-gen model [name] [fields]"; end
|
data/lib/padrino-gen.rb
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
require 'padrino-core/support_lite'
|
|
2
|
-
Dir[File.dirname(__FILE__) +
|
|
3
|
-
require File.dirname(__FILE__) +
|
|
4
|
-
|
|
2
|
+
Dir[File.dirname(__FILE__) + '/padrino-gen/generators/{components}/**/*.rb'].each { |lib| require lib }
|
|
3
|
+
require File.dirname(__FILE__) + '/padrino-gen/generators/actions.rb'
|
|
4
|
+
require File.dirname(__FILE__) + '/padrino-gen/generators/base.rb'
|
|
5
|
+
|
|
6
|
+
module Padrino
|
|
7
|
+
module Generators
|
|
8
|
+
|
|
9
|
+
class << self
|
|
10
|
+
def load_paths
|
|
11
|
+
@load_paths ||= Dir[File.dirname(__FILE__) + '/padrino-gen/generators/{app,mailer,controller,model,migration}.rb']
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def mappings
|
|
15
|
+
@mappings ||= SupportLite::OrderedHash.new
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def add_generator(name, klass)
|
|
19
|
+
mappings[name] = klass
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def lockup!
|
|
23
|
+
load_paths.each { |lib| require lib }
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
data/padrino-gen.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{padrino-gen}
|
|
8
|
-
s.version = "0.2.
|
|
8
|
+
s.version = "0.2.5"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
|
|
12
|
-
s.date = %q{2009-12-
|
|
12
|
+
s.date = %q{2009-12-21}
|
|
13
13
|
s.default_executable = %q{padrino-gen}
|
|
14
14
|
s.description = %q{Generators for easily creating and building padrino applications from the console}
|
|
15
15
|
s.email = %q{nesquena@gmail.com}
|
|
@@ -25,64 +25,66 @@ Gem::Specification.new do |s|
|
|
|
25
25
|
"Rakefile",
|
|
26
26
|
"VERSION",
|
|
27
27
|
"bin/padrino-gen",
|
|
28
|
-
"lib/generators/actions.rb",
|
|
29
|
-
"lib/generators/components/actions.rb",
|
|
30
|
-
"lib/generators/components/mocks/mocha_gen.rb",
|
|
31
|
-
"lib/generators/components/mocks/rr_gen.rb",
|
|
32
|
-
"lib/generators/components/orms/activerecord_gen.rb",
|
|
33
|
-
"lib/generators/components/orms/couchrest_gen.rb",
|
|
34
|
-
"lib/generators/components/orms/datamapper_gen.rb",
|
|
35
|
-
"lib/generators/components/orms/mongomapper_gen.rb",
|
|
36
|
-
"lib/generators/components/orms/sequel_gen.rb",
|
|
37
|
-
"lib/generators/components/renderers/erb_gen.rb",
|
|
38
|
-
"lib/generators/components/renderers/haml_gen.rb",
|
|
39
|
-
"lib/generators/components/scripts/jquery_gen.rb",
|
|
40
|
-
"lib/generators/components/scripts/prototype_gen.rb",
|
|
41
|
-
"lib/generators/components/scripts/rightjs_gen.rb",
|
|
42
|
-
"lib/generators/components/tests/bacon_test_gen.rb",
|
|
43
|
-
"lib/generators/components/tests/riot_test_gen.rb",
|
|
44
|
-
"lib/generators/components/tests/rspec_test_gen.rb",
|
|
45
|
-
"lib/generators/components/tests/shoulda_test_gen.rb",
|
|
46
|
-
"lib/generators/components/tests/testspec_test_gen.rb",
|
|
47
|
-
"lib/generators/controller.rb",
|
|
48
|
-
"lib/generators/mailer.rb",
|
|
49
|
-
"lib/generators/migration.rb",
|
|
50
|
-
"lib/generators/model.rb",
|
|
51
|
-
"lib/generators/skeleton.rb",
|
|
52
|
-
"lib/generators/skeleton/.gitignore",
|
|
53
|
-
"lib/generators/skeleton/Gemfile",
|
|
54
|
-
"lib/generators/skeleton/app/.empty_directory",
|
|
55
|
-
"lib/generators/skeleton/app/app.rb.tt",
|
|
56
|
-
"lib/generators/skeleton/app/controllers/.empty_directory",
|
|
57
|
-
"lib/generators/skeleton/app/helpers/.empty_directory",
|
|
58
|
-
"lib/generators/skeleton/app/views/.empty_directory",
|
|
59
|
-
"lib/generators/skeleton/config.ru",
|
|
60
|
-
"lib/generators/skeleton/config/apps.rb.tt",
|
|
61
|
-
"lib/generators/skeleton/config/boot.rb",
|
|
62
|
-
"lib/generators/skeleton/config/initializers/.empty_directory",
|
|
63
|
-
"lib/generators/skeleton/config/initializers/example.rb",
|
|
64
|
-
"lib/generators/skeleton/config/urls.rb.tt",
|
|
65
|
-
"lib/generators/skeleton/lib/.empty_directory",
|
|
66
|
-
"lib/generators/skeleton/public/images/.empty_directory",
|
|
67
|
-
"lib/generators/skeleton/public/javascripts/.empty_directory",
|
|
68
|
-
"lib/generators/skeleton/public/stylesheets/.empty_directory",
|
|
69
|
-
"lib/generators/skeleton/tmp/.empty_directory",
|
|
70
|
-
"lib/generators/templates/controller.rb.tt",
|
|
71
|
-
"lib/generators/templates/helper.rb.tt",
|
|
72
|
-
"lib/generators/templates/mailer.rb.tt",
|
|
73
|
-
"lib/generators/templates/mailer_initializer.rb.tt",
|
|
74
|
-
"lib/generators/templates/scripts/jquery.js",
|
|
75
|
-
"lib/generators/templates/scripts/lowpro.js",
|
|
76
|
-
"lib/generators/templates/scripts/protopak.js",
|
|
77
|
-
"lib/generators/templates/scripts/right.js",
|
|
78
28
|
"lib/padrino-gen.rb",
|
|
29
|
+
"lib/padrino-gen/generators/actions.rb",
|
|
30
|
+
"lib/padrino-gen/generators/app.rb",
|
|
31
|
+
"lib/padrino-gen/generators/app/.gitignore",
|
|
32
|
+
"lib/padrino-gen/generators/app/Gemfile",
|
|
33
|
+
"lib/padrino-gen/generators/app/app/.empty_directory",
|
|
34
|
+
"lib/padrino-gen/generators/app/app/app.rb.tt",
|
|
35
|
+
"lib/padrino-gen/generators/app/app/controllers/.empty_directory",
|
|
36
|
+
"lib/padrino-gen/generators/app/app/helpers/.empty_directory",
|
|
37
|
+
"lib/padrino-gen/generators/app/app/views/.empty_directory",
|
|
38
|
+
"lib/padrino-gen/generators/app/config.ru",
|
|
39
|
+
"lib/padrino-gen/generators/app/config/apps.rb.tt",
|
|
40
|
+
"lib/padrino-gen/generators/app/config/boot.rb",
|
|
41
|
+
"lib/padrino-gen/generators/app/config/initializers/.empty_directory",
|
|
42
|
+
"lib/padrino-gen/generators/app/config/initializers/example.rb",
|
|
43
|
+
"lib/padrino-gen/generators/app/config/urls.rb.tt",
|
|
44
|
+
"lib/padrino-gen/generators/app/lib/.empty_directory",
|
|
45
|
+
"lib/padrino-gen/generators/app/public/images/.empty_directory",
|
|
46
|
+
"lib/padrino-gen/generators/app/public/javascripts/.empty_directory",
|
|
47
|
+
"lib/padrino-gen/generators/app/public/stylesheets/.empty_directory",
|
|
48
|
+
"lib/padrino-gen/generators/app/tmp/.empty_directory",
|
|
49
|
+
"lib/padrino-gen/generators/base.rb",
|
|
50
|
+
"lib/padrino-gen/generators/components/actions.rb",
|
|
51
|
+
"lib/padrino-gen/generators/components/mocks/mocha_gen.rb",
|
|
52
|
+
"lib/padrino-gen/generators/components/mocks/rr_gen.rb",
|
|
53
|
+
"lib/padrino-gen/generators/components/orms/activerecord_gen.rb",
|
|
54
|
+
"lib/padrino-gen/generators/components/orms/couchrest_gen.rb",
|
|
55
|
+
"lib/padrino-gen/generators/components/orms/datamapper_gen.rb",
|
|
56
|
+
"lib/padrino-gen/generators/components/orms/mongomapper_gen.rb",
|
|
57
|
+
"lib/padrino-gen/generators/components/orms/sequel_gen.rb",
|
|
58
|
+
"lib/padrino-gen/generators/components/renderers/erb_gen.rb",
|
|
59
|
+
"lib/padrino-gen/generators/components/renderers/haml_gen.rb",
|
|
60
|
+
"lib/padrino-gen/generators/components/scripts/jquery_gen.rb",
|
|
61
|
+
"lib/padrino-gen/generators/components/scripts/prototype_gen.rb",
|
|
62
|
+
"lib/padrino-gen/generators/components/scripts/rightjs_gen.rb",
|
|
63
|
+
"lib/padrino-gen/generators/components/tests/bacon_test_gen.rb",
|
|
64
|
+
"lib/padrino-gen/generators/components/tests/riot_test_gen.rb",
|
|
65
|
+
"lib/padrino-gen/generators/components/tests/rspec_test_gen.rb",
|
|
66
|
+
"lib/padrino-gen/generators/components/tests/shoulda_test_gen.rb",
|
|
67
|
+
"lib/padrino-gen/generators/components/tests/testspec_test_gen.rb",
|
|
68
|
+
"lib/padrino-gen/generators/controller.rb",
|
|
69
|
+
"lib/padrino-gen/generators/mailer.rb",
|
|
70
|
+
"lib/padrino-gen/generators/migration.rb",
|
|
71
|
+
"lib/padrino-gen/generators/model.rb",
|
|
72
|
+
"lib/padrino-gen/generators/templates/controller.rb.tt",
|
|
73
|
+
"lib/padrino-gen/generators/templates/helper.rb.tt",
|
|
74
|
+
"lib/padrino-gen/generators/templates/mailer.rb.tt",
|
|
75
|
+
"lib/padrino-gen/generators/templates/mailer_initializer.rb.tt",
|
|
76
|
+
"lib/padrino-gen/generators/templates/scripts/jquery.js",
|
|
77
|
+
"lib/padrino-gen/generators/templates/scripts/lowpro.js",
|
|
78
|
+
"lib/padrino-gen/generators/templates/scripts/protopak.js",
|
|
79
|
+
"lib/padrino-gen/generators/templates/scripts/right.js",
|
|
79
80
|
"padrino-gen.gemspec",
|
|
80
81
|
"test/helper.rb",
|
|
82
|
+
"test/test_app_generator.rb",
|
|
81
83
|
"test/test_controller_generator.rb",
|
|
84
|
+
"test/test_generator.rb",
|
|
82
85
|
"test/test_mailer_generator.rb",
|
|
83
86
|
"test/test_migration_generator.rb",
|
|
84
|
-
"test/test_model_generator.rb"
|
|
85
|
-
"test/test_skeleton_generator.rb"
|
|
87
|
+
"test/test_model_generator.rb"
|
|
86
88
|
]
|
|
87
89
|
s.homepage = %q{http://github.com/padrino/padrino-framework/tree/master/padrino-gen}
|
|
88
90
|
s.rdoc_options = ["--charset=UTF-8"]
|
|
@@ -2,38 +2,43 @@ require File.dirname(__FILE__) + '/helper'
|
|
|
2
2
|
require 'thor'
|
|
3
3
|
require 'fakeweb'
|
|
4
4
|
|
|
5
|
-
class
|
|
5
|
+
class TestAppGenerator < Test::Unit::TestCase
|
|
6
6
|
def setup
|
|
7
|
+
Padrino::Generators.lockup!
|
|
7
8
|
FakeWeb.allow_net_connect = false
|
|
8
9
|
`rm -rf /tmp/sample_app`
|
|
9
|
-
@
|
|
10
|
+
@app = Padrino::Generators::App.dup
|
|
10
11
|
end
|
|
11
12
|
|
|
12
|
-
context 'the
|
|
13
|
+
context 'the App generator' do
|
|
13
14
|
should "allow simple generator to run and create base_app with no options" do
|
|
14
|
-
assert_nothing_raised { silence_logger { @
|
|
15
|
+
assert_nothing_raised { silence_logger { @app.start(['sample_app', '/tmp', '--script=none']) } }
|
|
15
16
|
assert_file_exists('/tmp/sample_app')
|
|
16
17
|
assert_file_exists('/tmp/sample_app/app')
|
|
17
18
|
assert_file_exists('/tmp/sample_app/config/boot.rb')
|
|
18
19
|
assert_dir_exists('/tmp/sample_app/app/models')
|
|
19
20
|
assert_file_exists('/tmp/sample_app/test/test_config.rb')
|
|
20
21
|
end
|
|
22
|
+
|
|
21
23
|
should "not create models folder if no orm is chosen" do
|
|
22
|
-
silence_logger { @
|
|
24
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '--orm=none']) }
|
|
23
25
|
assert_no_dir_exists('/tmp/sample_app/app/models')
|
|
24
26
|
end
|
|
27
|
+
|
|
25
28
|
should "not create tests folder if no test framework is chosen" do
|
|
26
|
-
silence_logger { @
|
|
29
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '--test=none']) }
|
|
27
30
|
assert_no_dir_exists('/tmp/sample_app/test')
|
|
28
31
|
end
|
|
32
|
+
|
|
29
33
|
should "place app specific names into correct files" do
|
|
30
|
-
silence_logger { @
|
|
34
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none']) }
|
|
31
35
|
assert_match_in_file(/class SampleApp < Padrino::Application/m, '/tmp/sample_app/app/app.rb')
|
|
32
36
|
assert_match_in_file(/Padrino.mount_core\("SampleApp"\)/m, '/tmp/sample_app/config/apps.rb')
|
|
33
37
|
assert_match_in_file(/SampleApp.urls do/m, '/tmp/sample_app/config/urls.rb')
|
|
34
38
|
end
|
|
39
|
+
|
|
35
40
|
should "create components file containing options chosen with defaults" do
|
|
36
|
-
silence_logger { @
|
|
41
|
+
silence_logger { @app.start(['sample_app', '/tmp']) }
|
|
37
42
|
components_chosen = YAML.load_file('/tmp/sample_app/.components')
|
|
38
43
|
assert_equal 'datamapper', components_chosen[:orm]
|
|
39
44
|
assert_equal 'bacon', components_chosen[:test]
|
|
@@ -41,9 +46,10 @@ class TestSkeletonGenerator < Test::Unit::TestCase
|
|
|
41
46
|
assert_equal 'jquery', components_chosen[:script]
|
|
42
47
|
assert_equal 'erb', components_chosen[:renderer]
|
|
43
48
|
end
|
|
49
|
+
|
|
44
50
|
should "create components file containing options chosen" do
|
|
45
51
|
component_options = ['--orm=datamapper', '--test=riot', '--mock=mocha', '--script=prototype', '--renderer=erb']
|
|
46
|
-
silence_logger { @
|
|
52
|
+
silence_logger { @app.start(['sample_app', '/tmp', *component_options]) }
|
|
47
53
|
components_chosen = YAML.load_file('/tmp/sample_app/.components')
|
|
48
54
|
assert_equal 'datamapper', components_chosen[:orm]
|
|
49
55
|
assert_equal 'riot', components_chosen[:test]
|
|
@@ -51,17 +57,19 @@ class TestSkeletonGenerator < Test::Unit::TestCase
|
|
|
51
57
|
assert_equal 'prototype', components_chosen[:script]
|
|
52
58
|
assert_equal 'erb', components_chosen[:renderer]
|
|
53
59
|
end
|
|
60
|
+
|
|
54
61
|
should "output to log components being applied" do
|
|
55
62
|
component_options = ['--orm=datamapper', '--test=riot', '--mock=mocha', '--script=prototype', '--renderer=erb']
|
|
56
|
-
buffer = silence_logger { @
|
|
63
|
+
buffer = silence_logger { @app.start(['sample_app', '/tmp', *component_options]) }
|
|
57
64
|
assert_match /Applying.*?datamapper.*?orm/, buffer
|
|
58
65
|
assert_match /Applying.*?riot.*?test/, buffer
|
|
59
66
|
assert_match /Applying.*?mocha.*?mock/, buffer
|
|
60
67
|
assert_match /Applying.*?prototype.*?script/, buffer
|
|
61
68
|
assert_match /Applying.*?erb.*?renderer/, buffer
|
|
62
69
|
end
|
|
70
|
+
|
|
63
71
|
should "output gem files for base app" do
|
|
64
|
-
silence_logger { @
|
|
72
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none']) }
|
|
65
73
|
assert_match_in_file(/gem 'sinatra'/, '/tmp/sample_app/Gemfile')
|
|
66
74
|
assert_match_in_file(/gem 'padrino'/, '/tmp/sample_app/Gemfile')
|
|
67
75
|
assert_match_in_file(/gem 'rack-flash'/, '/tmp/sample_app/Gemfile')
|
|
@@ -71,14 +79,14 @@ class TestSkeletonGenerator < Test::Unit::TestCase
|
|
|
71
79
|
|
|
72
80
|
context "a generator for mock component" do
|
|
73
81
|
should "properly generate for rr" do
|
|
74
|
-
buffer = silence_logger { @
|
|
82
|
+
buffer = silence_logger { @app.start(['sample_app', '/tmp', '--mock=rr', '--script=none']) }
|
|
75
83
|
assert_match /Applying.*?rr.*?mock/, buffer
|
|
76
84
|
assert_match_in_file(/gem 'rr'/, '/tmp/sample_app/Gemfile')
|
|
77
85
|
assert_match_in_file(/include RR::Adapters::RRMethods/m, '/tmp/sample_app/test/test_config.rb')
|
|
78
86
|
end
|
|
79
87
|
|
|
80
88
|
should "properly generate default for mocha" do
|
|
81
|
-
buffer = silence_logger { @
|
|
89
|
+
buffer = silence_logger { @app.start(['sample_app', '/tmp', '--mock=mocha', '--script=none']) }
|
|
82
90
|
assert_match /Applying.*?mocha.*?mock/, buffer
|
|
83
91
|
assert_match_in_file(/gem 'mocha'/, '/tmp/sample_app/Gemfile')
|
|
84
92
|
assert_match_in_file(/include Mocha::API/m, '/tmp/sample_app/test/test_config.rb')
|
|
@@ -87,8 +95,8 @@ class TestSkeletonGenerator < Test::Unit::TestCase
|
|
|
87
95
|
|
|
88
96
|
context "the generator for orm components" do
|
|
89
97
|
should "properly generate for sequel" do
|
|
90
|
-
@
|
|
91
|
-
buffer = silence_logger { @
|
|
98
|
+
@app.instance_eval("undef setup_orm if respond_to?('setup_orm')")
|
|
99
|
+
buffer = silence_logger { @app.start(['sample_app', '/tmp', '--orm=sequel', '--script=none']) }
|
|
92
100
|
assert_match /Applying.*?sequel.*?orm/, buffer
|
|
93
101
|
assert_match_in_file(/gem 'sequel'/, '/tmp/sample_app/Gemfile')
|
|
94
102
|
assert_match_in_file(/Sequel.connect/, '/tmp/sample_app/config/database.rb')
|
|
@@ -96,7 +104,7 @@ class TestSkeletonGenerator < Test::Unit::TestCase
|
|
|
96
104
|
end
|
|
97
105
|
|
|
98
106
|
should "properly generate for activerecord" do
|
|
99
|
-
buffer = silence_logger { @
|
|
107
|
+
buffer = silence_logger { @app.start(['sample_app', '/tmp', '--orm=activerecord', '--script=none']) }
|
|
100
108
|
assert_match /Applying.*?activerecord.*?orm/, buffer
|
|
101
109
|
assert_match_in_file(/gem 'activerecord'/, '/tmp/sample_app/Gemfile')
|
|
102
110
|
assert_match_in_file(/Migrate the database/, '/tmp/sample_app/Rakefile')
|
|
@@ -105,7 +113,7 @@ class TestSkeletonGenerator < Test::Unit::TestCase
|
|
|
105
113
|
end
|
|
106
114
|
|
|
107
115
|
should "properly generate default for datamapper" do
|
|
108
|
-
buffer = silence_logger { @
|
|
116
|
+
buffer = silence_logger { @app.start(['sample_app', '/tmp', '--orm=datamapper', '--script=none']) }
|
|
109
117
|
assert_match /Applying.*?datamapper.*?orm/, buffer
|
|
110
118
|
assert_match_in_file(/gem 'dm-core'/, '/tmp/sample_app/Gemfile')
|
|
111
119
|
assert_match_in_file(/DataMapper.setup/, '/tmp/sample_app/config/database.rb')
|
|
@@ -113,7 +121,7 @@ class TestSkeletonGenerator < Test::Unit::TestCase
|
|
|
113
121
|
end
|
|
114
122
|
|
|
115
123
|
should "properly generate for mongomapper" do
|
|
116
|
-
buffer = silence_logger { @
|
|
124
|
+
buffer = silence_logger { @app.start(['sample_app', '/tmp', '--orm=mongomapper', '--script=none']) }
|
|
117
125
|
assert_match /Applying.*?mongomapper.*?orm/, buffer
|
|
118
126
|
assert_match_in_file(/gem 'mongo_mapper'/, '/tmp/sample_app/Gemfile')
|
|
119
127
|
assert_match_in_file(/MongoMapper.database/, '/tmp/sample_app/config/database.rb')
|
|
@@ -121,7 +129,7 @@ class TestSkeletonGenerator < Test::Unit::TestCase
|
|
|
121
129
|
end
|
|
122
130
|
|
|
123
131
|
should "properly generate for couchrest" do
|
|
124
|
-
buffer = silence_logger { @
|
|
132
|
+
buffer = silence_logger { @app.start(['sample_app', '/tmp', '--orm=couchrest', '--script=none']) }
|
|
125
133
|
assert_match /Applying.*?couchrest.*?orm/, buffer
|
|
126
134
|
assert_match_in_file(/gem 'couchrest'/, '/tmp/sample_app/Gemfile')
|
|
127
135
|
assert_match_in_file(/CouchRest.database!/, '/tmp/sample_app/config/database.rb')
|
|
@@ -131,13 +139,13 @@ class TestSkeletonGenerator < Test::Unit::TestCase
|
|
|
131
139
|
|
|
132
140
|
context "the generator for renderer component" do
|
|
133
141
|
should "properly generate default for erb" do
|
|
134
|
-
buffer = silence_logger { @
|
|
142
|
+
buffer = silence_logger { @app.start(['sample_app', '/tmp', '--renderer=erb', '--script=none']) }
|
|
135
143
|
assert_match /Applying.*?erb.*?renderer/, buffer
|
|
136
144
|
assert_match_in_file(/gem 'erubis'/, '/tmp/sample_app/Gemfile')
|
|
137
145
|
end
|
|
138
146
|
|
|
139
147
|
should "properly generate for haml" do
|
|
140
|
-
buffer = silence_logger { @
|
|
148
|
+
buffer = silence_logger { @app.start(['sample_app', '/tmp', '--renderer=haml','--script=none']) }
|
|
141
149
|
assert_match /Applying.*?haml.*?renderer/, buffer
|
|
142
150
|
assert_match_in_file(/gem 'haml'/, '/tmp/sample_app/Gemfile')
|
|
143
151
|
assert_match_in_file(/module SassInitializer.*Sass::Plugin::Rack/m, '/tmp/sample_app/config/initializers/sass.rb')
|
|
@@ -147,14 +155,14 @@ class TestSkeletonGenerator < Test::Unit::TestCase
|
|
|
147
155
|
|
|
148
156
|
context "the generator for script component" do
|
|
149
157
|
should "properly generate for jquery" do
|
|
150
|
-
buffer = silence_logger { @
|
|
158
|
+
buffer = silence_logger { @app.start(['sample_app', '/tmp', '--script=jquery']) }
|
|
151
159
|
assert_match /Applying.*?jquery.*?script/, buffer
|
|
152
160
|
assert_file_exists('/tmp/sample_app/public/javascripts/jquery.js')
|
|
153
161
|
assert_file_exists('/tmp/sample_app/public/javascripts/application.js')
|
|
154
162
|
end
|
|
155
163
|
|
|
156
164
|
should "properly generate for prototype" do
|
|
157
|
-
buffer = silence_logger { @
|
|
165
|
+
buffer = silence_logger { @app.start(['sample_app', '/tmp', '--script=prototype']) }
|
|
158
166
|
assert_match /Applying.*?prototype.*?script/, buffer
|
|
159
167
|
assert_file_exists('/tmp/sample_app/public/javascripts/protopak.js')
|
|
160
168
|
assert_file_exists('/tmp/sample_app/public/javascripts/lowpro.js')
|
|
@@ -162,7 +170,7 @@ class TestSkeletonGenerator < Test::Unit::TestCase
|
|
|
162
170
|
end
|
|
163
171
|
|
|
164
172
|
should "properly generate for rightjs" do
|
|
165
|
-
buffer = silence_logger { @
|
|
173
|
+
buffer = silence_logger { @app.start(['sample_app', '/tmp', '--script=rightjs']) }
|
|
166
174
|
assert_match /Applying.*?rightjs.*?script/, buffer
|
|
167
175
|
assert_file_exists('/tmp/sample_app/public/javascripts/right.js')
|
|
168
176
|
assert_file_exists('/tmp/sample_app/public/javascripts/application.js')
|
|
@@ -171,7 +179,7 @@ class TestSkeletonGenerator < Test::Unit::TestCase
|
|
|
171
179
|
|
|
172
180
|
context "the generator for test component" do
|
|
173
181
|
should "properly default generate for bacon" do
|
|
174
|
-
buffer = silence_logger { @
|
|
182
|
+
buffer = silence_logger { @app.start(['sample_app', '/tmp', '--test=bacon', '--script=none']) }
|
|
175
183
|
assert_match /Applying.*?bacon.*?test/, buffer
|
|
176
184
|
assert_match_in_file(/gem 'bacon'/, '/tmp/sample_app/Gemfile')
|
|
177
185
|
assert_match_in_file(/Bundler.require_env\(:testing\)/, '/tmp/sample_app/test/test_config.rb')
|
|
@@ -179,7 +187,7 @@ class TestSkeletonGenerator < Test::Unit::TestCase
|
|
|
179
187
|
end
|
|
180
188
|
|
|
181
189
|
should "properly generate for riot" do
|
|
182
|
-
buffer = silence_logger { @
|
|
190
|
+
buffer = silence_logger { @app.start(['sample_app', '/tmp', '--test=riot', '--script=none']) }
|
|
183
191
|
assert_match /Applying.*?riot.*?test/, buffer
|
|
184
192
|
assert_match_in_file(/gem 'riot'/, '/tmp/sample_app/Gemfile')
|
|
185
193
|
assert_match_in_file(/Bundler.require_env\(:testing\)/, '/tmp/sample_app/test/test_config.rb')
|
|
@@ -187,7 +195,7 @@ class TestSkeletonGenerator < Test::Unit::TestCase
|
|
|
187
195
|
end
|
|
188
196
|
|
|
189
197
|
should "properly generate for rspec" do
|
|
190
|
-
buffer = silence_logger { @
|
|
198
|
+
buffer = silence_logger { @app.start(['sample_app', '/tmp', '--test=rspec', '--script=none']) }
|
|
191
199
|
assert_match /Applying.*?rspec.*?test/, buffer
|
|
192
200
|
assert_match_in_file(/gem 'rspec'.*?:require_as => "spec"/, '/tmp/sample_app/Gemfile')
|
|
193
201
|
assert_match_in_file(/Bundler.require_env\(:testing\)/, '/tmp/sample_app/test/test_config.rb')
|
|
@@ -195,7 +203,7 @@ class TestSkeletonGenerator < Test::Unit::TestCase
|
|
|
195
203
|
end
|
|
196
204
|
|
|
197
205
|
should "properly generate for shoulda" do
|
|
198
|
-
buffer = silence_logger { @
|
|
206
|
+
buffer = silence_logger { @app.start(['sample_app', '/tmp', '--test=shoulda', '--script=none']) }
|
|
199
207
|
assert_match /Applying.*?shoulda.*?test/, buffer
|
|
200
208
|
assert_match_in_file(/gem 'shoulda'/, '/tmp/sample_app/Gemfile')
|
|
201
209
|
assert_match_in_file(/Bundler.require_env\(:testing\)/, '/tmp/sample_app/test/test_config.rb')
|
|
@@ -203,7 +211,7 @@ class TestSkeletonGenerator < Test::Unit::TestCase
|
|
|
203
211
|
end
|
|
204
212
|
|
|
205
213
|
should "properly generate for testspec" do
|
|
206
|
-
buffer = silence_logger { @
|
|
214
|
+
buffer = silence_logger { @app.start(['sample_app', '/tmp', '--test=testspec', '--script=none']) }
|
|
207
215
|
assert_match /Applying.*?testspec.*?test/, buffer
|
|
208
216
|
assert_match_in_file(/gem 'test\/spec'/, '/tmp/sample_app/Gemfile')
|
|
209
217
|
assert_match_in_file(/Bundler.require_env\(:testing\)/, '/tmp/sample_app/test/test_config.rb')
|
|
@@ -3,7 +3,8 @@ require 'thor'
|
|
|
3
3
|
|
|
4
4
|
class TestControllerGenerator < Test::Unit::TestCase
|
|
5
5
|
def setup
|
|
6
|
-
|
|
6
|
+
Padrino::Generators.lockup!
|
|
7
|
+
@app = Padrino::Generators::App.dup
|
|
7
8
|
@contgen = Padrino::Generators::Controller.dup
|
|
8
9
|
@controller_path = '/tmp/sample_app/app/controllers/demo_items.rb'
|
|
9
10
|
@controller_test_path = '/tmp/sample_app/test/controllers/demo_items_controller_test.rb'
|
|
@@ -19,7 +20,7 @@ class TestControllerGenerator < Test::Unit::TestCase
|
|
|
19
20
|
end
|
|
20
21
|
|
|
21
22
|
should "generate controller within existing application" do
|
|
22
|
-
silence_logger { @
|
|
23
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon']) }
|
|
23
24
|
silence_logger { @contgen.start(['demo_items', '-r=/tmp/sample_app']) }
|
|
24
25
|
assert_match_in_file(/SampleApp.controllers do/m, @controller_path)
|
|
25
26
|
assert_match_in_file(/SampleApp.helpers do/m, '/tmp/sample_app/app/helpers/demo_items_helper.rb')
|
|
@@ -27,31 +28,31 @@ class TestControllerGenerator < Test::Unit::TestCase
|
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
should "generate controller test for bacon" do
|
|
30
|
-
silence_logger { @
|
|
31
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon']) }
|
|
31
32
|
silence_logger { @contgen.start(['demo_items', '-r=/tmp/sample_app']) }
|
|
32
33
|
assert_match_in_file(/describe "DemoItemsController" do/m, @controller_test_path)
|
|
33
34
|
end
|
|
34
35
|
|
|
35
36
|
should "generate controller test for riot" do
|
|
36
|
-
silence_logger { @
|
|
37
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=riot']) }
|
|
37
38
|
silence_logger { @contgen.start(['demo_items', '-r=/tmp/sample_app']) }
|
|
38
39
|
assert_match_in_file(/context "DemoItemsController" do/m, @controller_test_path)
|
|
39
40
|
end
|
|
40
41
|
|
|
41
42
|
should "generate controller test for testspec" do
|
|
42
|
-
silence_logger { @
|
|
43
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=testspec']) }
|
|
43
44
|
silence_logger { @contgen.start(['demo_items', '-r=/tmp/sample_app']) }
|
|
44
45
|
assert_match_in_file(/context "DemoItemsController" do/m, @controller_test_path)
|
|
45
46
|
end
|
|
46
47
|
|
|
47
48
|
should "generate controller test for rspec" do
|
|
48
|
-
silence_logger { @
|
|
49
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=rspec']) }
|
|
49
50
|
silence_logger { @contgen.start(['demo_items', '-r=/tmp/sample_app']) }
|
|
50
51
|
assert_match_in_file(/describe "DemoItemsController" do/m, '/tmp/sample_app/test/controllers/demo_items_controller_spec.rb')
|
|
51
52
|
end
|
|
52
53
|
|
|
53
54
|
should "generate controller test for shoulda" do
|
|
54
|
-
silence_logger { @
|
|
55
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=shoulda']) }
|
|
55
56
|
silence_logger { @contgen.start(['demo_items', '-r=/tmp/sample_app']) }
|
|
56
57
|
expected_pattern = /class DemoItemsControllerTest < Test::Unit::TestCase/m
|
|
57
58
|
assert_match_in_file(expected_pattern, @controller_test_path)
|
|
@@ -60,14 +61,14 @@ class TestControllerGenerator < Test::Unit::TestCase
|
|
|
60
61
|
# Controller action generation
|
|
61
62
|
|
|
62
63
|
should "generate actions for get:test post:yada" do
|
|
63
|
-
silence_logger { @
|
|
64
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=shoulda'])}
|
|
64
65
|
silence_logger { @contgen.start(['demo_items', "get:test","post:yada",'-r=/tmp/sample_app']) }
|
|
65
66
|
assert_match_in_file(/get :test do\n end\n/m,@controller_path)
|
|
66
67
|
assert_match_in_file(/post :yada do\n end\n/m,@controller_path)
|
|
67
68
|
end
|
|
68
69
|
|
|
69
70
|
should "generate url routes for get:yoda post:yada" do
|
|
70
|
-
silence_logger { @
|
|
71
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=shoulda'])}
|
|
71
72
|
silence_logger { @contgen.start(['demo_items', "get:yoda","post:yada",'-r=/tmp/sample_app']) }
|
|
72
73
|
assert_match_in_file(/map\(\:yoda\).to\(\"\/demo_items\/yoda\"\)/m,@route_path)
|
|
73
74
|
assert_match_in_file(/map\(\:yada\).to\(\"\/demo_items\/yada\"\)/m,@route_path)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/helper'
|
|
2
|
+
|
|
3
|
+
class TestGenerator < Test::Unit::TestCase
|
|
4
|
+
def setup
|
|
5
|
+
Padrino::Generators.lockup!
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
context "the generator" do
|
|
9
|
+
should "have default generators" do
|
|
10
|
+
%w{controller mailer migration model app}.each do |gen|
|
|
11
|
+
assert Padrino::Generators.mappings.has_key?(gen.to_sym)
|
|
12
|
+
assert_equal "Padrino::Generators::#{gen.classify}", Padrino::Generators.mappings[gen.to_sym].name
|
|
13
|
+
assert Padrino::Generators.mappings[gen.to_sym].respond_to?(:start)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|