padrino-gen 0.9.9 → 0.9.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. data/README.rdoc +10 -10
  2. data/Rakefile +4 -15
  3. data/bin/padrino-gen +3 -0
  4. data/lib/padrino-gen/generators/actions.rb +10 -4
  5. data/lib/padrino-gen/generators/app/app.rb.tt +2 -2
  6. data/lib/padrino-gen/generators/components/mocks/mocha.rb +9 -0
  7. data/lib/padrino-gen/generators/components/mocks/rr.rb +11 -0
  8. data/lib/padrino-gen/generators/components/orms/activerecord.rb +112 -0
  9. data/lib/padrino-gen/generators/components/orms/couchrest.rb +44 -0
  10. data/lib/padrino-gen/generators/components/orms/datamapper.rb +86 -0
  11. data/lib/padrino-gen/generators/components/orms/mongoid.rb +68 -0
  12. data/lib/padrino-gen/generators/components/orms/mongomapper.rb +43 -0
  13. data/lib/padrino-gen/generators/components/orms/sequel.rb +71 -0
  14. data/lib/padrino-gen/generators/components/renderers/erb.rb +3 -0
  15. data/lib/padrino-gen/generators/components/renderers/haml.rb +3 -0
  16. data/lib/padrino-gen/generators/components/scripts/extcore.rb +4 -0
  17. data/lib/padrino-gen/generators/components/scripts/jquery.rb +4 -0
  18. data/lib/padrino-gen/generators/components/scripts/mootools.rb +4 -0
  19. data/lib/padrino-gen/generators/components/scripts/prototype.rb +5 -0
  20. data/lib/padrino-gen/generators/components/scripts/rightjs.rb +4 -0
  21. data/lib/padrino-gen/generators/components/stylesheets/less.rb +33 -0
  22. data/lib/padrino-gen/generators/components/stylesheets/sass.rb +25 -0
  23. data/lib/padrino-gen/generators/components/tests/bacon.rb +64 -0
  24. data/lib/padrino-gen/generators/components/tests/cucumber.rb +63 -0
  25. data/lib/padrino-gen/generators/components/tests/riot.rb +69 -0
  26. data/lib/padrino-gen/generators/components/tests/rspec.rb +66 -0
  27. data/lib/padrino-gen/generators/components/tests/shoulda.rb +70 -0
  28. data/lib/padrino-gen/generators/components/tests/testspec.rb +63 -0
  29. data/lib/padrino-gen/generators/controller.rb +4 -4
  30. data/lib/padrino-gen/generators/project/config/apps.rb.tt +12 -4
  31. data/lib/padrino-gen/generators/project/config/boot.rb +1 -1
  32. data/lib/padrino-gen/generators/project.rb +1 -1
  33. data/lib/padrino-gen/generators/templates/controller.rb.tt +1 -1
  34. data/lib/padrino-gen/generators/templates/scripts/ext-core.js +8 -0
  35. data/lib/padrino-gen/generators/templates/scripts/jquery.js +150 -15
  36. data/lib/padrino-gen/padrino-tasks/activerecord.rb +1 -1
  37. data/lib/padrino-gen/padrino-tasks/mongomapper.rb +1 -1
  38. data/lib/padrino-gen/padrino-tasks/sequel.rb +37 -0
  39. data/lib/padrino-gen.rb +9 -2
  40. data/padrino-gen.gemspec +30 -28
  41. data/test/helper.rb +5 -0
  42. data/test/test_app_generator.rb +11 -19
  43. data/test/test_cli.rb +4 -6
  44. data/test/test_controller_generator.rb +43 -33
  45. data/test/test_mailer_generator.rb +11 -17
  46. data/test/test_migration_generator.rb +42 -47
  47. data/test/test_model_generator.rb +90 -89
  48. data/test/test_project_generator.rb +43 -39
  49. metadata +30 -28
  50. data/VERSION +0 -1
  51. data/lib/padrino-gen/generators/components/mocks/mocha_gen.rb +0 -20
  52. data/lib/padrino-gen/generators/components/mocks/rr_gen.rb +0 -22
  53. data/lib/padrino-gen/generators/components/orms/activerecord_gen.rb +0 -123
  54. data/lib/padrino-gen/generators/components/orms/couchrest_gen.rb +0 -56
  55. data/lib/padrino-gen/generators/components/orms/datamapper_gen.rb +0 -97
  56. data/lib/padrino-gen/generators/components/orms/mongoid_gen.rb +0 -80
  57. data/lib/padrino-gen/generators/components/orms/mongomapper_gen.rb +0 -55
  58. data/lib/padrino-gen/generators/components/orms/sequel_gen.rb +0 -83
  59. data/lib/padrino-gen/generators/components/renderers/erb_gen.rb +0 -14
  60. data/lib/padrino-gen/generators/components/renderers/haml_gen.rb +0 -15
  61. data/lib/padrino-gen/generators/components/scripts/jquery_gen.rb +0 -15
  62. data/lib/padrino-gen/generators/components/scripts/mootools_gen.rb +0 -15
  63. data/lib/padrino-gen/generators/components/scripts/prototype_gen.rb +0 -16
  64. data/lib/padrino-gen/generators/components/scripts/rightjs_gen.rb +0 -15
  65. data/lib/padrino-gen/generators/components/stylesheets/less_gen.rb +0 -43
  66. data/lib/padrino-gen/generators/components/stylesheets/sass_gen.rb +0 -35
  67. data/lib/padrino-gen/generators/components/tests/bacon_test_gen.rb +0 -75
  68. data/lib/padrino-gen/generators/components/tests/cucumber_test_gen.rb +0 -76
  69. data/lib/padrino-gen/generators/components/tests/riot_test_gen.rb +0 -80
  70. data/lib/padrino-gen/generators/components/tests/rspec_test_gen.rb +0 -85
  71. data/lib/padrino-gen/generators/components/tests/shoulda_test_gen.rb +0 -81
  72. data/lib/padrino-gen/generators/components/tests/testspec_test_gen.rb +0 -74
@@ -1,80 +0,0 @@
1
- module Padrino
2
- module Generators
3
- module Components
4
- module Tests
5
-
6
- module RiotGen
7
- RIOT_SETUP = (<<-TEST).gsub(/^ {10}/, '')
8
- PADRINO_ENV = 'test' unless defined?(PADRINO_ENV)
9
- require File.expand_path(File.dirname(__FILE__) + "/../config/boot")
10
-
11
- class Riot::Situation
12
- include Rack::Test::Methods
13
-
14
- def app
15
- ##
16
- # You can hanlde all padrino applications using instead:
17
- # Padrino.application
18
- CLASS_NAME.tap { |app| }
19
- end
20
- end
21
- TEST
22
-
23
- RIOT_CONTROLLER_TEST = (<<-TEST).gsub(/^ {10}/, '')
24
- require File.expand_path(File.dirname(__FILE__) + '/../test_config.rb')
25
-
26
- context "!NAME!Controller" do
27
- context "description here" do
28
- setup do
29
- get "/"
30
- end
31
-
32
- asserts("the response body") { last_response.body }.equals "Hello World"
33
- end
34
- end
35
- TEST
36
-
37
- RIOT_RAKE = (<<-TEST).gsub(/^ {10}/, '')
38
- require 'rake/testtask'
39
-
40
- Rake::TestTask.new(:test) do |test|
41
- test.pattern = '**/*_test.rb'
42
- test.verbose = true
43
- end
44
- TEST
45
-
46
- RIOT_MODEL_TEST = (<<-TEST).gsub(/^ {10}/, '')
47
- require File.expand_path(File.dirname(__FILE__) + '/../test_config.rb')
48
-
49
- context "!NAME! Model" do
50
- context 'can be created' do
51
- setup do
52
- @!DNAME! = !NAME!.new
53
- end
54
-
55
- asserts("that record is not nil") { !@!DNAME!.nil? }
56
- end
57
- end
58
- TEST
59
-
60
- def setup_test
61
- require_dependencies 'riot', :group => 'test'
62
- insert_test_suite_setup RIOT_SETUP
63
- create_file destination_root("test/test.rake"), RIOT_RAKE
64
- end
65
-
66
- # Generates a controller test given the controllers name
67
- def generate_controller_test(name)
68
- riot_contents = RIOT_CONTROLLER_TEST.gsub(/!NAME!/, name.to_s.camelize)
69
- create_file destination_root("test/controllers/#{name}_controller_test.rb"), riot_contents, :skip => true
70
- end
71
-
72
- def generate_model_test(name)
73
- riot_contents = RIOT_MODEL_TEST.gsub(/!NAME!/, name.to_s.camelize).gsub(/!DNAME!/, name.downcase.underscore)
74
- create_file destination_root("test/models/#{name.to_s.downcase}_test.rb"), riot_contents, :skip => true
75
- end
76
- end # RiotGen
77
- end # Tests
78
- end # Components
79
- end # Generators
80
- end # Padrino
@@ -1,85 +0,0 @@
1
- module Padrino
2
- module Generators
3
- module Components
4
- module Tests
5
-
6
- module RspecGen
7
- unless defined?(RSPEC_SETUP)
8
- RSPEC_SETUP = (<<-TEST).gsub(/^ {12}/, '')
9
- PADRINO_ENV = 'test' unless defined?(PADRINO_ENV)
10
- require File.expand_path(File.dirname(__FILE__) + "/../config/boot")
11
-
12
- Spec::Runner.configure do |conf|
13
- conf.include Rack::Test::Methods
14
- end
15
-
16
- def app
17
- ##
18
- # You can hanlde all padrino applications using instead:
19
- # Padrino.application
20
- CLASS_NAME.tap { |app| }
21
- end
22
- TEST
23
- end
24
-
25
- unless defined?(RSPEC_CONTROLLER_TEST)
26
- RSPEC_CONTROLLER_TEST = (<<-TEST).gsub(/^ {12}/, '')
27
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
28
-
29
- describe "!NAME!Controller" do
30
- before do
31
- get "/"
32
- end
33
-
34
- it "returns hello world" do
35
- last_response.body.should == "Hello World"
36
- end
37
- end
38
- TEST
39
- end
40
-
41
- unless defined?(RSPEC_RAKE)
42
- RSPEC_RAKE = (<<-TEST).gsub(/^ {12}/, '')
43
- require 'spec/rake/spectask'
44
-
45
- Spec::Rake::SpecTask.new(:spec) do |t|
46
- t.spec_files = Dir['**/*_spec.rb']
47
- t.spec_opts = %w(-fs --color)
48
- end
49
- TEST
50
- end
51
-
52
- unless defined?(RSPEC_MODEL_TEST)
53
- RSPEC_MODEL_TEST = (<<-TEST).gsub(/^ {12}/, '')
54
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
55
-
56
- describe "!NAME! Model" do
57
- it 'can be created' do
58
- @!DNAME! = !NAME!.new
59
- @!DNAME!.should_not be_nil
60
- end
61
- end
62
- TEST
63
- end
64
-
65
- def setup_test
66
- require_dependencies 'rspec', :require => 'spec', :group => 'test'
67
- insert_test_suite_setup RSPEC_SETUP, :path => "spec/spec_helper.rb"
68
- create_file destination_root("spec/spec.rake"), RSPEC_RAKE
69
- end
70
-
71
- # Generates a controller test given the controllers name
72
- def generate_controller_test(name)
73
- rspec_contents = RSPEC_CONTROLLER_TEST.gsub(/!NAME!/, name.to_s.camelize)
74
- create_file destination_root("spec/controllers/#{name}_controller_spec.rb"), rspec_contents, :skip => true
75
- end
76
-
77
- def generate_model_test(name)
78
- rspec_contents = RSPEC_MODEL_TEST.gsub(/!NAME!/, name.to_s.camelize).gsub(/!DNAME!/, name.downcase.underscore)
79
- create_file destination_root("spec/models/#{name.to_s.downcase}_spec.rb"), rspec_contents, :skip => true
80
- end
81
- end # RspecGen
82
- end # Tests
83
- end # Components
84
- end # Generators
85
- end # Padrino
@@ -1,81 +0,0 @@
1
- module Padrino
2
- module Generators
3
- module Components
4
- module Tests
5
-
6
- module ShouldaGen
7
- SHOULDA_SETUP = (<<-TEST).gsub(/^ {10}/, '')
8
- PADRINO_ENV = 'test' unless defined?(PADRINO_ENV)
9
- require File.expand_path(File.dirname(__FILE__) + "/../config/boot")
10
-
11
- class Test::Unit::TestCase
12
- include Rack::Test::Methods
13
-
14
- def app
15
- ##
16
- # You can hanlde all padrino applications using instead:
17
- # Padrino.application
18
- CLASS_NAME.tap { |app| }
19
- end
20
- end
21
- TEST
22
-
23
- SHOULDA_CONTROLLER_TEST = (<<-TEST).gsub(/^ {10}/, '')
24
- require File.expand_path(File.dirname(__FILE__) + '/../test_config.rb')
25
-
26
- class !NAME!ControllerTest < Test::Unit::TestCase
27
- context "!NAME!Controller" do
28
- setup do
29
- get '/'
30
- end
31
-
32
- should "return hello world text" do
33
- assert_equal "Hello World", last_response.body
34
- end
35
- end
36
- end
37
- TEST
38
-
39
- SHOULDA_RAKE = (<<-TEST).gsub(/^ {10}/, '')
40
- require 'rake/testtask'
41
-
42
- Rake::TestTask.new(:test) do |test|
43
- test.pattern = '**/*_test.rb'
44
- test.verbose = true
45
- end
46
- TEST
47
-
48
- SHOULDA_MODEL_TEST = (<<-TEST).gsub(/^ {10}/, '')
49
- require File.expand_path(File.dirname(__FILE__) + '/../test_config.rb')
50
-
51
- class !NAME!ControllerTest < Test::Unit::TestCase
52
- context "!NAME! Model" do
53
- should 'construct new instance' do
54
- @!DNAME! = !NAME!.new
55
- assert_not_nil @!DNAME!
56
- end
57
- end
58
- end
59
- TEST
60
-
61
- def setup_test
62
- require_dependencies 'shoulda', :group => 'test'
63
- insert_test_suite_setup SHOULDA_SETUP
64
- create_file destination_root("test/test.rake"), SHOULDA_RAKE
65
- end
66
-
67
- # Generates a controller test given the controllers name
68
- def generate_controller_test(name)
69
- shoulda_contents = SHOULDA_CONTROLLER_TEST.gsub(/!NAME!/, name.to_s.camelize)
70
- create_file destination_root("test/controllers/#{name}_controller_test.rb"), shoulda_contents, :skip => true
71
- end
72
-
73
- def generate_model_test(name)
74
- shoulda_contents = SHOULDA_MODEL_TEST.gsub(/!NAME!/, name.to_s.camelize).gsub(/!DNAME!/, name.downcase.underscore)
75
- create_file destination_root("test/models/#{name.to_s.downcase}_test.rb"), shoulda_contents, :skip => true
76
- end
77
- end # ShouldaGen
78
- end # Tests
79
- end # Components
80
- end # Generators
81
- end # Padrino
@@ -1,74 +0,0 @@
1
- module Padrino
2
- module Generators
3
- module Components
4
- module Tests
5
-
6
- module TestspecGen
7
- TESTSPEC_SETUP = (<<-TEST).gsub(/^ {10}/, '')
8
- PADRINO_ENV = 'test' unless defined?(PADRINO_ENV)
9
- require File.expand_path(File.dirname(__FILE__) + "/../config/boot")
10
-
11
- class Test::Unit::TestCase
12
- include Rack::Test::Methods
13
-
14
- def app
15
- ##
16
- # You can hanlde all padrino applications using instead:
17
- # Padrino.application
18
- CLASS_NAME.tap { |app| }
19
- end
20
- end
21
- TEST
22
-
23
- TESTSPEC_CONTROLLER_TEST = (<<-TEST).gsub(/^ {10}/, '')
24
- require File.expand_path(File.dirname(__FILE__) + '/../test_config.rb')
25
-
26
- context "!NAME!Controller" do
27
- setup { get('/') }
28
- specify "returns hello world" do
29
- last_response.body.should.equal "Hello World"
30
- end
31
- end
32
- TEST
33
-
34
- TESTSPEC_RAKE = (<<-TEST).gsub(/^ {10}/, '')
35
- require 'rake/testtask'
36
-
37
- Rake::TestTask.new(:test) do |test|
38
- test.pattern = '**/*_test.rb'
39
- test.verbose = true
40
- end
41
- TEST
42
-
43
- TESTSPEC_MODEL_TEST = (<<-TEST).gsub(/^ {10}/, '')
44
- require File.expand_path(File.dirname(__FILE__) + '/../test_config.rb')
45
-
46
- context "!NAME! Model" do
47
- specify 'can be created' do
48
- @!DNAME! = !NAME!.new
49
- @!DNAME!.should.not.be.nil
50
- end
51
- end
52
- TEST
53
-
54
- def setup_test
55
- require_dependencies 'test-spec', :require => 'test/spec', :group => 'test'
56
- insert_test_suite_setup TESTSPEC_SETUP
57
- create_file destination_root("test/test.rake"), TESTSPEC_RAKE
58
- end
59
-
60
- # Generates a controller test given the controllers name
61
- def generate_controller_test(name)
62
- testspec_contents = TESTSPEC_CONTROLLER_TEST.gsub(/!NAME!/, name.to_s.camelize)
63
- create_file destination_root("test/controllers/#{name}_controller_test.rb"), testspec_contents, :skip => true
64
- end
65
-
66
- def generate_model_test(name)
67
- tests_contents = TESTSPEC_MODEL_TEST.gsub(/!NAME!/, name.to_s.camelize).gsub(/!DNAME!/, name.downcase.underscore)
68
- create_file destination_root("test/models/#{name.to_s.downcase}_test.rb"), tests_contents, :skip => true
69
- end
70
- end # TestspecGen
71
- end # Tests
72
- end # Components
73
- end # Generators
74
- end # Padrino