tschmidt-rails-engine-generator 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Terry Schmidt
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,41 @@
1
+ = rails-engine-generator
2
+
3
+ Stubs out a new engine plugin. Pass the engine name, either CamelCased or
4
+ under_scored, as an argument. Pass --with-generator to add an example
5
+ generator also.
6
+
7
+ This creates a plugin in vendor/plugins including an init.rb and README
8
+ as well as standard plugin directories as well as app, config, and db directories.
9
+
10
+ == Example
11
+
12
+ `./script/generate engine Tickets`
13
+
14
+ creates a standard tickets plugin:
15
+ vendor/plugins/tickets/README
16
+ vendor/plugins/tickets/init.rb
17
+ vendor/plugins/tickets/install.rb
18
+ vendor/plugins/tickets/app
19
+ vendor/plugins/tickets/app/controllers
20
+ vendor/plugins/tickets/app/helpers
21
+ vendor/plugins/tickets/app/models
22
+ vendor/plugins/tickets/app/views
23
+ vendor/plugins/tickets/app/views/layouts
24
+ vendor/plugins/tickets/config
25
+ vendor/plugins/tickets/db
26
+ vendor/plugins/tickets/db/migrations
27
+ vendor/plugins/tickets/lib/tickets.rb
28
+ vendor/plugins/tickets/test/tickets_test.rb
29
+ vendor/plugins/tickets/tasks/tickets_tasks.rake
30
+
31
+ ./script/generate plugin BrowserFilters --with-generator
32
+
33
+ creates a tickets generator also:
34
+ vendor/plugins/tickets/generators/tickets/tickets_generator.rb
35
+ vendor/plugins/tickets/generators/tickets/USAGE
36
+ vendor/plugins/tickets/generators/tickets/templates/
37
+
38
+
39
+ == Copyright
40
+
41
+ Copyright (c) 2009 Terry Schmidt. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,56 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "rails-engine-generator"
8
+ gem.summary = %Q{Generate Rails Engines}
9
+ gem.email = "tschmidt@ext-inc.com"
10
+ gem.homepage = "http://github.com/tschmidt/rails-engine-generator"
11
+ gem.authors = ["Terry Schmidt"]
12
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
13
+ end
14
+
15
+ rescue LoadError
16
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
17
+ end
18
+
19
+ require 'rake/testtask'
20
+ Rake::TestTask.new(:test) do |test|
21
+ test.libs << 'lib' << 'test'
22
+ test.pattern = 'test/**/*_test.rb'
23
+ test.verbose = true
24
+ end
25
+
26
+ begin
27
+ require 'rcov/rcovtask'
28
+ Rcov::RcovTask.new do |test|
29
+ test.libs << 'test'
30
+ test.pattern = 'test/**/*_test.rb'
31
+ test.verbose = true
32
+ end
33
+ rescue LoadError
34
+ task :rcov do
35
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
36
+ end
37
+ end
38
+
39
+
40
+ task :default => :test
41
+
42
+ require 'rake/rdoctask'
43
+ Rake::RDocTask.new do |rdoc|
44
+ if File.exist?('VERSION.yml')
45
+ config = YAML.load(File.read('VERSION.yml'))
46
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
47
+ else
48
+ version = ""
49
+ end
50
+
51
+ rdoc.rdoc_dir = 'rdoc'
52
+ rdoc.title = "rails-engine-generator #{version}"
53
+ rdoc.rdoc_files.include('README*')
54
+ rdoc.rdoc_files.include('lib/**/*.rb')
55
+ end
56
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.3.0
@@ -0,0 +1 @@
1
+ # nothing to see here
@@ -0,0 +1,34 @@
1
+ Description:
2
+ Stubs out a new engine plugin. Pass the engine name, either CamelCased or
3
+ under_scored, as an argument. Pass --with-generator to add an example
4
+ generator also.
5
+
6
+ This creates a plugin in vendor/plugins including an init.rb and README
7
+ as well as standard plugin directories as well as app, config, and db directories.
8
+
9
+ Example:
10
+ `./script/generate engine Tickets`
11
+
12
+ creates a standard tickets plugin:
13
+ vendor/plugins/tickets/README
14
+ vendor/plugins/tickets/init.rb
15
+ vendor/plugins/tickets/install.rb
16
+ vendor/plugins/tickets/app
17
+ vendor/plugins/tickets/app/controllers
18
+ vendor/plugins/tickets/app/helpers
19
+ vendor/plugins/tickets/app/models
20
+ vendor/plugins/tickets/app/views
21
+ vendor/plugins/tickets/app/views/layouts
22
+ vendor/plugins/tickets/config
23
+ vendor/plugins/tickets/db
24
+ vendor/plugins/tickets/db/migrations
25
+ vendor/plugins/tickets/lib/tickets.rb
26
+ vendor/plugins/tickets/test/tickets_test.rb
27
+ vendor/plugins/tickets/tasks/tickets_tasks.rake
28
+
29
+ ./script/generate plugin BrowserFilters --with-generator
30
+
31
+ creates a tickets generator also:
32
+ vendor/plugins/tickets/generators/tickets/tickets_generator.rb
33
+ vendor/plugins/tickets/generators/tickets/USAGE
34
+ vendor/plugins/tickets/generators/tickets/templates/
@@ -0,0 +1,48 @@
1
+ class EngineGenerator < Rails::Generator::NamedBase
2
+ attr_reader :plugin_path
3
+
4
+ def initialize(runtime_args, runtime_options = {})
5
+ @with_generator = runtime_args.delete("--with-generator")
6
+ super
7
+ @plugin_path = "vendor/plugins/#{file_name}"
8
+ end
9
+
10
+ def manifest
11
+ record do |m|
12
+ # Check for class naming collisions.
13
+ m.class_collisions class_name
14
+
15
+ m.directory "#{plugin_path}/app"
16
+ m.directory "#{plugin_path}/app/controllers"
17
+ m.directory "#{plugin_path}/app/helpers"
18
+ m.directory "#{plugin_path}/app/models"
19
+ m.directory "#{plugin_path}/app/views"
20
+ m.directory "#{plugin_path}/app/views/layouts"
21
+ m.directory "#{plugin_path}/config"
22
+ m.directory "#{plugin_path}/db"
23
+ m.directory "#{plugin_path}/db/migrate"
24
+ m.directory "#{plugin_path}/lib"
25
+ m.directory "#{plugin_path}/tasks"
26
+ m.directory "#{plugin_path}/test"
27
+
28
+ m.template 'README', "#{plugin_path}/README"
29
+ m.template 'MIT-LICENSE', "#{plugin_path}/MIT-LICENSE"
30
+ m.template 'Rakefile', "#{plugin_path}/Rakefile"
31
+ m.template 'init.rb', "#{plugin_path}/init.rb"
32
+ m.template 'install.rb', "#{plugin_path}/install.rb"
33
+ m.template 'uninstall.rb', "#{plugin_path}/uninstall.rb"
34
+ m.template 'plugin.rb', "#{plugin_path}/lib/#{file_name}.rb"
35
+ m.template 'tasks.rake', "#{plugin_path}/tasks/#{file_name}_tasks.rake"
36
+ m.template 'unit_test.rb', "#{plugin_path}/test/#{file_name}_test.rb"
37
+ m.template 'test_helper.rb', "#{plugin_path}/test/test_helper.rb"
38
+ if @with_generator
39
+ m.directory "#{plugin_path}/generators"
40
+ m.directory "#{plugin_path}/generators/#{file_name}"
41
+ m.directory "#{plugin_path}/generators/#{file_name}/templates"
42
+
43
+ m.template 'generator.rb', "#{plugin_path}/generators/#{file_name}/#{file_name}_generator.rb"
44
+ m.template 'USAGE', "#{plugin_path}/generators/#{file_name}/USAGE"
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,20 @@
1
+ Copyright (c) <%= Date.today.year %> [name of plugin creator]
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,13 @@
1
+ <%= class_name %>
2
+ <%= "=" * class_name.size %>
3
+
4
+ Introduction goes here.
5
+
6
+
7
+ Example
8
+ =======
9
+
10
+ Example goes here.
11
+
12
+
13
+ Copyright (c) <%= Date.today.year %> [name of plugin creator], released under the MIT license
@@ -0,0 +1,23 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ desc 'Test the <%= file_name %> plugin.'
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << 'lib'
11
+ t.libs << 'test'
12
+ t.pattern = 'test/**/*_test.rb'
13
+ t.verbose = true
14
+ end
15
+
16
+ desc 'Generate documentation for the <%= file_name %> plugin.'
17
+ Rake::RDocTask.new(:rdoc) do |rdoc|
18
+ rdoc.rdoc_dir = 'rdoc'
19
+ rdoc.title = '<%= class_name %>'
20
+ rdoc.options << '--line-numbers' << '--inline-source'
21
+ rdoc.rdoc_files.include('README')
22
+ rdoc.rdoc_files.include('lib/**/*.rb')
23
+ end
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ ./script/generate <%= file_name %> Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -0,0 +1,8 @@
1
+ class <%= class_name %>Generator < Rails::Generator::NamedBase
2
+ def manifest
3
+ record do |m|
4
+ # m.directory "lib"
5
+ # m.template 'README', "README"
6
+ end
7
+ end
8
+ end
@@ -0,0 +1 @@
1
+ # Include hook code here
@@ -0,0 +1 @@
1
+ # Install hook code here
@@ -0,0 +1 @@
1
+ # <%= class_name %>
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :<%= file_name %> do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,3 @@
1
+ require 'rubygems'
2
+ require 'active_support'
3
+ require 'active_support/test_case'
@@ -0,0 +1 @@
1
+ # Uninstall hook code here
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class <%= class_name %>Test < ActiveSupport::TestCase
4
+ # Replace this with your real tests.
5
+ test "the truth" do
6
+ assert true
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class RailsEngineGeneratorTest < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'rails-engine-generator'
8
+
9
+ class Test::Unit::TestCase
10
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tschmidt-rails-engine-generator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Terry Schmidt
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-07-16 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: tschmidt@ext-inc.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - LICENSE
24
+ - README.rdoc
25
+ files:
26
+ - .document
27
+ - .gitignore
28
+ - LICENSE
29
+ - README.rdoc
30
+ - Rakefile
31
+ - VERSION
32
+ - lib/rails-engine-generator.rb
33
+ - rails_generators/engine_generator/USAGE
34
+ - rails_generators/engine_generator/engine_generator.rb
35
+ - rails_generators/engine_generator/templates/MIT-LICENSE
36
+ - rails_generators/engine_generator/templates/README
37
+ - rails_generators/engine_generator/templates/Rakefile
38
+ - rails_generators/engine_generator/templates/USAGE
39
+ - rails_generators/engine_generator/templates/generator.rb
40
+ - rails_generators/engine_generator/templates/init.rb
41
+ - rails_generators/engine_generator/templates/install.rb
42
+ - rails_generators/engine_generator/templates/plugin.rb
43
+ - rails_generators/engine_generator/templates/tasks.rake
44
+ - rails_generators/engine_generator/templates/test_helper.rb
45
+ - rails_generators/engine_generator/templates/uninstall.rb
46
+ - rails_generators/engine_generator/templates/unit_test.rb
47
+ - test/rails-engine-generator_test.rb
48
+ - test/test_helper.rb
49
+ has_rdoc: true
50
+ homepage: http://github.com/tschmidt/rails-engine-generator
51
+ post_install_message:
52
+ rdoc_options:
53
+ - --charset=UTF-8
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: "0"
61
+ version:
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: "0"
67
+ version:
68
+ requirements: []
69
+
70
+ rubyforge_project:
71
+ rubygems_version: 1.2.0
72
+ signing_key:
73
+ specification_version: 2
74
+ summary: Generate Rails Engines
75
+ test_files:
76
+ - test/rails-engine-generator_test.rb
77
+ - test/test_helper.rb