engen 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "http://rubygems.org"
2
+
3
+ group :development do
4
+ gem "bundler", "~> 1.0.0"
5
+ gem "jeweler", "~> 1.6.2"
6
+ gem "git"
7
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Josh McArthur
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.md ADDED
@@ -0,0 +1,42 @@
1
+ Engen
2
+ =====
3
+
4
+ Engen is a simple implementation of a Ruby on Rails engine generator designed for Rails 3.
5
+ It generates the basic structure of a Rails engine, including an engine.rb file.
6
+ It also injects a gem requirement into your Gemfile that points to your new engine.
7
+
8
+ Usage
9
+ -----
10
+
11
+ `rails generate engine NAME`
12
+
13
+
14
+ Installation
15
+ ------------
16
+
17
+ `gem install engen`
18
+
19
+
20
+ Source Code
21
+ -----------
22
+
23
+ https://github.com/joshmcarthur/engen
24
+
25
+ Contributing
26
+ ------------
27
+
28
+ If you find a bug, or something is not generated that should be, please follow the steps below:
29
+
30
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
31
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
32
+ * Fork the project
33
+ * Start a feature/bugfix branch
34
+ * Commit and push until you are happy with your contribution
35
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
36
+
37
+ Copyright
38
+ ---------
39
+
40
+ Copyright (c) 2011 Josh McArthur. See LICENSE.txt for
41
+ further details.
42
+
data/Rakefile ADDED
@@ -0,0 +1,36 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "engen"
18
+ gem.homepage = "http://github.com/joshmcarthur/engen"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Rails 3 Engine Generator}
21
+ gem.description = %Q{A gem for Ruby on Rails 3 that adds an engine generator for easy code extension}
22
+ gem.email = "joshua.mcarthur@gmail.com"
23
+ gem.authors = ["Josh McArthur"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/rdoctask'
29
+ Rake::RDocTask.new do |rdoc|
30
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
31
+
32
+ rdoc.rdoc_dir = 'rdoc'
33
+ rdoc.title = "engen #{version}"
34
+ rdoc.rdoc_files.include('README*')
35
+ rdoc.rdoc_files.include('lib/**/*.rb')
36
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/engen.gemspec ADDED
@@ -0,0 +1,63 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{engen}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Josh McArthur"]
12
+ s.date = %q{2011-06-03}
13
+ s.description = %q{A gem for Ruby on Rails 3 that adds an engine generator for easy code extension}
14
+ s.email = %q{joshua.mcarthur@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "LICENSE.txt",
23
+ "README.md",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "engen.gemspec",
27
+ "lib/generators/engine/USAGE",
28
+ "lib/generators/engine/engine_generator.rb",
29
+ "lib/generators/engine/templates/Gemfile",
30
+ "lib/generators/engine/templates/engine.gemspec.tt",
31
+ "lib/generators/engine/templates/gitignore.tt",
32
+ "lib/generators/engine/templates/lib/%file_name%.rb.tt",
33
+ "lib/generators/engine/templates/lib/engine.rb.tt",
34
+ "lib/generators/engine/templates/lib/tasks/%file_name%.rake.tt",
35
+ "lib/generators/engine/templates/routes.rb",
36
+ "test/helper.rb",
37
+ "test/test_engen.rb"
38
+ ]
39
+ s.homepage = %q{http://github.com/joshmcarthur/engen}
40
+ s.licenses = ["MIT"]
41
+ s.require_paths = ["lib"]
42
+ s.rubygems_version = %q{1.6.0}
43
+ s.summary = %q{Rails 3 Engine Generator}
44
+
45
+ if s.respond_to? :specification_version then
46
+ s.specification_version = 3
47
+
48
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
49
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
50
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.2"])
51
+ s.add_development_dependency(%q<git>, [">= 0"])
52
+ else
53
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
54
+ s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
55
+ s.add_dependency(%q<git>, [">= 0"])
56
+ end
57
+ else
58
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
59
+ s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
60
+ s.add_dependency(%q<git>, [">= 0"])
61
+ end
62
+ end
63
+
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Generates a Rails 3-compatible engine for neat extension.
3
+
4
+ Example:
5
+ rails generate engine WidgetEngine
6
+
7
+ This will create:
8
+ vendor/engines/widget_engine
@@ -0,0 +1,42 @@
1
+ class EngineGenerator < Rails::Generators::NamedBase
2
+ source_root File.expand_path('../templates', __FILE__)
3
+
4
+ desc "Creates a new Rails 3 engine with the name you specify"
5
+ check_class_collision
6
+
7
+ def create_application_files
8
+ empty_directory file_name
9
+ empty_directory engine_dir('app')
10
+ %w(controllers helpers models views).each do |app_dir|
11
+ empty_directory engine_dir("app/#{app_dir}")
12
+ end
13
+ empty_directory "#{file_name}/config"
14
+ empty_directory "#{file_name}/public"
15
+ template "Gemfile", "#{file_name}/Gemfile"
16
+ template "gitignore.tt", "#{file_name}/.gitignore"
17
+ template "engine.gemspec.tt", "#{file_name}/#{file_name}.gemspec"
18
+ end
19
+
20
+ def create_routes
21
+ template "routes.rb", "#{file_name}/config/routes.rb"
22
+ end
23
+
24
+ def create_lib_files
25
+ directory "lib", "#{file_name}/lib"
26
+ end
27
+
28
+ def add_to_gemfile
29
+ gem file_name, :path => file_name, :require => file_name
30
+ end
31
+
32
+ protected
33
+
34
+ def engine_dir(file_to_join = nil)
35
+ if file_to_join
36
+ File.join(file_name, file_to_join)
37
+ else
38
+ file_name
39
+ end
40
+ end
41
+
42
+ end
File without changes
@@ -0,0 +1,17 @@
1
+ Gem::Specification.new do |s|
2
+ s.platform = Gem::Platform::RUBY
3
+ s.name = '<%= file_name %>'
4
+ s.summary = 'Add gem summary here'
5
+ s.description = 'Add (optional) gem description here'
6
+ s.required_ruby_version = '>= 1.8.7'
7
+
8
+ # s.author = 'David Heinemeier Hansson'
9
+ # s.email = 'david@loudthinking.com'
10
+ # s.homepage = 'http://www.rubyonrails.org'
11
+ # s.rubyforge_project = 'actionmailer'
12
+
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ s.require_path = 'lib'
16
+ s.requirements << 'none'
17
+ end
File without changes
@@ -0,0 +1,3 @@
1
+ module <%= class_name %>
2
+ require 'engine' if defined?(Rails) && Rails::VERSION::MAJOR == 3
3
+ end
@@ -0,0 +1,14 @@
1
+ module <%= class_name %>
2
+ class Engine << Rails::Engine
3
+ config.autoload_paths += %W(#{config.root}/lib)
4
+
5
+ def self.activate
6
+ Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
7
+ Rails.env.production? ? require(c) : load(c)
8
+ end
9
+ end
10
+
11
+ config.to_prepare &method(:activate).to_proc
12
+ end
13
+ end
14
+
@@ -0,0 +1 @@
1
+ # add custom rake tasks here
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ # Add your engine routes here
3
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'engen'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestEngen < 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
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: engen
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.0
6
+ platform: ruby
7
+ authors:
8
+ - Josh McArthur
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-06-03 00:00:00 +12:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: bundler
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 1.0.0
24
+ type: :development
25
+ prerelease: false
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: jeweler
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: 1.6.2
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: git
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ type: :development
47
+ prerelease: false
48
+ version_requirements: *id003
49
+ description: A gem for Ruby on Rails 3 that adds an engine generator for easy code extension
50
+ email: joshua.mcarthur@gmail.com
51
+ executables: []
52
+
53
+ extensions: []
54
+
55
+ extra_rdoc_files:
56
+ - LICENSE.txt
57
+ - README.md
58
+ files:
59
+ - .document
60
+ - Gemfile
61
+ - LICENSE.txt
62
+ - README.md
63
+ - Rakefile
64
+ - VERSION
65
+ - engen.gemspec
66
+ - lib/generators/engine/USAGE
67
+ - lib/generators/engine/engine_generator.rb
68
+ - lib/generators/engine/templates/Gemfile
69
+ - lib/generators/engine/templates/engine.gemspec.tt
70
+ - lib/generators/engine/templates/gitignore.tt
71
+ - lib/generators/engine/templates/lib/%file_name%.rb.tt
72
+ - lib/generators/engine/templates/lib/engine.rb.tt
73
+ - lib/generators/engine/templates/lib/tasks/%file_name%.rake.tt
74
+ - lib/generators/engine/templates/routes.rb
75
+ - test/helper.rb
76
+ - test/test_engen.rb
77
+ has_rdoc: true
78
+ homepage: http://github.com/joshmcarthur/engen
79
+ licenses:
80
+ - MIT
81
+ post_install_message:
82
+ rdoc_options: []
83
+
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ hash: 3080607472256692967
92
+ segments:
93
+ - 0
94
+ version: "0"
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: "0"
101
+ requirements: []
102
+
103
+ rubyforge_project:
104
+ rubygems_version: 1.6.0
105
+ signing_key:
106
+ specification_version: 3
107
+ summary: Rails 3 Engine Generator
108
+ test_files: []
109
+