lazy-head-gen 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -0
- data/Gemfile.lock +6 -0
- data/README.md +3 -3
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/lazy-head-gen.gemspec +7 -5
- data/lib/lazy-head-gen/templates/admin_controller_test/admin_controller_test.rb.tt +14 -6
- data/test/helper.rb +8 -4
- metadata +20 -7
- data/test/load_paths.rb +0 -6
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -14,6 +14,8 @@ GEM
|
|
14
14
|
bundler (~> 1.0)
|
15
15
|
git (>= 1.2.5)
|
16
16
|
rake
|
17
|
+
macaddr (1.6.1)
|
18
|
+
systemu (~> 2.5.0)
|
17
19
|
mail (2.3.3)
|
18
20
|
i18n (>= 0.4.0)
|
19
21
|
mime-types (~> 1.16)
|
@@ -57,6 +59,7 @@ GEM
|
|
57
59
|
rack (~> 1.3, >= 1.3.6)
|
58
60
|
rack-protection (~> 1.2)
|
59
61
|
tilt (~> 1.3, >= 1.3.3)
|
62
|
+
systemu (2.5.1)
|
60
63
|
thor (0.14.6)
|
61
64
|
tilt (1.3.3)
|
62
65
|
treetop (1.4.10)
|
@@ -66,6 +69,8 @@ GEM
|
|
66
69
|
ansi
|
67
70
|
url_mount (0.2.1)
|
68
71
|
rack
|
72
|
+
uuid (2.3.5)
|
73
|
+
macaddr (~> 1.0)
|
69
74
|
yard (0.6.8)
|
70
75
|
|
71
76
|
PLATFORMS
|
@@ -77,4 +82,5 @@ DEPENDENCIES
|
|
77
82
|
minitest
|
78
83
|
padrino
|
79
84
|
turn (~> 0.9.5)
|
85
|
+
uuid
|
80
86
|
yard (~> 0.6.0)
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# lazy-head-gen
|
2
2
|
|
3
|
-
lazy-head-gen provides some extra generators
|
3
|
+
lazy-head-gen provides some extra generators to [Padrino](https://github.com/padrino/padrino-framework).
|
4
4
|
|
5
|
-
It is assuming that you are using ActiveRecord and MiniTest, as that is the options we normally use in our development at [Head](http://www.headlondon.com).
|
5
|
+
It is currently assuming that you are using ActiveRecord and MiniTest, as that is the options we normally use in our development at [Head](http://www.headlondon.com).
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -19,7 +19,7 @@ gem 'lazy-head-gen', :group => [:development, :test]
|
|
19
19
|
Padrino gotcha: You'll need to put the `gem 'lazy-head-gen'` requirement *after* `gem 'padrino'` in your Gemfile.
|
20
20
|
lazy-head-gen depends on Padrino being loaded before it can do it's stuff.
|
21
21
|
|
22
|
-
Also you will need to add this gem for both :development and :test groups. There are a few bundled
|
22
|
+
Also you will need to add this gem for both :development and :test groups in your Gemfile. There are a few bundled test helper functions and assertions which are used by the test files that are generated.
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
data/Rakefile
CHANGED
@@ -17,8 +17,8 @@ Jeweler::Tasks.new do |gem|
|
|
17
17
|
gem.name = "lazy-head-gen"
|
18
18
|
gem.homepage = "http://github.com/sleepingstu/lazy-head-gen"
|
19
19
|
gem.license = "MIT"
|
20
|
-
gem.summary = %Q{Some extra generators for
|
21
|
-
gem.description = %Q{
|
20
|
+
gem.summary = %Q{Some extra generators for Padrino, using ActiveRecord and MiniTest.}
|
21
|
+
gem.description = %Q{lazy-head-gen adds some extra generators to Padrino. Currently it assumes you are using ActiveRecord and MiniTest.}
|
22
22
|
gem.email = "stuart.chinery@headlondon.com"
|
23
23
|
gem.authors = ["Stuart Chinery"]
|
24
24
|
# dependencies defined in Gemfile
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.2
|
data/lazy-head-gen.gemspec
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "lazy-head-gen"
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Stuart Chinery"]
|
12
|
-
s.date = "2012-07-
|
13
|
-
s.description = "
|
12
|
+
s.date = "2012-07-10"
|
13
|
+
s.description = "lazy-head-gen adds some extra generators to Padrino. Currently it assumes you are using ActiveRecord and MiniTest."
|
14
14
|
s.email = "stuart.chinery@headlondon.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE.txt",
|
@@ -39,14 +39,13 @@ Gem::Specification.new do |s|
|
|
39
39
|
"test/helper.rb",
|
40
40
|
"test/lazy-head-gen/test_admin_controller_test.rb",
|
41
41
|
"test/lazy-head-gen/test_scaffold.rb",
|
42
|
-
"test/load_paths.rb",
|
43
42
|
"test/test_lazy-head-gen.rb"
|
44
43
|
]
|
45
44
|
s.homepage = "http://github.com/sleepingstu/lazy-head-gen"
|
46
45
|
s.licenses = ["MIT"]
|
47
46
|
s.require_paths = ["lib"]
|
48
47
|
s.rubygems_version = "1.8.19"
|
49
|
-
s.summary = "Some extra generators for
|
48
|
+
s.summary = "Some extra generators for Padrino, using ActiveRecord and MiniTest."
|
50
49
|
|
51
50
|
if s.respond_to? :specification_version then
|
52
51
|
s.specification_version = 3
|
@@ -58,6 +57,7 @@ Gem::Specification.new do |s|
|
|
58
57
|
s.add_development_dependency(%q<bundler>, [">= 0"])
|
59
58
|
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
60
59
|
s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
|
60
|
+
s.add_development_dependency(%q<uuid>, [">= 0"])
|
61
61
|
else
|
62
62
|
s.add_dependency(%q<padrino>, [">= 0"])
|
63
63
|
s.add_dependency(%q<minitest>, [">= 0"])
|
@@ -65,6 +65,7 @@ Gem::Specification.new do |s|
|
|
65
65
|
s.add_dependency(%q<bundler>, [">= 0"])
|
66
66
|
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
67
67
|
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
68
|
+
s.add_dependency(%q<uuid>, [">= 0"])
|
68
69
|
end
|
69
70
|
else
|
70
71
|
s.add_dependency(%q<padrino>, [">= 0"])
|
@@ -73,6 +74,7 @@ Gem::Specification.new do |s|
|
|
73
74
|
s.add_dependency(%q<bundler>, [">= 0"])
|
74
75
|
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
75
76
|
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
77
|
+
s.add_dependency(%q<uuid>, [">= 0"])
|
76
78
|
end
|
77
79
|
end
|
78
80
|
|
@@ -32,7 +32,8 @@ describe "Admin::<%= @controller if @controller %>Controller" do
|
|
32
32
|
# START POST create
|
33
33
|
describe "Post create" do
|
34
34
|
before do
|
35
|
-
post "/admin/<%= @pluralized %>/create",
|
35
|
+
post "/admin/<%= @pluralized %>/create",
|
36
|
+
:<%= @singular %> => <%= @model %>.make.attributes
|
36
37
|
end
|
37
38
|
|
38
39
|
it "should not return the created text" do
|
@@ -45,6 +46,7 @@ describe "Admin::<%= @controller if @controller %>Controller" do
|
|
45
46
|
describe "GET edit" do
|
46
47
|
before do
|
47
48
|
@<%= @singular %> = <%= @model %>.make!
|
49
|
+
|
48
50
|
get "/admin/<%= @pluralized %>/edit/#{@<%= @singular %>.to_param}"
|
49
51
|
end
|
50
52
|
|
@@ -58,7 +60,9 @@ describe "Admin::<%= @controller if @controller %>Controller" do
|
|
58
60
|
describe "PUT update" do
|
59
61
|
before do
|
60
62
|
@<%= @singular %> = <%= @model %>.make!
|
61
|
-
|
63
|
+
|
64
|
+
put "/admin/<%= @pluralized %>/update/#{@<%= @singular %>.to_param}",
|
65
|
+
:<%= @singular %> => <%= @model %>.make.attributes
|
62
66
|
end
|
63
67
|
|
64
68
|
it "should not return the updated text" do
|
@@ -71,6 +75,7 @@ describe "Admin::<%= @controller if @controller %>Controller" do
|
|
71
75
|
describe "on DELETE destroy" do
|
72
76
|
before do
|
73
77
|
@<%= @singular %> = <%= @model %>.make!
|
78
|
+
|
74
79
|
get "/admin/<%= @pluralized %>/destroy/#{@<%= @singular %>.to_param}"
|
75
80
|
end
|
76
81
|
|
@@ -122,6 +127,7 @@ describe "Admin::<%= @controller if @controller %>Controller" do
|
|
122
127
|
describe "POST create" do
|
123
128
|
before do
|
124
129
|
@<%= @singular %>_count = <%= @model %>.count
|
130
|
+
|
125
131
|
post "/admin/<%= @pluralized %>/create", :<%= @singular %> => <%= @model %>.make.attributes
|
126
132
|
end
|
127
133
|
|
@@ -156,8 +162,11 @@ describe "Admin::<%= @controller if @controller %>Controller" do
|
|
156
162
|
before do
|
157
163
|
@<%= @singular %> = <%= @model %>.make!
|
158
164
|
@<%= @singular %>_count = <%= @model %>.count
|
159
|
-
|
160
|
-
|
165
|
+
|
166
|
+
put "/admin/<%= @pluralized %>/update/#{@<%= @singular %>.to_param}",
|
167
|
+
:<%= @singular %> => <%= @model %>.make.attributes
|
168
|
+
|
169
|
+
@<%= @singular %>.reload
|
161
170
|
end
|
162
171
|
|
163
172
|
it "should redirect to the edit page" do
|
@@ -165,8 +174,7 @@ describe "Admin::<%= @controller if @controller %>Controller" do
|
|
165
174
|
assert location.include?("/admin/<%= @pluralized %>/edit/#{@<%= @singular %>.to_param}")
|
166
175
|
end
|
167
176
|
|
168
|
-
it "should
|
169
|
-
assert_equal @updated_<%= @singular %>.id, @<%= @singular %>.id
|
177
|
+
it "should not create a new a <%= @singular %>" do
|
170
178
|
assert_equal @<%= @singular %>_count, <%= @model %>.count
|
171
179
|
end
|
172
180
|
end
|
data/test/helper.rb
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
ENV['PADRINO_ENV'] = 'test'
|
2
2
|
PADRINO_ROOT = File.dirname(__FILE__) unless defined? PADRINO_ROOT
|
3
3
|
|
4
|
-
|
4
|
+
if defined?(Gem)
|
5
|
+
gem 'bundler'
|
6
|
+
else
|
7
|
+
require 'rubygems'
|
8
|
+
end
|
9
|
+
require 'bundler/setup'
|
10
|
+
|
5
11
|
require 'minitest/autorun'
|
6
|
-
require 'rack/test'
|
12
|
+
# require 'rack/test'
|
7
13
|
require 'rack'
|
8
14
|
require 'uuid'
|
9
15
|
require 'thor/group'
|
@@ -30,8 +36,6 @@ end
|
|
30
36
|
#end
|
31
37
|
|
32
38
|
class MiniTest::Unit::TestCase
|
33
|
-
include Rack::Test::Methods
|
34
|
-
|
35
39
|
# Sets up a Sinatra::Base subclass defined with the block
|
36
40
|
# given. Used in setup or individual spec methods to establish
|
37
41
|
# the application.
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lazy-head-gen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 2
|
10
|
+
version: 0.4.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Stuart Chinery
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-07-
|
18
|
+
date: 2012-07-10 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
type: :runtime
|
@@ -107,7 +107,21 @@ dependencies:
|
|
107
107
|
version_requirements: *id006
|
108
108
|
name: yard
|
109
109
|
prerelease: false
|
110
|
-
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
type: :development
|
112
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
hash: 3
|
118
|
+
segments:
|
119
|
+
- 0
|
120
|
+
version: "0"
|
121
|
+
version_requirements: *id007
|
122
|
+
name: uuid
|
123
|
+
prerelease: false
|
124
|
+
description: lazy-head-gen adds some extra generators to Padrino. Currently it assumes you are using ActiveRecord and MiniTest.
|
111
125
|
email: stuart.chinery@headlondon.com
|
112
126
|
executables: []
|
113
127
|
|
@@ -139,7 +153,6 @@ files:
|
|
139
153
|
- test/helper.rb
|
140
154
|
- test/lazy-head-gen/test_admin_controller_test.rb
|
141
155
|
- test/lazy-head-gen/test_scaffold.rb
|
142
|
-
- test/load_paths.rb
|
143
156
|
- test/test_lazy-head-gen.rb
|
144
157
|
homepage: http://github.com/sleepingstu/lazy-head-gen
|
145
158
|
licenses:
|
@@ -173,6 +186,6 @@ rubyforge_project:
|
|
173
186
|
rubygems_version: 1.8.19
|
174
187
|
signing_key:
|
175
188
|
specification_version: 3
|
176
|
-
summary: Some extra generators for
|
189
|
+
summary: Some extra generators for Padrino, using ActiveRecord and MiniTest.
|
177
190
|
test_files: []
|
178
191
|
|