rubigen 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/History.txt +8 -0
  2. data/Manifest.txt +1 -72
  3. data/app_generators/ruby_app/ruby_app_generator.rb +1 -1
  4. data/app_generators/ruby_app/templates/configs/{empty.log → empty_log} +0 -0
  5. data/generators/install_rubigen_scripts/install_rubigen_scripts_generator.rb +7 -0
  6. data/lib/rubigen/lookup.rb +1 -1
  7. data/lib/rubigen/version.rb +1 -1
  8. data/website/index.html +2 -2
  9. metadata +3 -74
  10. data/examples/rails_generators/applications/app/USAGE +0 -16
  11. data/examples/rails_generators/applications/app/app_generator.rb +0 -177
  12. data/examples/rails_generators/components/controller/USAGE +0 -29
  13. data/examples/rails_generators/components/controller/controller_generator.rb +0 -37
  14. data/examples/rails_generators/components/controller/templates/controller.rb +0 -10
  15. data/examples/rails_generators/components/controller/templates/functional_test.rb +0 -18
  16. data/examples/rails_generators/components/controller/templates/helper.rb +0 -2
  17. data/examples/rails_generators/components/controller/templates/view.html.erb +0 -2
  18. data/examples/rails_generators/components/integration_test/USAGE +0 -8
  19. data/examples/rails_generators/components/integration_test/integration_test_generator.rb +0 -16
  20. data/examples/rails_generators/components/integration_test/templates/integration_test.rb +0 -10
  21. data/examples/rails_generators/components/mailer/USAGE +0 -16
  22. data/examples/rails_generators/components/mailer/mailer_generator.rb +0 -34
  23. data/examples/rails_generators/components/mailer/templates/fixture.erb +0 -3
  24. data/examples/rails_generators/components/mailer/templates/fixture.rhtml +0 -0
  25. data/examples/rails_generators/components/mailer/templates/mailer.rb +0 -13
  26. data/examples/rails_generators/components/mailer/templates/unit_test.rb +0 -37
  27. data/examples/rails_generators/components/mailer/templates/view.erb +0 -3
  28. data/examples/rails_generators/components/mailer/templates/view.rhtml +0 -0
  29. data/examples/rails_generators/components/migration/USAGE +0 -24
  30. data/examples/rails_generators/components/migration/migration_generator.rb +0 -20
  31. data/examples/rails_generators/components/migration/templates/migration.rb +0 -7
  32. data/examples/rails_generators/components/model/USAGE +0 -27
  33. data/examples/rails_generators/components/model/model_generator.rb +0 -38
  34. data/examples/rails_generators/components/model/templates/fixtures.yml +0 -15
  35. data/examples/rails_generators/components/model/templates/migration.rb +0 -14
  36. data/examples/rails_generators/components/model/templates/model.rb +0 -2
  37. data/examples/rails_generators/components/model/templates/unit_test.rb +0 -10
  38. data/examples/rails_generators/components/observer/USAGE +0 -13
  39. data/examples/rails_generators/components/observer/observer_generator.rb +0 -16
  40. data/examples/rails_generators/components/observer/templates/observer.rb +0 -2
  41. data/examples/rails_generators/components/observer/templates/unit_test.rb +0 -10
  42. data/examples/rails_generators/components/plugin/USAGE +0 -25
  43. data/examples/rails_generators/components/plugin/plugin_generator.rb +0 -39
  44. data/examples/rails_generators/components/plugin/templates/MIT-LICENSE +0 -20
  45. data/examples/rails_generators/components/plugin/templates/README +0 -13
  46. data/examples/rails_generators/components/plugin/templates/Rakefile +0 -22
  47. data/examples/rails_generators/components/plugin/templates/USAGE +0 -8
  48. data/examples/rails_generators/components/plugin/templates/generator.rb +0 -8
  49. data/examples/rails_generators/components/plugin/templates/init.rb +0 -1
  50. data/examples/rails_generators/components/plugin/templates/install.rb +0 -1
  51. data/examples/rails_generators/components/plugin/templates/plugin.rb +0 -1
  52. data/examples/rails_generators/components/plugin/templates/tasks.rake +0 -4
  53. data/examples/rails_generators/components/plugin/templates/uninstall.rb +0 -1
  54. data/examples/rails_generators/components/plugin/templates/unit_test.rb +0 -8
  55. data/examples/rails_generators/components/resource/USAGE +0 -23
  56. data/examples/rails_generators/components/resource/resource_generator.rb +0 -72
  57. data/examples/rails_generators/components/resource/templates/USAGE +0 -18
  58. data/examples/rails_generators/components/resource/templates/controller.rb +0 -2
  59. data/examples/rails_generators/components/resource/templates/fixtures.yml +0 -0
  60. data/examples/rails_generators/components/resource/templates/functional_test.rb +0 -20
  61. data/examples/rails_generators/components/resource/templates/helper.rb +0 -2
  62. data/examples/rails_generators/components/scaffold/USAGE +0 -25
  63. data/examples/rails_generators/components/scaffold/scaffold_generator.rb +0 -90
  64. data/examples/rails_generators/components/scaffold/templates/controller.rb +0 -85
  65. data/examples/rails_generators/components/scaffold/templates/functional_test.rb +0 -57
  66. data/examples/rails_generators/components/scaffold/templates/helper.rb +0 -2
  67. data/examples/rails_generators/components/scaffold/templates/layout.html.erb +0 -17
  68. data/examples/rails_generators/components/scaffold/templates/style.css +0 -74
  69. data/examples/rails_generators/components/scaffold/templates/view_edit.html.erb +0 -19
  70. data/examples/rails_generators/components/scaffold/templates/view_index.html.erb +0 -24
  71. data/examples/rails_generators/components/scaffold/templates/view_new.html.erb +0 -18
  72. data/examples/rails_generators/components/scaffold/templates/view_show.html.erb +0 -10
  73. data/examples/rails_generators/components/session_migration/USAGE +0 -10
  74. data/examples/rails_generators/components/session_migration/session_migration_generator.rb +0 -18
  75. data/examples/rails_generators/components/session_migration/templates/migration.rb +0 -16
  76. data/examples/rails_generators/components/web_service/USAGE +0 -24
  77. data/examples/rails_generators/components/web_service/templates/api_definition.rb +0 -5
  78. data/examples/rails_generators/components/web_service/templates/controller.rb +0 -8
  79. data/examples/rails_generators/components/web_service/templates/functional_test.rb +0 -19
  80. data/examples/rails_generators/components/web_service/web_service_generator.rb +0 -29
data/History.txt CHANGED
@@ -1,3 +1,11 @@
1
+ == 1.0.8 2007-11-03
2
+
3
+ * install_rubigen_scripts adds 'test_unit' to scopes unless a test-related scope is added
4
+ * remove examples directory because it's redundant. See rails gem. [Winston Tsang]
5
+ * Add missing template empty_log. [Winston Tsang]
6
+ * Moved test_unit generator to test_unit scope (instead of global scope)
7
+ * generator_full_paths now returns the sources in reverse order [thx hassox]
8
+
1
9
  == 1.0.7 2007-11-02
2
10
 
3
11
  * Moved test_unit generator to test_unit scope (instead of global scope)
data/Manifest.txt CHANGED
@@ -8,84 +8,13 @@ app_generators/ruby_app/USAGE
8
8
  app_generators/ruby_app/ruby_app_generator.rb
9
9
  app_generators/ruby_app/templates/README.txt
10
10
  app_generators/ruby_app/templates/Rakefile
11
- app_generators/ruby_app/templates/configs/empty.log
11
+ app_generators/ruby_app/templates/configs/empty_log
12
12
  app_generators/ruby_app/templates/lib/module.rb
13
13
  app_generators/ruby_app/templates/test/test_helper.rb.erb
14
14
  bin/install_rubigen_scripts
15
15
  bin/ruby_app
16
16
  config/hoe.rb
17
17
  config/requirements.rb
18
- examples/rails_generators/applications/app/USAGE
19
- examples/rails_generators/applications/app/app_generator.rb
20
- examples/rails_generators/components/controller/USAGE
21
- examples/rails_generators/components/controller/controller_generator.rb
22
- examples/rails_generators/components/controller/templates/controller.rb
23
- examples/rails_generators/components/controller/templates/functional_test.rb
24
- examples/rails_generators/components/controller/templates/helper.rb
25
- examples/rails_generators/components/controller/templates/view.html.erb
26
- examples/rails_generators/components/integration_test/USAGE
27
- examples/rails_generators/components/integration_test/integration_test_generator.rb
28
- examples/rails_generators/components/integration_test/templates/integration_test.rb
29
- examples/rails_generators/components/mailer/USAGE
30
- examples/rails_generators/components/mailer/mailer_generator.rb
31
- examples/rails_generators/components/mailer/templates/fixture.erb
32
- examples/rails_generators/components/mailer/templates/fixture.rhtml
33
- examples/rails_generators/components/mailer/templates/mailer.rb
34
- examples/rails_generators/components/mailer/templates/unit_test.rb
35
- examples/rails_generators/components/mailer/templates/view.erb
36
- examples/rails_generators/components/mailer/templates/view.rhtml
37
- examples/rails_generators/components/migration/USAGE
38
- examples/rails_generators/components/migration/migration_generator.rb
39
- examples/rails_generators/components/migration/templates/migration.rb
40
- examples/rails_generators/components/model/USAGE
41
- examples/rails_generators/components/model/model_generator.rb
42
- examples/rails_generators/components/model/templates/fixtures.yml
43
- examples/rails_generators/components/model/templates/migration.rb
44
- examples/rails_generators/components/model/templates/model.rb
45
- examples/rails_generators/components/model/templates/unit_test.rb
46
- examples/rails_generators/components/observer/USAGE
47
- examples/rails_generators/components/observer/observer_generator.rb
48
- examples/rails_generators/components/observer/templates/observer.rb
49
- examples/rails_generators/components/observer/templates/unit_test.rb
50
- examples/rails_generators/components/plugin/USAGE
51
- examples/rails_generators/components/plugin/plugin_generator.rb
52
- examples/rails_generators/components/plugin/templates/MIT-LICENSE
53
- examples/rails_generators/components/plugin/templates/README
54
- examples/rails_generators/components/plugin/templates/Rakefile
55
- examples/rails_generators/components/plugin/templates/USAGE
56
- examples/rails_generators/components/plugin/templates/generator.rb
57
- examples/rails_generators/components/plugin/templates/init.rb
58
- examples/rails_generators/components/plugin/templates/install.rb
59
- examples/rails_generators/components/plugin/templates/plugin.rb
60
- examples/rails_generators/components/plugin/templates/tasks.rake
61
- examples/rails_generators/components/plugin/templates/uninstall.rb
62
- examples/rails_generators/components/plugin/templates/unit_test.rb
63
- examples/rails_generators/components/resource/USAGE
64
- examples/rails_generators/components/resource/resource_generator.rb
65
- examples/rails_generators/components/resource/templates/USAGE
66
- examples/rails_generators/components/resource/templates/controller.rb
67
- examples/rails_generators/components/resource/templates/fixtures.yml
68
- examples/rails_generators/components/resource/templates/functional_test.rb
69
- examples/rails_generators/components/resource/templates/helper.rb
70
- examples/rails_generators/components/scaffold/USAGE
71
- examples/rails_generators/components/scaffold/scaffold_generator.rb
72
- examples/rails_generators/components/scaffold/templates/controller.rb
73
- examples/rails_generators/components/scaffold/templates/functional_test.rb
74
- examples/rails_generators/components/scaffold/templates/helper.rb
75
- examples/rails_generators/components/scaffold/templates/layout.html.erb
76
- examples/rails_generators/components/scaffold/templates/style.css
77
- examples/rails_generators/components/scaffold/templates/view_edit.html.erb
78
- examples/rails_generators/components/scaffold/templates/view_index.html.erb
79
- examples/rails_generators/components/scaffold/templates/view_new.html.erb
80
- examples/rails_generators/components/scaffold/templates/view_show.html.erb
81
- examples/rails_generators/components/session_migration/USAGE
82
- examples/rails_generators/components/session_migration/session_migration_generator.rb
83
- examples/rails_generators/components/session_migration/templates/migration.rb
84
- examples/rails_generators/components/web_service/USAGE
85
- examples/rails_generators/components/web_service/templates/api_definition.rb
86
- examples/rails_generators/components/web_service/templates/controller.rb
87
- examples/rails_generators/components/web_service/templates/functional_test.rb
88
- examples/rails_generators/components/web_service/web_service_generator.rb
89
18
  generators/install_rubigen_scripts/install_rubigen_scripts_generator.rb
90
19
  generators/install_rubigen_scripts/templates/script/destroy
91
20
  generators/install_rubigen_scripts/templates/script/generate
@@ -39,7 +39,7 @@ class RubyAppGenerator < RubiGen::Base
39
39
  m.template_copy_each %w(test_helper.rb.erb), "test"
40
40
 
41
41
  %w(debug).each { |file|
42
- m.file "configs/empty.log", "log/#{file}.log", :chmod => 0666
42
+ m.file "configs/empty_log", "log/#{file}.log", :chmod => 0666
43
43
  }
44
44
 
45
45
  m.dependency "install_rubigen_scripts", [destination_root, "rubygems"], :shebang => options[:shebang]
@@ -12,6 +12,7 @@ class InstallRubigenScriptsGenerator < RubiGen::Base
12
12
  @path = args.shift
13
13
  @destination_root = File.expand_path(path)
14
14
  @scopes = args.map { |scope| scope.to_sym }
15
+ default_scopes
15
16
  extract_options
16
17
  end
17
18
 
@@ -61,5 +62,11 @@ EOS
61
62
  # raw instance variable value.
62
63
  # @author = options[:author]
63
64
  end
65
+
66
+ def default_scopes
67
+ if (scopes & %w[test_unit rspec test_spec mini_spec]).blank?
68
+ scopes << 'test_unit'
69
+ end
70
+ end
64
71
 
65
72
  end
@@ -291,7 +291,7 @@ module RubiGen
291
291
  mem << generator
292
292
  end
293
293
  mem
294
- end
294
+ end.reverse
295
295
  end
296
296
 
297
297
  def filter_str
@@ -2,7 +2,7 @@ module Rubigen #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- TINY = 7
5
+ TINY = 8
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/website/index.html CHANGED
@@ -31,7 +31,7 @@
31
31
  <h1>rubigen</h1>
32
32
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/rubigen"; return false'>
33
33
  <p>Get Version</p>
34
- <a href="http://rubyforge.org/projects/rubigen" class="numbers">1.0.7</a>
34
+ <a href="http://rubyforge.org/projects/rubigen" class="numbers">1.0.8</a>
35
35
  </div>
36
36
  <h1>Ruby Generator Framework</h1>
37
37
 
@@ -349,7 +349,7 @@ The trunk repository is <code>svn://rubyforge.org/var/svn/rubigen/trunk</code> f
349
349
 
350
350
  <p>Comments are welcome. Send an email to <a href="mailto:drnicwilliams@gmail.com">Dr Nic Williams</a> via the <a href="http://groups.google.com/group/rubigen">forum</a></p>
351
351
  <p class="coda">
352
- <a href="drnicwilliams@gmail.com">Dr Nic Williams</a>, 2nd November 2007<br>
352
+ <a href="drnicwilliams@gmail.com">Dr Nic Williams</a>, 4th November 2007<br>
353
353
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
354
354
  </p>
355
355
  </div>
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4.3
3
3
  specification_version: 1
4
4
  name: rubigen
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.7
7
- date: 2007-11-02 00:00:00 -04:00
6
+ version: 1.0.8
7
+ date: 2007-11-04 00:00:00 -04:00
8
8
  summary: "A framework to allow Ruby applications to generate file/folder stubs (like the rails command does for Ruby on Rails, and the \xE2\x80\x98script/generate\xE2\x80\x99 command within a Rails application during development)."
9
9
  require_paths:
10
10
  - lib
@@ -40,84 +40,13 @@ files:
40
40
  - app_generators/ruby_app/ruby_app_generator.rb
41
41
  - app_generators/ruby_app/templates/README.txt
42
42
  - app_generators/ruby_app/templates/Rakefile
43
- - app_generators/ruby_app/templates/configs/empty.log
43
+ - app_generators/ruby_app/templates/configs/empty_log
44
44
  - app_generators/ruby_app/templates/lib/module.rb
45
45
  - app_generators/ruby_app/templates/test/test_helper.rb.erb
46
46
  - bin/install_rubigen_scripts
47
47
  - bin/ruby_app
48
48
  - config/hoe.rb
49
49
  - config/requirements.rb
50
- - examples/rails_generators/applications/app/USAGE
51
- - examples/rails_generators/applications/app/app_generator.rb
52
- - examples/rails_generators/components/controller/USAGE
53
- - examples/rails_generators/components/controller/controller_generator.rb
54
- - examples/rails_generators/components/controller/templates/controller.rb
55
- - examples/rails_generators/components/controller/templates/functional_test.rb
56
- - examples/rails_generators/components/controller/templates/helper.rb
57
- - examples/rails_generators/components/controller/templates/view.html.erb
58
- - examples/rails_generators/components/integration_test/USAGE
59
- - examples/rails_generators/components/integration_test/integration_test_generator.rb
60
- - examples/rails_generators/components/integration_test/templates/integration_test.rb
61
- - examples/rails_generators/components/mailer/USAGE
62
- - examples/rails_generators/components/mailer/mailer_generator.rb
63
- - examples/rails_generators/components/mailer/templates/fixture.erb
64
- - examples/rails_generators/components/mailer/templates/fixture.rhtml
65
- - examples/rails_generators/components/mailer/templates/mailer.rb
66
- - examples/rails_generators/components/mailer/templates/unit_test.rb
67
- - examples/rails_generators/components/mailer/templates/view.erb
68
- - examples/rails_generators/components/mailer/templates/view.rhtml
69
- - examples/rails_generators/components/migration/USAGE
70
- - examples/rails_generators/components/migration/migration_generator.rb
71
- - examples/rails_generators/components/migration/templates/migration.rb
72
- - examples/rails_generators/components/model/USAGE
73
- - examples/rails_generators/components/model/model_generator.rb
74
- - examples/rails_generators/components/model/templates/fixtures.yml
75
- - examples/rails_generators/components/model/templates/migration.rb
76
- - examples/rails_generators/components/model/templates/model.rb
77
- - examples/rails_generators/components/model/templates/unit_test.rb
78
- - examples/rails_generators/components/observer/USAGE
79
- - examples/rails_generators/components/observer/observer_generator.rb
80
- - examples/rails_generators/components/observer/templates/observer.rb
81
- - examples/rails_generators/components/observer/templates/unit_test.rb
82
- - examples/rails_generators/components/plugin/USAGE
83
- - examples/rails_generators/components/plugin/plugin_generator.rb
84
- - examples/rails_generators/components/plugin/templates/MIT-LICENSE
85
- - examples/rails_generators/components/plugin/templates/README
86
- - examples/rails_generators/components/plugin/templates/Rakefile
87
- - examples/rails_generators/components/plugin/templates/USAGE
88
- - examples/rails_generators/components/plugin/templates/generator.rb
89
- - examples/rails_generators/components/plugin/templates/init.rb
90
- - examples/rails_generators/components/plugin/templates/install.rb
91
- - examples/rails_generators/components/plugin/templates/plugin.rb
92
- - examples/rails_generators/components/plugin/templates/tasks.rake
93
- - examples/rails_generators/components/plugin/templates/uninstall.rb
94
- - examples/rails_generators/components/plugin/templates/unit_test.rb
95
- - examples/rails_generators/components/resource/USAGE
96
- - examples/rails_generators/components/resource/resource_generator.rb
97
- - examples/rails_generators/components/resource/templates/USAGE
98
- - examples/rails_generators/components/resource/templates/controller.rb
99
- - examples/rails_generators/components/resource/templates/fixtures.yml
100
- - examples/rails_generators/components/resource/templates/functional_test.rb
101
- - examples/rails_generators/components/resource/templates/helper.rb
102
- - examples/rails_generators/components/scaffold/USAGE
103
- - examples/rails_generators/components/scaffold/scaffold_generator.rb
104
- - examples/rails_generators/components/scaffold/templates/controller.rb
105
- - examples/rails_generators/components/scaffold/templates/functional_test.rb
106
- - examples/rails_generators/components/scaffold/templates/helper.rb
107
- - examples/rails_generators/components/scaffold/templates/layout.html.erb
108
- - examples/rails_generators/components/scaffold/templates/style.css
109
- - examples/rails_generators/components/scaffold/templates/view_edit.html.erb
110
- - examples/rails_generators/components/scaffold/templates/view_index.html.erb
111
- - examples/rails_generators/components/scaffold/templates/view_new.html.erb
112
- - examples/rails_generators/components/scaffold/templates/view_show.html.erb
113
- - examples/rails_generators/components/session_migration/USAGE
114
- - examples/rails_generators/components/session_migration/session_migration_generator.rb
115
- - examples/rails_generators/components/session_migration/templates/migration.rb
116
- - examples/rails_generators/components/web_service/USAGE
117
- - examples/rails_generators/components/web_service/templates/api_definition.rb
118
- - examples/rails_generators/components/web_service/templates/controller.rb
119
- - examples/rails_generators/components/web_service/templates/functional_test.rb
120
- - examples/rails_generators/components/web_service/web_service_generator.rb
121
50
  - generators/install_rubigen_scripts/install_rubigen_scripts_generator.rb
122
51
  - generators/install_rubigen_scripts/templates/script/destroy
123
52
  - generators/install_rubigen_scripts/templates/script/generate
@@ -1,16 +0,0 @@
1
- Description:
2
- The 'rails' command creates a new Rails application with a default
3
- directory structure and configuration at the path you specify.
4
-
5
- Example:
6
- rails ~/Code/Ruby/weblog
7
-
8
- This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
9
- See the README in the newly created application to get going.
10
-
11
- WARNING:
12
- Only specify --without-gems if you did not use gems to install Rails.
13
- Your application will expect to find activerecord, actionpack, and
14
- actionmailer directories in the vendor directory. A popular way to track
15
- the bleeding edge of Rails development is to checkout from source control
16
- directly to the vendor directory. See http://dev.rubyonrails.org/
@@ -1,177 +0,0 @@
1
- require 'rbconfig'
2
- require 'digest/md5'
3
-
4
- class AppGenerator < RubiGen::Base
5
- DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
6
- Config::CONFIG['ruby_install_name'])
7
-
8
- DATABASES = %w(mysql oracle postgresql sqlite2 sqlite3 frontbase)
9
-
10
- default_options :db => (ENV["RAILS_DEFAULT_DATABASE"] || "mysql"),
11
- :shebang => DEFAULT_SHEBANG, :freeze => false
12
- mandatory_options :source => "#{File.dirname(__FILE__)}/../../../../.."
13
-
14
- def initialize(runtime_args, runtime_options = {})
15
- super
16
- usage if args.empty?
17
- usage("Databases supported for preconfiguration are: #{DATABASES.join(", ")}") if (options[:db] && !DATABASES.include?(options[:db]))
18
- @destination_root = args.shift
19
- @app_name = File.basename(File.expand_path(@destination_root))
20
- end
21
-
22
- def manifest
23
- # Use /usr/bin/env if no special shebang was specified
24
- script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] }
25
- dispatcher_options = { :chmod => 0755, :shebang => options[:shebang] }
26
-
27
- # duplicate CGI::Session#generate_unique_id
28
- md5 = Digest::MD5.new
29
- now = Time.now
30
- md5 << now.to_s
31
- md5 << String(now.usec)
32
- md5 << String(rand(0))
33
- md5 << String($$)
34
- md5 << @app_name
35
-
36
- record do |m|
37
- # Root directory and all subdirectories.
38
- m.directory ''
39
- BASEDIRS.each { |path| m.directory path }
40
-
41
- # Root
42
- m.file "fresh_rakefile", "Rakefile"
43
- m.file "README", "README"
44
-
45
- # Application
46
- m.template "helpers/application.rb", "app/controllers/application.rb", :assigns => { :app_name => @app_name }
47
- m.template "helpers/application_helper.rb", "app/helpers/application_helper.rb"
48
- m.template "helpers/test_helper.rb", "test/test_helper.rb"
49
-
50
- # database.yml and .htaccess
51
- m.template "configs/databases/#{options[:db]}.yml", "config/database.yml", :assigns => {
52
- :app_name => @app_name,
53
- :socket => options[:db] == "mysql" ? mysql_socket_location : nil
54
- }
55
- m.template "configs/routes.rb", "config/routes.rb"
56
- m.template "configs/apache.conf", "public/.htaccess"
57
-
58
- # Initializers
59
- m.template "configs/initializers/inflections.rb", "config/initializers/inflections.rb"
60
- m.template "configs/initializers/mime_types.rb", "config/initializers/mime_types.rb"
61
-
62
- # Environments
63
- m.file "environments/boot.rb", "config/boot.rb"
64
- m.template "environments/environment.rb", "config/environment.rb", :assigns => { :freeze => options[:freeze], :app_name => @app_name, :app_secret => md5.hexdigest }
65
- m.file "environments/production.rb", "config/environments/production.rb"
66
- m.file "environments/development.rb", "config/environments/development.rb"
67
- m.file "environments/test.rb", "config/environments/test.rb"
68
-
69
- # Scripts
70
- %w( about console destroy generate performance/benchmarker performance/profiler process/reaper process/spawner process/inspector runner server plugin ).each do |file|
71
- m.file "bin/#{file}", "script/#{file}", script_options
72
- m.template "bin/win_script.cmd", "script/#{file}.cmd",
73
- :assigns => { :filename => file } if RUBY_PLATFORM =~ /dos|win32|cygwin/i
74
- end
75
-
76
- # Dispatches
77
- m.file "dispatches/dispatch.rb", "public/dispatch.rb", dispatcher_options
78
- m.file "dispatches/dispatch.rb", "public/dispatch.cgi", dispatcher_options
79
- m.file "dispatches/dispatch.fcgi", "public/dispatch.fcgi", dispatcher_options
80
-
81
- # HTML files
82
- %w(404 500 index).each do |file|
83
- m.template "html/#{file}.html", "public/#{file}.html"
84
- end
85
-
86
- m.template "html/favicon.ico", "public/favicon.ico"
87
- m.template "html/robots.txt", "public/robots.txt"
88
- m.file "html/images/rails.png", "public/images/rails.png"
89
-
90
- # Javascripts
91
- m.file "html/javascripts/prototype.js", "public/javascripts/prototype.js"
92
- m.file "html/javascripts/effects.js", "public/javascripts/effects.js"
93
- m.file "html/javascripts/dragdrop.js", "public/javascripts/dragdrop.js"
94
- m.file "html/javascripts/controls.js", "public/javascripts/controls.js"
95
- m.file "html/javascripts/application.js", "public/javascripts/application.js"
96
-
97
- # Docs
98
- m.file "doc/README_FOR_APP", "doc/README_FOR_APP"
99
-
100
- # Logs
101
- %w(server production development test).each { |file|
102
- m.file "configs/empty.log", "log/#{file}.log", :chmod => 0666
103
- }
104
- end
105
- end
106
-
107
- protected
108
- def banner
109
- "Usage: #{$0} /path/to/your/app [options]"
110
- end
111
-
112
- def add_options!(opt)
113
- opt.separator ''
114
- opt.separator 'Options:'
115
- opt.on("-r", "--ruby=path", String,
116
- "Path to the Ruby binary of your choice (otherwise scripts use env, dispatchers current path).",
117
- "Default: #{DEFAULT_SHEBANG}") { |v| options[:shebang] = v }
118
-
119
- opt.on("-d", "--database=name", String,
120
- "Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite2/sqlite3).",
121
- "Default: mysql") { |v| options[:db] = v }
122
-
123
- opt.on("-f", "--freeze",
124
- "Freeze Rails in vendor/rails from the gems generating the skeleton",
125
- "Default: false") { |v| options[:freeze] = v }
126
- end
127
-
128
- def mysql_socket_location
129
- MYSQL_SOCKET_LOCATIONS.find { |f| File.exists?(f) } unless RUBY_PLATFORM =~ /(:?mswin|mingw)/
130
- end
131
-
132
-
133
- # Installation skeleton. Intermediate directories are automatically
134
- # created so don't sweat their absence here.
135
- BASEDIRS = %w(
136
- app/controllers
137
- app/helpers
138
- app/models
139
- app/views/layouts
140
- config/environments
141
- config/initializers
142
- db
143
- doc
144
- lib
145
- lib/tasks
146
- log
147
- public/images
148
- public/javascripts
149
- public/stylesheets
150
- script/performance
151
- script/process
152
- test/fixtures
153
- test/functional
154
- test/integration
155
- test/mocks/development
156
- test/mocks/test
157
- test/unit
158
- vendor
159
- vendor/plugins
160
- tmp/sessions
161
- tmp/sockets
162
- tmp/cache
163
- tmp/pids
164
- )
165
-
166
- MYSQL_SOCKET_LOCATIONS = [
167
- "/tmp/mysql.sock", # default
168
- "/var/run/mysqld/mysqld.sock", # debian/gentoo
169
- "/var/tmp/mysql.sock", # freebsd
170
- "/var/lib/mysql/mysql.sock", # fedora
171
- "/opt/local/lib/mysql/mysql.sock", # fedora
172
- "/opt/local/var/run/mysqld/mysqld.sock", # mac + darwinports + mysql
173
- "/opt/local/var/run/mysql4/mysqld.sock", # mac + darwinports + mysql4
174
- "/opt/local/var/run/mysql5/mysqld.sock", # mac + darwinports + mysql5
175
- "/opt/lampp/var/mysql/mysql.sock" # xampp for linux
176
- ]
177
- end
@@ -1,29 +0,0 @@
1
- Description:
2
- Stubs out a new controller and its views. Pass the controller name, either
3
- CamelCased or under_scored, and a list of views as arguments.
4
-
5
- To create a controller within a module, specify the controller name as a
6
- path like 'parent_module/controller_name'.
7
-
8
- This generates a controller class in app/controllers, view templates in
9
- app/views/controller_name, a helper class in app/helpers, and a functional
10
- test suite in test/functional.
11
-
12
- Example:
13
- `./script/generate controller CreditCard open debit credit close`
14
-
15
- Credit card controller with URLs like /credit_card/debit.
16
- Controller: app/controllers/credit_card_controller.rb
17
- Views: app/views/credit_card/debit.html.erb [...]
18
- Helper: app/helpers/credit_card_helper.rb
19
- Test: test/functional/credit_card_controller_test.rb
20
-
21
- Modules Example:
22
- `./script/generate controller 'admin/credit_card' suspend late_fee`
23
-
24
- Credit card admin controller with URLs /admin/credit_card/suspend.
25
- Controller: app/controllers/admin/credit_card_controller.rb
26
- Views: app/views/admin/credit_card/debit.html.erb [...]
27
- Helper: app/helpers/admin/credit_card_helper.rb
28
- Test: test/functional/admin/credit_card_controller_test.rb
29
-
@@ -1,37 +0,0 @@
1
- class ControllerGenerator < RubiGen::NamedBase
2
- def manifest
3
- record do |m|
4
- # Check for class naming collisions.
5
- m.class_collisions class_path, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper"
6
-
7
- # Controller, helper, views, and test directories.
8
- m.directory File.join('app/controllers', class_path)
9
- m.directory File.join('app/helpers', class_path)
10
- m.directory File.join('app/views', class_path, file_name)
11
- m.directory File.join('test/functional', class_path)
12
-
13
- # Controller class, functional test, and helper class.
14
- m.template 'controller.rb',
15
- File.join('app/controllers',
16
- class_path,
17
- "#{file_name}_controller.rb")
18
-
19
- m.template 'functional_test.rb',
20
- File.join('test/functional',
21
- class_path,
22
- "#{file_name}_controller_test.rb")
23
-
24
- m.template 'helper.rb',
25
- File.join('app/helpers',
26
- class_path,
27
- "#{file_name}_helper.rb")
28
-
29
- # View template for each action.
30
- actions.each do |action|
31
- path = File.join('app/views', class_path, file_name, "#{action}.html.erb")
32
- m.template 'view.html.erb', path,
33
- :assigns => { :action => action, :path => path }
34
- end
35
- end
36
- end
37
- end
@@ -1,10 +0,0 @@
1
- class <%= class_name %>Controller < ApplicationController
2
- <% if options[:scaffold] -%>
3
- scaffold :<%= singular_name %>
4
- <% end -%>
5
- <% for action in actions -%>
6
-
7
- def <%= action %>
8
- end
9
- <% end -%>
10
- end
@@ -1,18 +0,0 @@
1
- require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../test_helper'
2
- require '<%= file_path %>_controller'
3
-
4
- # Re-raise errors caught by the controller.
5
- class <%= class_name %>Controller; def rescue_action(e) raise e end; end
6
-
7
- class <%= class_name %>ControllerTest < Test::Unit::TestCase
8
- def setup
9
- @controller = <%= class_name %>Controller.new
10
- @request = ActionController::TestRequest.new
11
- @response = ActionController::TestResponse.new
12
- end
13
-
14
- # Replace this with your real tests.
15
- def test_truth
16
- assert true
17
- end
18
- end
@@ -1,2 +0,0 @@
1
- module <%= class_name %>Helper
2
- end
@@ -1,2 +0,0 @@
1
- <h1><%= class_name %>#<%= action %></h1>
2
- <p>Find me in <%= path %></p>
@@ -1,8 +0,0 @@
1
- Description:
2
- Stubs out a new integration test. Pass the name of the test, either
3
- CamelCased or under_scored, as an argument. The new test class is
4
- generated in test/integration/testname_test.rb
5
-
6
- Example:
7
- `./script/generate integration_test GeneralStories` creates a GeneralStories
8
- integration test in test/integration/general_stories_test.rb
@@ -1,16 +0,0 @@
1
- class IntegrationTestGenerator < RubiGen::NamedBase
2
- default_options :skip_migration => false
3
-
4
- def manifest
5
- record do |m|
6
- # Check for class naming collisions.
7
- m.class_collisions class_path, class_name, "#{class_name}Test"
8
-
9
- # integration test directory
10
- m.directory File.join('test/integration', class_path)
11
-
12
- # integration test stub
13
- m.template 'integration_test.rb', File.join('test/integration', class_path, "#{file_name}_test.rb")
14
- end
15
- end
16
- end
@@ -1,10 +0,0 @@
1
- require "#{File.dirname(__FILE__)}<%= '/..' * class_nesting_depth %>/../test_helper"
2
-
3
- class <%= class_name %>Test < ActionController::IntegrationTest
4
- # fixtures :your, :models
5
-
6
- # Replace this with your real tests.
7
- def test_truth
8
- assert true
9
- end
10
- end
@@ -1,16 +0,0 @@
1
- Description:
2
- Stubs out a new mailer and its views. Pass the mailer name, either
3
- CamelCased or under_scored, and an optional list of emails as arguments.
4
-
5
- This generates a mailer class in app/models, view templates in
6
- app/views/mailer_name, a unit test in test/unit, and fixtures in
7
- test/fixtures.
8
-
9
- Example:
10
- `./script/generate mailer Notifications signup forgot_password invoice`
11
-
12
- creates a Notifications mailer class, views, test, and fixtures:
13
- Mailer: app/models/notifications.rb
14
- Views: app/views/notifications/signup.erb [...]
15
- Test: test/unit/test/unit/notifications_test.rb
16
- Fixtures: test/fixtures/notifications/signup [...]