rails-dummy 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
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 rails-dummy.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Stas SUȘCOV
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # Rails::Dummy
2
+
3
+ A simple task to generate a dummy app for engines using RSpec or Test::Unit.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'rails-dummy'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install rails-dummy
18
+
19
+ ## Usage
20
+
21
+ Add this to your `Rakefile`
22
+
23
+ require 'rails/dummy/tasks'
24
+
25
+ Now you should be able to run:
26
+
27
+ rake dummy:app
28
+
29
+ You can use environment variables `DUMMY_PATH` and `ENGINE` to specify the
30
+ engine name migrations to run and the path for the dummy app.
31
+
32
+ You can also use a Rails template by passing `TEMPLATE` environment variable.
33
+
34
+ ## Contributing
35
+
36
+ 1. Fork it
37
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
38
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
39
+ 4. Push to the branch (`git push origin my-new-feature`)
40
+ 5. Create new Pull Request
41
+
42
+ ## Credits
43
+
44
+ This gem was extracted from the [http://coursewa.re](Coursewa.re) project.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,7 @@
1
+ require "rails/dummy/version"
2
+
3
+ module Rails
4
+ module Dummy
5
+ # Your code goes here...
6
+ end
7
+ end
@@ -0,0 +1,30 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/rails/plugin_new/plugin_new_generator'
3
+ require "rails/dummy/version"
4
+
5
+ module Rails
6
+ module Dummy
7
+
8
+ class Generator < Rails::Generators::PluginNewGenerator
9
+ def self.default_source_root
10
+ Rails::Generators::PluginNewGenerator.default_source_root
11
+ end
12
+
13
+ def do_nothing
14
+ end
15
+
16
+ alias :create_root :do_nothing
17
+ alias :create_root_files :do_nothing
18
+ alias :create_app_files :do_nothing
19
+ alias :create_config_files :do_nothing
20
+ alias :create_lib_files :do_nothing
21
+ alias :create_public_stylesheets_files :do_nothing
22
+ alias :create_javascript_files :do_nothing
23
+ alias :create_script_files :do_nothing
24
+ alias :update_gemfile :do_nothing
25
+ alias :create_test_files :do_nothing
26
+ alias :finish_template :do_nothing
27
+
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,16 @@
1
+ require 'rails/dummy/generator'
2
+
3
+ module Rails
4
+ module Dummy
5
+ module Tasks
6
+ def self.install(tasks_path)
7
+ Dir[tasks_path].each { |task| load(task) }
8
+ end
9
+ end
10
+ end
11
+ end
12
+
13
+ if defined?(Rake)
14
+ tasks_path = File.expand_path('../../../tasks/*.rake', __FILE__)
15
+ Rails::Dummy::Tasks.install(tasks_path)
16
+ end
@@ -0,0 +1,5 @@
1
+ module Rails
2
+ module Dummy
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,40 @@
1
+ namespace :dummy do
2
+ desc 'Generates a dummy app for testing. Use options: `DUMMY_PATH` and `ENGINE`'
3
+ task :app => [:setup, :template, :install_migrations, :migrate]
4
+
5
+ task :setup do
6
+ path = ENV['DUMMY_PATH'] || 'spec/dummy'
7
+ dummy = File.expand_path(path)
8
+
9
+ sh("rm -rf #{dummy}")
10
+ Rails::Dummy::Generator.start(
11
+ %W(. -q -f --skip-bundle -T -G --dummy-path=#{dummy})
12
+ )
13
+ end
14
+
15
+ task :template do
16
+ unless ENV['TEMPLATE']
17
+ puts 'No `TEMPLATE` environment variable was set, no template to apply.'
18
+ else
19
+ rakefile = File.expand_path('Rakefile')
20
+ template = File.expand_path(ENV['TEMPLATE'], '../../')
21
+ sh("rake -f #{rakefile} rails:template LOCATION=#{template}")
22
+ end
23
+ end
24
+
25
+ task :install_migrations do
26
+ engine = ENV['ENGINE']
27
+ unless engine
28
+ puts 'No `ENGINE` environment variable was set, no migrations to install.'
29
+ else
30
+ rakefile = File.expand_path('Rakefile')
31
+ sh("rake -f #{rakefile} #{engine.downcase}:install:migrations")
32
+ end
33
+ end
34
+
35
+ task :migrate do
36
+ rakefile = File.expand_path('Rakefile')
37
+ sh("rake -f #{rakefile} db:create db:migrate db:test:prepare")
38
+ end
39
+
40
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rails/dummy/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rails-dummy"
8
+ spec.version = Rails::Dummy::VERSION
9
+ spec.authors = ["Stas SUȘCOV"]
10
+ spec.email = ["stas@net.utcluj.ro"]
11
+ spec.description = %q{Rake task to generate a dummy Rails app.}
12
+ spec.summary = %q{Use it to generate a dummy app for RSpec}
13
+ spec.homepage = "https://github.com/courseware/rails-dummy"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "rails"
22
+
23
+ spec.add_development_dependency "bundler"
24
+ spec.add_development_dependency "rake"
25
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails-dummy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Stas SUȘCOV
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-05-21 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: '0'
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: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: bundler
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: Rake task to generate a dummy Rails app.
63
+ email:
64
+ - stas@net.utcluj.ro
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - .gitignore
70
+ - Gemfile
71
+ - LICENSE.txt
72
+ - README.md
73
+ - Rakefile
74
+ - lib/rails/dummy.rb
75
+ - lib/rails/dummy/generator.rb
76
+ - lib/rails/dummy/tasks.rb
77
+ - lib/rails/dummy/version.rb
78
+ - lib/tasks/dummy.rake
79
+ - rails-dummy.gemspec
80
+ homepage: https://github.com/courseware/rails-dummy
81
+ licenses:
82
+ - MIT
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ! '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ segments:
94
+ - 0
95
+ hash: -640637521
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ segments:
103
+ - 0
104
+ hash: -640637521
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 1.8.23
108
+ signing_key:
109
+ specification_version: 3
110
+ summary: Use it to generate a dummy app for RSpec
111
+ test_files: []