dummier 0.1.0.rc1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -1
- data/README.md +54 -26
- data/dummier.gemspec +1 -2
- data/lib/dummier.rb +2 -0
- data/lib/dummier/app_generator.rb +0 -1
- data/lib/dummier/version.rb +1 -1
- data/test/dummy_gem/Gemfile +2 -0
- data/test/dummy_gem/dummy_gem.gemspec +7 -0
- data/test/dummy_gem/lib/dummy_gem.rb +3 -0
- data/test/dummy_gem/lib/dummy_hooks/after_app_generator.rb +1 -0
- data/test/dummy_gem/lib/dummy_hooks/after_migrate.rb +1 -0
- data/test/dummy_gem/lib/dummy_hooks/before_app_generator.rb +1 -0
- data/test/dummy_gem/lib/dummy_hooks/before_delete.rb +1 -0
- data/test/dummy_gem/lib/dummy_hooks/before_migrate.rb +1 -0
- data/test/test_helper.rb +4 -16
- data/test/unit/dummier_test.rb +19 -6
- metadata +26 -20
- data/lib/dummier/tasks/builder.rb +0 -7
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,23 +1,62 @@
|
|
1
1
|
Dummier
|
2
2
|
=======
|
3
3
|
|
4
|
-
|
4
|
+
A smart gem with a dumb name; Dummier is a rails generator for automating the creation of rails testing applications.
|
5
5
|
|
6
|
-
|
6
|
+
Dummier was inspired by [José Valim](https://github.com/josevalim)'s [enginex](https://github.com/josevalim/enginex) which creates a standard gem structure for you. Enginex creates a `test/dummy` app for you, but what if we want to re-create it? Or leave it out of git?
|
7
7
|
|
8
|
-
|
8
|
+
The idea behind Dummier is that we don't check `test/dummy` into git, but rather generate it on the fly for the gems we're developing. It just seems [DRY](http://en.wikipedia.org/wiki/Don't_repeat_yourself)'er that way.
|
9
9
|
|
10
|
-
|
10
|
+
Dummier is simple; just run the binary from your gem's root directory and it will generate a stripped-down & gem-dev-ready rails app in `test/dummy`. While it's doing it's thing, Dummer triggers a few hooks along the way for easy customization.
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
That's all for now.
|
12
|
+
To catch the hooks, just create appropriatly named files in `lib/dummy_hooks` inside your gem. See [Hooks](#readme-hooks) below for more info.
|
15
13
|
|
16
14
|
|
17
15
|
Installation
|
18
16
|
------------
|
19
17
|
|
20
|
-
|
18
|
+
To install from RubyGems:
|
19
|
+
|
20
|
+
gem install dummier
|
21
|
+
|
22
|
+
|
23
|
+
To package for development in your gemspec:
|
24
|
+
|
25
|
+
s.add_development_dependency('dummier', '>= 0.1.0')
|
26
|
+
|
27
|
+
|
28
|
+
Usage
|
29
|
+
-----
|
30
|
+
|
31
|
+
After you've installed Dummier, just cd into the gem your developing and run:
|
32
|
+
|
33
|
+
bundle exec dummier
|
34
|
+
|
35
|
+
|
36
|
+
<h2 id="readme-hooks">Hooks</h2>
|
37
|
+
|
38
|
+
Dummier calls the follow hooks along the way:
|
39
|
+
|
40
|
+
before_delete
|
41
|
+
before_app_generator
|
42
|
+
after_app_generator
|
43
|
+
before_migrate
|
44
|
+
after_migrate
|
45
|
+
|
46
|
+
Place appropriatly named files in `lib/dummy_hooks` and dummier will find and execute them automatically!
|
47
|
+
|
48
|
+
You can use [Rails::Generators::Actions](http://api.rubyonrails.org/classes/Rails/Generators/Actions.html) as well as [Thor::Actions](http://textmate.rubyforge.org/thor/Thor/Actions.html) in your hooks. Also, since hooks are just `eval`'d into the Dummer::AppGenerator, you have access to all of [those methods](http://rubydoc.info/gems/dummier/0.1.0/Dummier/AppGenerator) as well.
|
49
|
+
|
50
|
+
|
51
|
+
### Example:
|
52
|
+
|
53
|
+
Here's a `before_migrate.rb` hook that will install [Spree Commerce](https://github.com/spree/spree) by running some rake commands before migrating the `test/dummy` database.
|
54
|
+
|
55
|
+
# lib/dummy_hooks/before_migrate.rb
|
56
|
+
say_status "installing", "spree_core, spree_auth and spree_sample"
|
57
|
+
rake "spree_core:install spree_auth:install spree_sample:install"
|
58
|
+
|
59
|
+
|
21
60
|
|
22
61
|
|
23
62
|
Testing
|
@@ -30,33 +69,22 @@ To get setup for testing, clone this repo, bundle up and run rake.
|
|
30
69
|
bundle install
|
31
70
|
rake
|
32
71
|
|
33
|
-
Or do this if you want to spork:
|
34
|
-
|
35
|
-
git clone git://github.com/citrus/dummier.git
|
36
|
-
cd dummier
|
37
|
-
bundle install
|
38
|
-
bundle exec spork
|
39
|
-
|
40
|
-
# in another window
|
41
|
-
cd back/to/dummier
|
42
|
-
testdrb test/**/*_test.rb
|
43
|
-
|
44
72
|
Enjoy!
|
45
73
|
|
46
74
|
|
47
75
|
|
48
|
-
To Do
|
49
|
-
-----
|
50
|
-
|
51
|
-
* testing..
|
52
|
-
* get migrate task to work
|
53
|
-
|
54
|
-
|
55
76
|
Change Log
|
56
77
|
----------
|
57
78
|
|
79
|
+
**2011/5/20**
|
80
|
+
|
81
|
+
* released 0.1.0 to rubygems
|
82
|
+
* removed spork and wrote a basic hook test
|
83
|
+
* improved documentation
|
84
|
+
|
58
85
|
**2011/5/11**
|
59
86
|
|
87
|
+
* released 0.1.0.rc1 to rubygems
|
60
88
|
* added spork and some tests
|
61
89
|
|
62
90
|
**2011/5/10**
|
data/dummier.gemspec
CHANGED
@@ -22,7 +22,6 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_dependency('rails', '>= 3.0.0')
|
23
23
|
|
24
24
|
s.add_development_dependency('shoulda', '>= 2.11.3')
|
25
|
-
s.add_development_dependency('
|
26
|
-
s.add_development_dependency('spork-testunit', '>= 0.0.5')
|
25
|
+
s.add_development_dependency('sqlite3', '>= 1.3.3')
|
27
26
|
|
28
27
|
end
|
data/lib/dummier.rb
CHANGED
data/lib/dummier/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
HookTestHelper.register :after_app_generator
|
@@ -0,0 +1 @@
|
|
1
|
+
HookTestHelper.register :after_migrate
|
@@ -0,0 +1 @@
|
|
1
|
+
HookTestHelper.register :before_app_generator
|
@@ -0,0 +1 @@
|
|
1
|
+
HookTestHelper.register :before_delete
|
@@ -0,0 +1 @@
|
|
1
|
+
HookTestHelper.register :before_migrate
|
data/test/test_helper.rb
CHANGED
@@ -1,16 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
require 'bundler/setup'
|
7
|
-
Bundler.require(:default, :test)
|
8
|
-
require 'shoulda'
|
9
|
-
|
10
|
-
end
|
11
|
-
|
12
|
-
Spork.each_run do
|
13
|
-
|
14
|
-
#Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
15
|
-
|
16
|
-
end
|
1
|
+
require 'bundler/setup'
|
2
|
+
Bundler.require(:default, :test)
|
3
|
+
require 'shoulda'
|
4
|
+
require 'fileutils'
|
data/test/unit/dummier_test.rb
CHANGED
@@ -1,9 +1,23 @@
|
|
1
1
|
require_relative '../test_helper'
|
2
2
|
|
3
|
+
module HookTestHelper
|
4
|
+
extend self
|
5
|
+
|
6
|
+
def register(hook)
|
7
|
+
hooks << hook
|
8
|
+
end
|
9
|
+
|
10
|
+
def hooks
|
11
|
+
@hooks ||= []
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
|
3
17
|
class DummierTest < Test::Unit::TestCase
|
4
18
|
|
5
19
|
def setup
|
6
|
-
@root = File.expand_path("
|
20
|
+
@root = File.expand_path("../../dummy_gem", __FILE__)
|
7
21
|
@dummy = File.join(@root, "test/dummy")
|
8
22
|
end
|
9
23
|
|
@@ -36,7 +50,7 @@ class DummierTest < Test::Unit::TestCase
|
|
36
50
|
|
37
51
|
# make sure application template is applied
|
38
52
|
rb = read_file('config/application.rb')
|
39
|
-
[ "require File.expand_path('../boot', __FILE__)", /require "
|
53
|
+
[ "require File.expand_path('../boot', __FILE__)", /require "dummy_gem"/, /module Dummy/ ].each do |regex|
|
40
54
|
assert_match regex, rb
|
41
55
|
end
|
42
56
|
|
@@ -46,10 +60,9 @@ class DummierTest < Test::Unit::TestCase
|
|
46
60
|
assert_match regex, rb
|
47
61
|
end
|
48
62
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
# todo
|
63
|
+
# make sure hooks are all registered and in proper order
|
64
|
+
assert_equal [:before_delete, :before_app_generator, :after_app_generator, :before_migrate, :after_migrate], HookTestHelper.hooks
|
65
|
+
|
53
66
|
end
|
54
67
|
|
55
68
|
end
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dummier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
version: 0.1.0
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Spencer Steffen
|
@@ -10,7 +10,8 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-05-
|
13
|
+
date: 2011-05-20 00:00:00 -07:00
|
14
|
+
default_executable:
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: rails
|
@@ -35,27 +36,16 @@ dependencies:
|
|
35
36
|
type: :development
|
36
37
|
version_requirements: *id002
|
37
38
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
39
|
+
name: sqlite3
|
39
40
|
prerelease: false
|
40
41
|
requirement: &id003 !ruby/object:Gem::Requirement
|
41
42
|
none: false
|
42
43
|
requirements:
|
43
44
|
- - ">="
|
44
45
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
46
|
+
version: 1.3.3
|
46
47
|
type: :development
|
47
48
|
version_requirements: *id003
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: spork-testunit
|
50
|
-
prerelease: false
|
51
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
-
none: false
|
53
|
-
requirements:
|
54
|
-
- - ">="
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: 0.0.5
|
57
|
-
type: :development
|
58
|
-
version_requirements: *id004
|
59
49
|
description: Dummier is a rails generator for automating the creation of rails testing applications.
|
60
50
|
email:
|
61
51
|
- spencer@citrusme.com
|
@@ -75,12 +65,20 @@ files:
|
|
75
65
|
- dummier.gemspec
|
76
66
|
- lib/dummier.rb
|
77
67
|
- lib/dummier/app_generator.rb
|
78
|
-
- lib/dummier/tasks/builder.rb
|
79
68
|
- lib/dummier/version.rb
|
80
69
|
- lib/templates/rails/application.rb
|
81
70
|
- lib/templates/rails/boot.rb
|
71
|
+
- test/dummy_gem/Gemfile
|
72
|
+
- test/dummy_gem/dummy_gem.gemspec
|
73
|
+
- test/dummy_gem/lib/dummy_gem.rb
|
74
|
+
- test/dummy_gem/lib/dummy_hooks/after_app_generator.rb
|
75
|
+
- test/dummy_gem/lib/dummy_hooks/after_migrate.rb
|
76
|
+
- test/dummy_gem/lib/dummy_hooks/before_app_generator.rb
|
77
|
+
- test/dummy_gem/lib/dummy_hooks/before_delete.rb
|
78
|
+
- test/dummy_gem/lib/dummy_hooks/before_migrate.rb
|
82
79
|
- test/test_helper.rb
|
83
80
|
- test/unit/dummier_test.rb
|
81
|
+
has_rdoc: true
|
84
82
|
homepage: https://github.com/citrus/dummier
|
85
83
|
licenses: []
|
86
84
|
|
@@ -98,16 +96,24 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
97
|
none: false
|
100
98
|
requirements:
|
101
|
-
- - "
|
99
|
+
- - ">="
|
102
100
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
101
|
+
version: "0"
|
104
102
|
requirements: []
|
105
103
|
|
106
104
|
rubyforge_project: dummier
|
107
|
-
rubygems_version: 1.
|
105
|
+
rubygems_version: 1.6.2
|
108
106
|
signing_key:
|
109
107
|
specification_version: 3
|
110
108
|
summary: Dummier generates a minimal rails testing application.
|
111
109
|
test_files:
|
110
|
+
- test/dummy_gem/Gemfile
|
111
|
+
- test/dummy_gem/dummy_gem.gemspec
|
112
|
+
- test/dummy_gem/lib/dummy_gem.rb
|
113
|
+
- test/dummy_gem/lib/dummy_hooks/after_app_generator.rb
|
114
|
+
- test/dummy_gem/lib/dummy_hooks/after_migrate.rb
|
115
|
+
- test/dummy_gem/lib/dummy_hooks/before_app_generator.rb
|
116
|
+
- test/dummy_gem/lib/dummy_hooks/before_delete.rb
|
117
|
+
- test/dummy_gem/lib/dummy_hooks/before_migrate.rb
|
112
118
|
- test/test_helper.rb
|
113
119
|
- test/unit/dummier_test.rb
|