padrino-gen 0.9.6 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +29 -28
- data/VERSION +1 -1
- data/lib/padrino-gen/generators/actions.rb +3 -3
- data/lib/padrino-gen/generators/app/app.rb.tt +5 -6
- data/lib/padrino-gen/generators/app.rb +6 -8
- data/lib/padrino-gen/generators/cli.rb +2 -2
- data/lib/padrino-gen/generators/components/actions.rb +6 -6
- data/lib/padrino-gen/generators/components/mocks/mocha_gen.rb +1 -1
- data/lib/padrino-gen/generators/components/mocks/rr_gen.rb +2 -2
- data/lib/padrino-gen/generators/components/orms/activerecord_gen.rb +6 -7
- data/lib/padrino-gen/generators/components/orms/couchrest_gen.rb +6 -6
- data/lib/padrino-gen/generators/components/orms/datamapper_gen.rb +5 -6
- data/lib/padrino-gen/generators/components/orms/mongoid_gen.rb +7 -8
- data/lib/padrino-gen/generators/components/orms/mongomapper_gen.rb +5 -6
- data/lib/padrino-gen/generators/components/orms/sequel_gen.rb +5 -6
- data/lib/padrino-gen/generators/components/renderers/erb_gen.rb +5 -5
- data/lib/padrino-gen/generators/components/renderers/haml_gen.rb +5 -28
- data/lib/padrino-gen/generators/components/scripts/jquery_gen.rb +6 -7
- data/lib/padrino-gen/generators/components/scripts/mootools_gen.rb +6 -7
- data/lib/padrino-gen/generators/components/scripts/prototype_gen.rb +6 -7
- data/lib/padrino-gen/generators/components/scripts/rightjs_gen.rb +6 -6
- data/lib/padrino-gen/generators/components/stylesheets/less_gen.rb +43 -0
- data/lib/padrino-gen/generators/components/stylesheets/sass_gen.rb +35 -0
- data/lib/padrino-gen/generators/components/tests/bacon_test_gen.rb +6 -8
- data/lib/padrino-gen/generators/components/tests/cucumber_test_gen.rb +9 -8
- data/lib/padrino-gen/generators/components/tests/riot_test_gen.rb +7 -9
- data/lib/padrino-gen/generators/components/tests/rspec_test_gen.rb +6 -7
- data/lib/padrino-gen/generators/components/tests/shoulda_test_gen.rb +6 -8
- data/lib/padrino-gen/generators/components/tests/testspec_test_gen.rb +6 -8
- data/lib/padrino-gen/generators/controller.rb +3 -4
- data/lib/padrino-gen/generators/mailer.rb +4 -4
- data/lib/padrino-gen/generators/migration.rb +3 -4
- data/lib/padrino-gen/generators/model.rb +3 -3
- data/lib/padrino-gen/generators/project/config/apps.rb.tt +1 -1
- data/lib/padrino-gen/generators/project.rb +11 -9
- data/lib/padrino-gen/generators/templates/Gemfile.tt +2 -1
- data/lib/padrino-gen/generators/templates/controller.rb.tt +1 -1
- data/lib/padrino-gen/generators/templates/mailer_initializer.rb.tt +1 -1
- data/lib/padrino-gen/padrino-tasks/activerecord.rb +8 -8
- data/lib/padrino-gen/padrino-tasks/datamapper.rb +1 -1
- data/lib/padrino-gen.rb +12 -12
- data/padrino-gen.gemspec +7 -11
- data/test/helper.rb +3 -3
- data/test/test_app_generator.rb +1 -1
- data/test/test_mailer_generator.rb +3 -1
- data/test/test_migration_generator.rb +5 -5
- data/test/test_model_generator.rb +7 -7
- data/test/test_project_generator.rb +27 -8
- metadata +7 -11
- data/lib/padrino-gen/generators/project/app/.empty_directory +0 -0
- data/lib/padrino-gen/generators/project/app/app.rb.tt +0 -37
- data/lib/padrino-gen/generators/project/app/controllers/.empty_directory +0 -0
- data/lib/padrino-gen/generators/project/app/helpers/.empty_directory +0 -0
- data/lib/padrino-gen/generators/project/app/views/.empty_directory +0 -0
- data/lib/padrino-gen/generators/project/app/views/layouts/.emptydirectory +0 -0
@@ -14,7 +14,7 @@ module Padrino
|
|
14
14
|
|
15
15
|
def app
|
16
16
|
# Sinatra < 1.0 always disable sessions for test env
|
17
|
-
# so if you need them it's necessary force the use
|
17
|
+
# so if you need them it's necessary force the use
|
18
18
|
# of Rack::Session::Cookie
|
19
19
|
CLASS_NAME.tap { |app| app.use Rack::Session::Cookie }
|
20
20
|
# You can hanlde all padrino applications using instead:
|
@@ -70,10 +70,8 @@ module Padrino
|
|
70
70
|
bacon_contents = BACON_MODEL_TEST.gsub(/!NAME!/, name.to_s.camelize).gsub(/!DNAME!/, name.downcase.underscore)
|
71
71
|
create_file destination_root("test/models/#{name.to_s.downcase}_test.rb"), bacon_contents, :skip => true
|
72
72
|
end
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
end
|
79
|
-
end
|
73
|
+
end # BaconGen
|
74
|
+
end # Tests
|
75
|
+
end # Components
|
76
|
+
end # Generators
|
77
|
+
end # Padrino
|
@@ -4,18 +4,19 @@ module Padrino
|
|
4
4
|
module Generators
|
5
5
|
module Components
|
6
6
|
module Tests
|
7
|
+
|
7
8
|
module CucumberGen
|
8
9
|
include Padrino::Generators::Components::Tests::RspecGen
|
9
10
|
|
10
11
|
CUCUMBER_SETUP = (<<-TEST).gsub(/^ {10}/, '')
|
11
12
|
PADRINO_ENV = 'test' unless defined?(PADRINO_ENV)
|
12
13
|
require File.dirname(__FILE__) + "/../../config/boot"
|
13
|
-
|
14
|
+
|
14
15
|
require 'capybara/cucumber'
|
15
16
|
require 'spec/expectations'
|
16
17
|
|
17
18
|
# Sinatra < 1.0 always disable sessions for test env
|
18
|
-
# so if you need them it's necessary to force the use
|
19
|
+
# so if you need them it's necessary to force the use
|
19
20
|
# of Rack::Session::Cookie
|
20
21
|
Capybara.app = CLASS_NAME.tap { |app| app.use Rack::Session::Cookie }
|
21
22
|
# You can handle all padrino applications instead using:
|
@@ -30,7 +31,7 @@ module Padrino
|
|
30
31
|
CUCUMBER_FEATURE = (<<-TEST).gsub(/^ {10}/, '')
|
31
32
|
Feature: Addition
|
32
33
|
In order to avoid silly mistakes
|
33
|
-
As a math idiot
|
34
|
+
As a math idiot
|
34
35
|
I want to be told the sum of two numbers
|
35
36
|
|
36
37
|
Scenario: Add two numbers
|
@@ -70,8 +71,8 @@ module Padrino
|
|
70
71
|
end
|
71
72
|
|
72
73
|
alias_method_chain :setup_test, :cucumber
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
74
|
+
end # CucumberGen
|
75
|
+
end # Tests
|
76
|
+
end # Components
|
77
|
+
end # Generators
|
78
|
+
end # Padrino
|
@@ -13,7 +13,7 @@ module Padrino
|
|
13
13
|
|
14
14
|
def app
|
15
15
|
# Sinatra < 1.0 always disable sessions for test env
|
16
|
-
# so if you need them it's necessary force the use
|
16
|
+
# so if you need them it's necessary force the use
|
17
17
|
# of Rack::Session::Cookie
|
18
18
|
CLASS_NAME.tap { |app| app.use Rack::Session::Cookie }
|
19
19
|
# You can hanlde all padrino applications using instead:
|
@@ -50,7 +50,7 @@ module Padrino
|
|
50
50
|
|
51
51
|
context "!NAME! Model" do
|
52
52
|
context 'can be created' do
|
53
|
-
setup do
|
53
|
+
setup do
|
54
54
|
@!DNAME! = !NAME!.new
|
55
55
|
end
|
56
56
|
|
@@ -75,10 +75,8 @@ module Padrino
|
|
75
75
|
riot_contents = RIOT_MODEL_TEST.gsub(/!NAME!/, name.to_s.camelize).gsub(/!DNAME!/, name.downcase.underscore)
|
76
76
|
create_file destination_root("test/models/#{name.to_s.downcase}_test.rb"), riot_contents, :skip => true
|
77
77
|
end
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
end
|
84
|
-
end
|
78
|
+
end # RiotGen
|
79
|
+
end # Tests
|
80
|
+
end # Components
|
81
|
+
end # Generators
|
82
|
+
end # Padrino
|
@@ -2,8 +2,8 @@ module Padrino
|
|
2
2
|
module Generators
|
3
3
|
module Components
|
4
4
|
module Tests
|
5
|
-
module RspecGen
|
6
5
|
|
6
|
+
module RspecGen
|
7
7
|
unless defined?(RSPEC_SETUP)
|
8
8
|
RSPEC_SETUP = (<<-TEST).gsub(/^ {12}/, '')
|
9
9
|
PADRINO_ENV = 'test' unless defined?(PADRINO_ENV)
|
@@ -80,9 +80,8 @@ module Padrino
|
|
80
80
|
rspec_contents = RSPEC_MODEL_TEST.gsub(/!NAME!/, name.to_s.camelize).gsub(/!DNAME!/, name.downcase.underscore)
|
81
81
|
create_file destination_root("spec/models/#{name.to_s.downcase}_spec.rb"), rspec_contents, :skip => true
|
82
82
|
end
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
end
|
83
|
+
end # RspecGen
|
84
|
+
end # Tests
|
85
|
+
end # Components
|
86
|
+
end # Generators
|
87
|
+
end # Padrino
|
@@ -13,7 +13,7 @@ module Padrino
|
|
13
13
|
|
14
14
|
def app
|
15
15
|
# Sinatra < 1.0 always disable sessions for test env
|
16
|
-
# so if you need them it's necessary force the use
|
16
|
+
# so if you need them it's necessary force the use
|
17
17
|
# of Rack::Session::Cookie
|
18
18
|
CLASS_NAME.tap { |app| app.use Rack::Session::Cookie }
|
19
19
|
# You can hanlde all padrino applications using instead:
|
@@ -76,10 +76,8 @@ module Padrino
|
|
76
76
|
shoulda_contents = SHOULDA_MODEL_TEST.gsub(/!NAME!/, name.to_s.camelize).gsub(/!DNAME!/, name.downcase.underscore)
|
77
77
|
create_file destination_root("test/models/#{name.to_s.downcase}_test.rb"), shoulda_contents, :skip => true
|
78
78
|
end
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
end
|
85
|
-
end
|
79
|
+
end # ShouldaGen
|
80
|
+
end # Tests
|
81
|
+
end # Components
|
82
|
+
end # Generators
|
83
|
+
end # Padrino
|
@@ -13,7 +13,7 @@ module Padrino
|
|
13
13
|
|
14
14
|
def app
|
15
15
|
# Sinatra < 1.0 always disable sessions for test env
|
16
|
-
# so if you need them it's necessary force the use
|
16
|
+
# so if you need them it's necessary force the use
|
17
17
|
# of Rack::Session::Cookie
|
18
18
|
CLASS_NAME.tap { |app| app.use Rack::Session::Cookie }
|
19
19
|
# You can hanlde all padrino applications using instead:
|
@@ -69,10 +69,8 @@ module Padrino
|
|
69
69
|
tests_contents = TESTSPEC_MODEL_TEST.gsub(/!NAME!/, name.to_s.camelize).gsub(/!DNAME!/, name.downcase.underscore)
|
70
70
|
create_file destination_root("test/models/#{name.to_s.downcase}_test.rb"), tests_contents, :skip => true
|
71
71
|
end
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
end
|
78
|
-
end
|
72
|
+
end # TestspecGen
|
73
|
+
end # Tests
|
74
|
+
end # Components
|
75
|
+
end # Generators
|
76
|
+
end # Padrino
|
@@ -36,12 +36,12 @@ module Padrino
|
|
36
36
|
@mailer_klass = "#{simple_name.downcase.camelize}Mailer"
|
37
37
|
template "templates/mailer_initializer.rb.tt", destination_root("lib/mailer.rb"), :skip => true
|
38
38
|
template "templates/mailer.rb.tt", destination_root(app, "mailers", "#{@mailer_basename}.rb")
|
39
|
+
inject_into_file(destination_root(app, "app.rb"), " register MailerInitializer\n", :after => "configure do\n")
|
39
40
|
empty_directory destination_root(app, 'views', @mailer_basename)
|
40
41
|
else
|
41
42
|
say "You are not at the root of a Padrino application! (config/boot.rb not found)" and return unless in_app_root?
|
42
43
|
end
|
43
44
|
end
|
44
|
-
end
|
45
|
-
|
46
|
-
|
47
|
-
end
|
45
|
+
end # Mailer
|
46
|
+
end # Generators
|
47
|
+
end # Padrino
|
@@ -6,7 +6,7 @@ You can mount additional applications using any of these below:
|
|
6
6
|
Padrino.mount("blog").to('/blog')
|
7
7
|
Padrino.mount("blog", :app_class => "BlogApp").to('/blog')
|
8
8
|
Padrino.mount("blog", :app_file => "/path/to/blog/app.rb").to('/blog')
|
9
|
-
|
9
|
+
|
10
10
|
Note that mounted apps by default should be placed into 'apps/app_name'.
|
11
11
|
|
12
12
|
By default, this file simply mounts the core app which was generated with this project.
|
@@ -25,20 +25,22 @@ module Padrino
|
|
25
25
|
class_option :dev, :desc => "Use padrino from a git checkout", :default => false, :type => :boolean
|
26
26
|
|
27
27
|
# Definitions for the available customizable components
|
28
|
-
component_option :orm,
|
29
|
-
component_option :test,
|
30
|
-
component_option :mock,
|
31
|
-
component_option :script,
|
32
|
-
component_option :renderer,
|
28
|
+
component_option :orm, "database engine", :aliases => '-d', :choices => [:activerecord, :datamapper, :mongomapper, :mongoid, :sequel, :couchrest], :default => :none
|
29
|
+
component_option :test, "testing framework", :aliases => '-t', :choices => [:rspec, :shoulda, :cucumber, :bacon, :testspec, :riot], :default => :rspec
|
30
|
+
component_option :mock, "mocking library", :aliases => '-m', :choices => [:mocha, :rr], :default => :none
|
31
|
+
component_option :script, "javascript library", :aliases => '-s', :choices => [:jquery, :prototype, :rightjs, :mootools], :default => :none
|
32
|
+
component_option :renderer, "template engine", :aliases => '-e', :choices => [:haml, :erb], :default => :haml
|
33
|
+
component_option :stylesheet, "stylesheet engine", :aliases => '-c', :choices => [:less, :sass], :default => :none
|
33
34
|
|
34
35
|
# Show help if no argv given
|
35
36
|
require_arguments!
|
36
37
|
|
37
38
|
# Copies over the Padrino base application App
|
38
39
|
def setup_project
|
39
|
-
@class_name = name.underscore.classify
|
40
|
+
@class_name = name.gsub(/\W/, "_").underscore.classify
|
40
41
|
self.destination_root = File.join(options[:root], name)
|
41
42
|
directory("project/", destination_root)
|
43
|
+
directory("app/", destination_root("app/"))
|
42
44
|
store_component_config('.components')
|
43
45
|
template "templates/Gemfile.tt", destination_root("Gemfile")
|
44
46
|
end
|
@@ -72,6 +74,6 @@ module Padrino
|
|
72
74
|
|
73
75
|
TEXT
|
74
76
|
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
77
|
+
end # Project
|
78
|
+
end # Generators
|
79
|
+
end # Padrino
|
@@ -1,6 +1,6 @@
|
|
1
1
|
=begin
|
2
2
|
|
3
|
-
By default, Padrino mailer uses the built-in sendmail binary functionality on the server.
|
3
|
+
By default, Padrino mailer uses the built-in sendmail binary functionality on the server.
|
4
4
|
However, smtp is also supported using the following configuration if needed:
|
5
5
|
|
6
6
|
=end
|
@@ -305,7 +305,7 @@ if defined?(ActiveRecord)
|
|
305
305
|
desc "Use schema.rb to auto-upgrade"
|
306
306
|
task :upgrade => :environment do
|
307
307
|
AutoMigrations.run
|
308
|
-
end
|
308
|
+
end
|
309
309
|
end
|
310
310
|
|
311
311
|
desc "Generates .yml files for I18n translations."
|
@@ -377,10 +377,10 @@ if defined?(ActiveRecord)
|
|
377
377
|
|
378
378
|
##
|
379
379
|
# Padrino plugin for automating migrations
|
380
|
-
#
|
380
|
+
#
|
381
381
|
# Thanks to:: PJ Hyett
|
382
382
|
# Original Repo:: http://github.com/pjhyett/auto_migrations
|
383
|
-
#
|
383
|
+
#
|
384
384
|
module AutoMigrations
|
385
385
|
|
386
386
|
def self.run
|
@@ -406,13 +406,13 @@ if defined?(ActiveRecord)
|
|
406
406
|
schema_in.gsub!(/#(.)+\n/, '')
|
407
407
|
schema_in.sub!(/ActiveRecord::Schema.define(.+)do[ ]?\n/, '')
|
408
408
|
schema_in.gsub!(/^/, ' ')
|
409
|
-
schema = "class InitialSchema < ActiveRecord::Migration\n def self.up\n"
|
409
|
+
schema = "class InitialSchema < ActiveRecord::Migration\n def self.up\n"
|
410
410
|
schema += " # We're resetting the migrations database...\n" +
|
411
411
|
" drop_table :schema_migrations\n" +
|
412
412
|
" initialize_schema_migrations_table\n\n" if with_reset
|
413
413
|
schema += schema_in
|
414
414
|
schema << "\n def self.down\n"
|
415
|
-
schema << (ActiveRecord::Base.connection.tables - %w(schema_info schema_migrations)).map do |table|
|
415
|
+
schema << (ActiveRecord::Base.connection.tables - %w(schema_info schema_migrations)).map do |table|
|
416
416
|
" drop_table :#{table}\n"
|
417
417
|
end.join
|
418
418
|
schema << " end\nend\n"
|
@@ -439,12 +439,12 @@ if defined?(ActiveRecord)
|
|
439
439
|
when :add_index
|
440
440
|
auto_add_index(method, *args, &block)
|
441
441
|
else
|
442
|
-
method_missing_without_auto_migration(method, *args, &block)
|
442
|
+
method_missing_without_auto_migration(method, *args, &block)
|
443
443
|
end
|
444
444
|
end
|
445
445
|
|
446
446
|
def auto_create_table(method, *args, &block)
|
447
|
-
table_name = args.shift.to_s
|
447
|
+
table_name = args.shift.to_s
|
448
448
|
options = args.pop || {}
|
449
449
|
|
450
450
|
(self.tables_in_schema ||= []) << table_name
|
@@ -517,7 +517,7 @@ if defined?(ActiveRecord)
|
|
517
517
|
end
|
518
518
|
end
|
519
519
|
|
520
|
-
def auto_add_index(method, *args, &block)
|
520
|
+
def auto_add_index(method, *args, &block)
|
521
521
|
table_name = args.shift.to_s
|
522
522
|
fields = Array(args.shift).map(&:to_s)
|
523
523
|
options = args.shift
|
data/lib/padrino-gen.rb
CHANGED
@@ -3,18 +3,18 @@ require 'padrino-core/tasks'
|
|
3
3
|
module Padrino
|
4
4
|
##
|
5
5
|
# This module it's used for register generators
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# Can be useful for 3rd party generators:
|
8
|
-
#
|
8
|
+
#
|
9
9
|
# # custom_generator.rb
|
10
10
|
# class CustomGenerator < Thor::Group
|
11
11
|
# Padrino::Generators.add_generator(:custom_generator, self)
|
12
12
|
# end
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# Now for handle generators in padrino you need to add it to into +load_paths+
|
15
|
-
#
|
15
|
+
#
|
16
16
|
# Padrino::Generators.load_paths << "custom_generator.rb"
|
17
|
-
#
|
17
|
+
#
|
18
18
|
module Generators
|
19
19
|
|
20
20
|
DEV_PATH = File.expand_path("../../", File.dirname(__FILE__))
|
@@ -23,28 +23,28 @@ module Padrino
|
|
23
23
|
|
24
24
|
##
|
25
25
|
# Here we store our generators paths
|
26
|
-
#
|
26
|
+
#
|
27
27
|
def load_paths
|
28
28
|
@_files ||= []
|
29
29
|
end
|
30
30
|
|
31
31
|
##
|
32
32
|
# Return a ordered list of task with their class
|
33
|
-
#
|
33
|
+
#
|
34
34
|
def mappings
|
35
35
|
@_mappings ||= SupportLite::OrderedHash.new
|
36
36
|
end
|
37
37
|
|
38
38
|
##
|
39
39
|
# Gloabl add a new generator class to +padrino-gen+
|
40
|
-
#
|
40
|
+
#
|
41
41
|
def add_generator(name, klass)
|
42
42
|
mappings[name] = klass
|
43
43
|
end
|
44
44
|
|
45
45
|
##
|
46
46
|
# Load Global Actions and Component Actions then all files in +load_path+.
|
47
|
-
#
|
47
|
+
#
|
48
48
|
def load_components!
|
49
49
|
require 'padrino-gen/generators/actions'
|
50
50
|
require 'padrino-gen/generators/components/actions'
|
@@ -57,11 +57,11 @@ module Padrino
|
|
57
57
|
end # Padrino
|
58
58
|
|
59
59
|
##
|
60
|
-
# We add our generators to Padrino::Genererator
|
61
|
-
#
|
60
|
+
# We add our generators to Padrino::Genererator
|
61
|
+
#
|
62
62
|
Padrino::Generators.load_paths << Dir[File.dirname(__FILE__) + '/padrino-gen/generators/{project,app,mailer,controller,model,migration}.rb']
|
63
63
|
|
64
64
|
##
|
65
65
|
# We add our tasks to padrino-core
|
66
|
-
#
|
66
|
+
#
|
67
67
|
Padrino::Tasks.files << Dir[File.dirname(__FILE__) + "/padrino-gen/padrino-tasks/**/*.rb"]
|
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.9.
|
8
|
+
s.version = "0.9.7"
|
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{2010-03-
|
12
|
+
s.date = %q{2010-03-22}
|
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{padrinorb@gmail.com}
|
@@ -48,6 +48,8 @@ Gem::Specification.new do |s|
|
|
48
48
|
"lib/padrino-gen/generators/components/scripts/mootools_gen.rb",
|
49
49
|
"lib/padrino-gen/generators/components/scripts/prototype_gen.rb",
|
50
50
|
"lib/padrino-gen/generators/components/scripts/rightjs_gen.rb",
|
51
|
+
"lib/padrino-gen/generators/components/stylesheets/less_gen.rb",
|
52
|
+
"lib/padrino-gen/generators/components/stylesheets/sass_gen.rb",
|
51
53
|
"lib/padrino-gen/generators/components/tests/bacon_test_gen.rb",
|
52
54
|
"lib/padrino-gen/generators/components/tests/cucumber_test_gen.rb",
|
53
55
|
"lib/padrino-gen/generators/components/tests/riot_test_gen.rb",
|
@@ -60,12 +62,6 @@ Gem::Specification.new do |s|
|
|
60
62
|
"lib/padrino-gen/generators/model.rb",
|
61
63
|
"lib/padrino-gen/generators/project.rb",
|
62
64
|
"lib/padrino-gen/generators/project/.gitignore",
|
63
|
-
"lib/padrino-gen/generators/project/app/.empty_directory",
|
64
|
-
"lib/padrino-gen/generators/project/app/app.rb.tt",
|
65
|
-
"lib/padrino-gen/generators/project/app/controllers/.empty_directory",
|
66
|
-
"lib/padrino-gen/generators/project/app/helpers/.empty_directory",
|
67
|
-
"lib/padrino-gen/generators/project/app/views/.empty_directory",
|
68
|
-
"lib/padrino-gen/generators/project/app/views/layouts/.emptydirectory",
|
69
65
|
"lib/padrino-gen/generators/project/config.ru",
|
70
66
|
"lib/padrino-gen/generators/project/config/apps.rb.tt",
|
71
67
|
"lib/padrino-gen/generators/project/config/boot.rb",
|
@@ -111,7 +107,7 @@ Gem::Specification.new do |s|
|
|
111
107
|
s.specification_version = 3
|
112
108
|
|
113
109
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
114
|
-
s.add_runtime_dependency(%q<padrino-core>, ["= 0.9.
|
110
|
+
s.add_runtime_dependency(%q<padrino-core>, ["= 0.9.7"])
|
115
111
|
s.add_development_dependency(%q<haml>, [">= 2.2.1"])
|
116
112
|
s.add_development_dependency(%q<shoulda>, [">= 2.10.3"])
|
117
113
|
s.add_development_dependency(%q<mocha>, [">= 0.9.7"])
|
@@ -119,7 +115,7 @@ Gem::Specification.new do |s|
|
|
119
115
|
s.add_development_dependency(%q<webrat>, [">= 0.5.1"])
|
120
116
|
s.add_development_dependency(%q<fakeweb>, [">= 1.2.3"])
|
121
117
|
else
|
122
|
-
s.add_dependency(%q<padrino-core>, ["= 0.9.
|
118
|
+
s.add_dependency(%q<padrino-core>, ["= 0.9.7"])
|
123
119
|
s.add_dependency(%q<haml>, [">= 2.2.1"])
|
124
120
|
s.add_dependency(%q<shoulda>, [">= 2.10.3"])
|
125
121
|
s.add_dependency(%q<mocha>, [">= 0.9.7"])
|
@@ -128,7 +124,7 @@ Gem::Specification.new do |s|
|
|
128
124
|
s.add_dependency(%q<fakeweb>, [">= 1.2.3"])
|
129
125
|
end
|
130
126
|
else
|
131
|
-
s.add_dependency(%q<padrino-core>, ["= 0.9.
|
127
|
+
s.add_dependency(%q<padrino-core>, ["= 0.9.7"])
|
132
128
|
s.add_dependency(%q<haml>, [">= 2.2.1"])
|
133
129
|
s.add_dependency(%q<shoulda>, [">= 2.10.3"])
|
134
130
|
s.add_dependency(%q<mocha>, [">= 0.9.7"])
|
data/test/helper.rb
CHANGED
@@ -7,9 +7,9 @@ require 'webrat'
|
|
7
7
|
require 'thor/group'
|
8
8
|
|
9
9
|
# We try to load the vendored padrino-core if exist
|
10
|
-
%w(core).each do |
|
11
|
-
if File.exist?(File.dirname(__FILE__) + "/../../padrino-#{
|
12
|
-
$:.unshift File.dirname(__FILE__) + "/../../padrino-#{
|
10
|
+
%w(core).each do |lib|
|
11
|
+
if File.exist?(File.dirname(__FILE__) + "/../../padrino-#{lib}/lib")
|
12
|
+
$:.unshift File.dirname(__FILE__) + "/../../padrino-#{lib}/lib"
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
data/test/test_app_generator.rb
CHANGED
@@ -47,7 +47,7 @@ class TestAppGenerator < Test::Unit::TestCase
|
|
47
47
|
silence_logger { @mail_gen.start(['demo', '-r=/tmp/sample_project', '-a=demo']) }
|
48
48
|
assert_match_in_file(/class DemoMailer < Padrino::Mailer::Base/m, '/tmp/sample_project/demo/mailers/demo_mailer.rb')
|
49
49
|
assert_match_in_file(/Padrino::Mailer::Base.smtp_settings/m, '/tmp/sample_project/lib/mailer.rb')
|
50
|
-
assert_match_in_file(/register MailerInitializer/,'/tmp/sample_project/
|
50
|
+
assert_match_in_file(/register MailerInitializer/,'/tmp/sample_project/demo/app.rb')
|
51
51
|
assert_file_exists('/tmp/sample_project/demo/views/demo_mailer')
|
52
52
|
end
|
53
53
|
|
@@ -20,6 +20,7 @@ class TestMailerGenerator < Test::Unit::TestCase
|
|
20
20
|
silence_logger { @mail_gen.start(['demo', '-r=/tmp/sample_project']) }
|
21
21
|
assert_match_in_file(/class DemoMailer < Padrino::Mailer::Base/m, '/tmp/sample_project/app/mailers/demo_mailer.rb')
|
22
22
|
assert_match_in_file(/Padrino::Mailer::Base.smtp_settings/m, '/tmp/sample_project/lib/mailer.rb')
|
23
|
+
assert_match_in_file(/register MailerInitializer/m, '/tmp/sample_project/app/app.rb')
|
23
24
|
assert_file_exists('/tmp/sample_project/app/views/demo_mailer')
|
24
25
|
end
|
25
26
|
|
@@ -38,10 +39,11 @@ class TestMailerGenerator < Test::Unit::TestCase
|
|
38
39
|
assert_match_in_file(/Padrino::Mailer::Base.smtp_settings/m, '/tmp/sample_project/lib/mailer.rb')
|
39
40
|
assert_file_exists('/tmp/sample_project/app/views/demo_mailer')
|
40
41
|
end
|
42
|
+
|
41
43
|
end
|
42
44
|
|
43
45
|
context "the mailer destroy option" do
|
44
|
-
|
46
|
+
|
45
47
|
should "destroy mailer file" do
|
46
48
|
silence_logger { @project.start(['sample_project', '--root=/tmp', '--script=none', '-t=bacon']) }
|
47
49
|
silence_logger { @mail_gen.start(['demo', '-r=/tmp/sample_project']) }
|
@@ -168,9 +168,9 @@ class TestMigrationGenerator < Test::Unit::TestCase
|
|
168
168
|
assert_match_in_file(/add_column :age, Integer/m, migration_file_path)
|
169
169
|
end
|
170
170
|
end
|
171
|
-
|
171
|
+
|
172
172
|
context "the migration destroy option" do
|
173
|
-
|
173
|
+
|
174
174
|
should "destroy the migration files" do
|
175
175
|
silence_logger { @project.start(['sample_project', '--root=/tmp', '--script=none', '-t=bacon', '-d=sequel']) }
|
176
176
|
migration_params = ['RemoveEmailFromUsers', "email:string", "age:integer", '-r=/tmp/sample_project']
|
@@ -178,7 +178,7 @@ class TestMigrationGenerator < Test::Unit::TestCase
|
|
178
178
|
silence_logger { @mig_gen.start(['RemoveEmailFromUsers', '-r=/tmp/sample_project','-d']) }
|
179
179
|
assert_no_file_exists("/tmp/sample_project/db/migrate/001_remove_email_from_users.rb")
|
180
180
|
end
|
181
|
-
|
181
|
+
|
182
182
|
should "destroy the migration file regardless of number" do
|
183
183
|
silence_logger { @project.start(['sample_project', '--root=/tmp', '--script=none', '-t=bacon', '-d=sequel']) }
|
184
184
|
migration_params = ['RemoveEmailFromUsers', "email:string", "age:integer", '-r=/tmp/sample_project']
|
@@ -188,7 +188,7 @@ class TestMigrationGenerator < Test::Unit::TestCase
|
|
188
188
|
silence_logger { @mig_gen.start(['RemoveEmailFromUsers', '-r=/tmp/sample_project','-d']) }
|
189
189
|
assert_no_file_exists("/tmp/sample_project/db/migrate/002_remove_email_from_users.rb")
|
190
190
|
end
|
191
|
-
|
191
|
+
|
192
192
|
end
|
193
|
-
|
193
|
+
|
194
194
|
end
|
@@ -102,13 +102,13 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
102
102
|
|
103
103
|
# DATAMAPPER
|
104
104
|
context "model generator using datamapper" do
|
105
|
-
|
105
|
+
|
106
106
|
should "generate gemfile gem" do
|
107
107
|
silence_logger { @project.start(['sample_project', '--root=/tmp', '--script=none', '-d=datamapper']) }
|
108
108
|
silence_logger { @model_gen.start(['user', "name:string", "age:integer", "created_at:datetime", '-r=/tmp/sample_project']) }
|
109
109
|
assert_match_in_file(/gem 'datamapper'/m,'/tmp/sample_project/Gemfile')
|
110
110
|
end
|
111
|
-
|
111
|
+
|
112
112
|
should "generate model file with fields" do
|
113
113
|
silence_logger { @project.start(['sample_project', '--root=/tmp', '--script=none', '-d=datamapper']) }
|
114
114
|
silence_logger { @model_gen.start(['user', "name:string", "age:integer", "created_at:datetime", '-r=/tmp/sample_project']) }
|
@@ -256,9 +256,9 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
256
256
|
assert_match_in_file(/@user\.should\.not\.be\.nil/m, '/tmp/sample_project/test/models/user_test.rb')
|
257
257
|
end
|
258
258
|
end
|
259
|
-
|
259
|
+
|
260
260
|
context "the model destroy option" do
|
261
|
-
|
261
|
+
|
262
262
|
should "destroy the model file" do
|
263
263
|
silence_logger { @project.start(['sample_project', '--root=/tmp', '--script=none', '-t=bacon', '-d=activerecord']) }
|
264
264
|
silence_logger { @model_gen.start(['User', '-r=/tmp/sample_project']) }
|
@@ -267,14 +267,14 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
267
267
|
assert_no_file_exists('/tmp/sample_project/test/models/user_test.rb')
|
268
268
|
assert_no_file_exists('/tmp/sample_project/db/migrate/001_create_users.rb')
|
269
269
|
end
|
270
|
-
|
270
|
+
|
271
271
|
should "destroy the model test file with rspec" do
|
272
272
|
silence_logger { @project.start(['sample_project', '--root=/tmp', '--script=none', '-t=rspec', '-d=activerecord']) }
|
273
273
|
silence_logger { @model_gen.start(['User', '-r=/tmp/sample_project']) }
|
274
274
|
silence_logger { @model_gen.start(['User', '-r=/tmp/sample_project', '-d']) }
|
275
275
|
assert_no_file_exists('/tmp/sample_project/spec/models/user_spec.rb')
|
276
276
|
end
|
277
|
-
|
277
|
+
|
278
278
|
should "destroy the model migration" do
|
279
279
|
silence_logger { @project.start(['sample_project', '--root=/tmp', '--script=none', '-t=rspec', '-d=activerecord']) }
|
280
280
|
silence_logger { @model_gen.start(['Person', '-r=/tmp/sample_project']) }
|
@@ -282,7 +282,7 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
282
282
|
silence_logger { @model_gen.start(['User', '-r=/tmp/sample_project', '-d']) }
|
283
283
|
assert_no_file_exists('/tmp/sample_project/db/migrate/002_create_users.rb')
|
284
284
|
end
|
285
|
-
|
285
|
+
|
286
286
|
end
|
287
287
|
|
288
288
|
end
|