dummy_gen-rails 0.0.1

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/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in dummy_gen.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # DummyGen
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'dummy_gen-rails'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install dummy_gen-rails
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/dummy_gen.gemspec ADDED
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'dummy_gen/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "dummy_gen-rails"
8
+ gem.version = DummyGen::VERSION
9
+ gem.authors = ["Scott M. Kroll"]
10
+ gem.email = ["skroll@gmail.com"]
11
+ gem.description = %q{Generator for creating a dummy application for use in Rails 3 engine development.}
12
+ gem.summary = gem.description
13
+ gem.homepage = "https://github.com/skroll/dummy_gen-rails"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency "rails", "~> 3.2"
21
+ end
22
+
@@ -0,0 +1,91 @@
1
+ require "rails/generators"
2
+ require "rails/generators/rails/app/app_generator"
3
+ require "active_support/core_ext/hash/slice"
4
+
5
+ module DummyGen
6
+ module Generators
7
+ class DummyGenerator < Rails::Generators::Base
8
+ argument :engine_name, :type => :string
9
+
10
+ def self.source_paths
11
+ paths = self.superclass.source_paths
12
+ paths << File.expand_path("../dummy_templates", __FILE__)
13
+ paths.flatten
14
+ end
15
+
16
+ PASSTHROUGH_OPTIONS = [
17
+ :skip_active_record, :skip_javascript, :database, :javascript, :quiet,
18
+ :pretend, :force, :skip
19
+ ]
20
+
21
+ def generate_test_dummy
22
+ opts = (options || {}).slice(*PASSTHROUGH_OPTIONS)
23
+ opts[:force] = true
24
+ opts[:skip_bundle] = true
25
+
26
+ invoke Rails::Generators::AppGenerator,
27
+ [ File.expand_path(dummy_path, destination_root) ], opts
28
+ end
29
+
30
+ def test_dummy_clean
31
+ inside dummy_path do
32
+ remove_file ".gitignore"
33
+ remove_file "doc"
34
+ remove_file "Gemfile"
35
+ remove_file "lib/tasks"
36
+ remove_file "app"
37
+ remove_file "public/index.html"
38
+ remove_file "public/robots.txt"
39
+ remove_file "README.rdoc"
40
+ remove_file "test"
41
+ remove_file "vendor"
42
+ end
43
+ end
44
+
45
+ def test_dummy_config
46
+ directory "app", "#{dummy_path}/app"
47
+ template "Rakefile", "#{dummy_path}/Rakefile", :force => true
48
+ [ "application.rb", "boot.rb", "database.yml", "routes.rb" ].each do |t|
49
+ template "config/#{t}", "#{dummy_path}/config/#{t}", :force => true
50
+ end
51
+ template "config/initializers/engine_initializer.rb", "#{dummy_path}/config/initializers/#{engine_name}.rb", :force => true
52
+ end
53
+
54
+ protected
55
+ def engine_namespace
56
+ engine_name.camelize
57
+ end
58
+
59
+ def engine_mount
60
+ engine_name
61
+ end
62
+
63
+ def dummy_path
64
+ "spec/dummy"
65
+ end
66
+
67
+ def dummy_module_name
68
+ "Dummy"
69
+ end
70
+
71
+ def dummy_app_requires
72
+ [ "jquery_rails", "#{engine_name}", "#{engine_name}/engine" ]
73
+ end
74
+
75
+ def dummy_application_definition
76
+ @dummy_application_definition ||= begin
77
+ dummy_application_path = File.expand_path("#{dummy_path}/config/application.rb", destination_root)
78
+ unless options[:pretend] || !File.exists?(dummy_application_path)
79
+ contents = File.read(dummy_application_path)
80
+ contents[(contents.index("module #{dummy_module_name}"))..-1]
81
+ end
82
+ end
83
+ end
84
+
85
+ def gemfile_path
86
+ "../../../../Gemfile"
87
+ end
88
+ end
89
+ end
90
+ end
91
+
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env rake
2
+
3
+ require File.expand_path("../config/application", __FILE__)
4
+
5
+ <%= dummy_module_name %>::Application.load_tasks
6
+
@@ -0,0 +1,12 @@
1
+ require File.expand_path("../boot", __FILE__)
2
+
3
+ require "rails/all"
4
+
5
+ Bundler.require
6
+
7
+ <%- dummy_app_requires.each do |req| -%>
8
+ require "<%= req %>"
9
+ <%- end -%>
10
+
11
+ <%= dummy_application_definition %>
12
+
@@ -0,0 +1,11 @@
1
+ require "rubygems"
2
+ gemfile = File.expand_path("<%= gemfile_path %>", __FILE__)
3
+
4
+ if File.exist?(gemfile)
5
+ ENV["BUNDLE_GEMFILE"] = gemfile
6
+ require "bundler"
7
+ Bundler.setup
8
+ end
9
+
10
+ $:.unshift File.expand_path("../../../../lib", __FILE__)
11
+
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/production.sqlite3
24
+ pool: 5
25
+ timeout: 5000
@@ -0,0 +1,6 @@
1
+ Rails.application.routes.draw do
2
+ root :to => 'home#index'
3
+
4
+ mount <%= engine_namespace %>::Engine, :at => "/<%= engine_mount %>"
5
+ end
6
+
@@ -0,0 +1,9 @@
1
+ require "active_support/dependencies/autoload"
2
+
3
+ module DummyGen
4
+ module Generators
5
+ extend ::ActiveSupport::Autoload
6
+
7
+ autoload :DummyGenerator
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module DummyGen
2
+ VERSION = "0.0.1"
3
+ end
data/lib/dummy_gen.rb ADDED
@@ -0,0 +1,9 @@
1
+ require "dummy_gen/version"
2
+ require "active_support/dependencies/autoload"
3
+
4
+ module DummyGen
5
+ extend ::ActiveSupport::Autoload
6
+
7
+ autoload :Generators
8
+ end
9
+
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dummy_gen-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Scott M. Kroll
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-09-25 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.2'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3.2'
30
+ description: Generator for creating a dummy application for use in Rails 3 engine
31
+ development.
32
+ email:
33
+ - skroll@gmail.com
34
+ executables: []
35
+ extensions: []
36
+ extra_rdoc_files: []
37
+ files:
38
+ - .gitignore
39
+ - Gemfile
40
+ - README.md
41
+ - Rakefile
42
+ - dummy_gen.gemspec
43
+ - lib/dummy_gen.rb
44
+ - lib/dummy_gen/generators.rb
45
+ - lib/dummy_gen/generators/dummy_generator.rb
46
+ - lib/dummy_gen/generators/dummy_templates/Rakefile
47
+ - lib/dummy_gen/generators/dummy_templates/app/assets/.gitkeep
48
+ - lib/dummy_gen/generators/dummy_templates/app/controllers/.gitkeep
49
+ - lib/dummy_gen/generators/dummy_templates/app/helpers/.gitkeep
50
+ - lib/dummy_gen/generators/dummy_templates/app/models/.gitkeep
51
+ - lib/dummy_gen/generators/dummy_templates/app/views/.gitkeep
52
+ - lib/dummy_gen/generators/dummy_templates/config/application.rb
53
+ - lib/dummy_gen/generators/dummy_templates/config/boot.rb
54
+ - lib/dummy_gen/generators/dummy_templates/config/database.yml
55
+ - lib/dummy_gen/generators/dummy_templates/config/initializers/engine_initializer.rb
56
+ - lib/dummy_gen/generators/dummy_templates/config/routes.rb
57
+ - lib/dummy_gen/version.rb
58
+ homepage: https://github.com/skroll/dummy_gen-rails
59
+ licenses: []
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 1.8.23
79
+ signing_key:
80
+ specification_version: 3
81
+ summary: Generator for creating a dummy application for use in Rails 3 engine development.
82
+ test_files: []