dream_gens 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -2,6 +2,8 @@ h1. Dream Gens
2
2
 
3
3
  **Brought to you by rubyloves.me**
4
4
 
5
+ _If you enjoy these tools please give me a recommendation at: "working with rails!":http://www.workingwithrails.com/recommendation/new/person/10611_
6
+
5
7
  Please be restful. If you decide you want to leave the golden path you should fork this and make it so you can do your weird, non restful shit. These gens are purely an effort to get back to the original beauty of what drew many to rails, only updated for TDD/BDD using the technologies listed below.
6
8
 
7
9
  Step by step these generators will build the bare bones skeleton for a restfully designed resource to match a feature.
@@ -9,26 +11,43 @@ Step by step these generators will build the bare bones skeleton for a restfully
9
11
 
10
12
  h3. Generators for rapid rails development WITH testing!
11
13
 
12
- * HAML Views
13
- * Cucumber, Capybara, RSpec and Remarkable
14
+ Preconfigured for development using:
15
+
16
+ * HAML
17
+ * SASS
18
+ * Compass
19
+ * Cucumber
20
+ * Capybara
21
+ * RSpec
22
+ * FactoryGirl
23
+ * Remarkable
14
24
 
15
25
 
16
26
  h3. To install
27
+
28
+ As a gem (source: gemcutter.org)
29
+ <code>
30
+ gem install dream_gens
31
+ </code>
32
+
33
+ As a plugin (git)
17
34
  <code>
18
35
  git submodule add git://github.com/dreamr/dream_gens.git vender/plugins/dream_gens
19
36
  </code>
20
37
 
21
- h3. Usage - Dream Generatorsg
38
+ h3. Usage - Dream Generators
22
39
 
23
40
  For Outside-In developing using Dream-gens, cucumber and rspec:
24
41
  * generate a feature
25
42
  * define the feature
43
+ * generate a resource
44
+ * modify the spec to do something different than the norm
45
+ * modify the resource files to match your changed spec
46
+ * rinse and repeat
26
47
 
27
48
  h3. Generate a feature
28
49
 
29
50
  <code>./script/generate dream_feature FeatureName Domain</code>
30
- or
31
- <code>./script/generate df FeatureName Domain</code>
32
51
 
33
52
  eg.
34
53
  <code>./script/generate dream_feature user_logs_in authentication</code>
@@ -44,8 +63,6 @@ h3. Generate a model, migration and behavior specification file
44
63
  h2. To generate full rest views and routing
45
64
 
46
65
  <code>./script/generate dream_resource Resource [attribute:type, *]</code>
47
- or
48
- <code>./script/generate dr Resource [attribute:type, *]</code>
49
66
 
50
67
  eg.
51
68
  <code>./script/generate dream_resource User email:string crypted_password:string</code>
@@ -92,10 +109,10 @@ h2. Contributions
92
109
 
93
110
  Maintainer: "dreamr":http://github.com/dreamr
94
111
 
95
- Forked and modified from: "meskyanichi":http://github.com/meskyanichi
96
-
97
112
  h3. Contributers
98
113
 
99
- Fork, make a patch, notify me, get here.
114
+ * "meskyanichi":http://github.com/meskyanichi
100
115
  * "jsilver":http://github.com/jsilver
116
+ * "alexheaton":http://github.com/alexheaton
101
117
 
118
+ Fork, make a patch, notify me, get here.
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ Spec::Rake::SpecTask.new do |t|
8
8
  t.spec_files = FileList['test/**/*_spec.rb']
9
9
  end
10
10
 
11
- task :default => [:spec, :cucumber]
11
+ # task :default => [:spec, :cucumber]
12
12
 
13
13
  begin
14
14
  require 'jeweler'
data/install.rb CHANGED
@@ -1 +1,2 @@
1
- puts IO.read(File.join(File.dirname(__FILE__), 'README.textile'))
1
+ puts IO.read(File.join(File.dirname(__FILE__), 'README.textile'))
2
+ puts "\nPlease support the development of these tools by recommending me at working with rails!\n http://www.workingwithrails.com/recommendation/new/person/10611\n"
@@ -35,6 +35,7 @@ class DreamResourceGenerator < Rails::Generator::NamedBase
35
35
  end
36
36
 
37
37
  def rest_actions
38
+ @rest_actions = DreamResourceGenerator.rest_actions if @rest_actions.empty?
38
39
  @rest_actions
39
40
  end
40
41
 
@@ -100,7 +101,7 @@ protected
100
101
  def pop_rest_actions
101
102
  @args.each do |arg|
102
103
  next unless is_action?(arg)
103
- @rest_actions << arg
104
+ @rest_actions << ":#{arg}"
104
105
  end
105
106
  @args = (@args-@rest_actions)
106
107
  end
@@ -139,7 +140,7 @@ protected
139
140
  end
140
141
 
141
142
  def is_action?(val)
142
- DreamResourceGenerator.rest_actions.include?(val)
143
+ DreamResourceGenerator.rest_actions.include?(":#{val}")
143
144
  end
144
145
 
145
146
  def install_views(manifest)
@@ -13,7 +13,7 @@ class <%= plural_name.capitalize %>Controller < ApplicationController
13
13
  end
14
14
  EOS
15
15
  -%>
16
- <%= action if rest_actions.nil? || rest_actions.include?(":index") -%>
16
+ <%= action if rest_actions.include?(":index") -%>
17
17
  <% action = <<-EOS
18
18
 
19
19
  # GET /#{plural_name}/1
@@ -28,7 +28,7 @@ EOS
28
28
  end
29
29
  EOS
30
30
  -%>
31
- <%= action if rest_actions.nil? || rest_actions.include?(":show") -%>
31
+ <%= action if rest_actions.include?(":show") -%>
32
32
  <% action = <<-EOS
33
33
 
34
34
  # GET /#{plural_name}/new
@@ -43,7 +43,7 @@ EOS
43
43
  end
44
44
  EOS
45
45
  -%>
46
- <%= action if rest_actions.nil? || rest_actions.include?(":new") -%>
46
+ <%= action if rest_actions.include?(":new") -%>
47
47
  <% action = <<-EOS
48
48
 
49
49
  # GET /#{plural_name}/1/edit
@@ -52,7 +52,7 @@ EOS
52
52
  end
53
53
  EOS
54
54
  -%>
55
- <%= action if rest_actions.nil? || rest_actions.include?(":edit") -%>
55
+ <%= action if rest_actions.include?(":edit") -%>
56
56
  <% action = <<-EOS
57
57
 
58
58
  # POST /#{plural_name}
@@ -73,7 +73,7 @@ EOS
73
73
  end
74
74
  EOS
75
75
  -%>
76
- <%= action if rest_actions.nil? || rest_actions.include?(":create") -%>
76
+ <%= action if rest_actions.include?(":create") -%>
77
77
  <% action = <<-EOS
78
78
 
79
79
  # PUT /#{plural_name}/1
@@ -94,7 +94,7 @@ EOS
94
94
  end
95
95
  EOS
96
96
  -%>
97
- <%= action if rest_actions.nil? || rest_actions.include?(":update") -%>
97
+ <%= action if rest_actions.include?(":update") -%>
98
98
  <% action = <<-EOS
99
99
 
100
100
  # DELETE /#{plural_name}/1
@@ -110,5 +110,5 @@ EOS
110
110
  end
111
111
  EOS
112
112
  -%>
113
- <%= action if rest_actions.nil? || rest_actions.include?(":destroy") -%>
113
+ <%= action if rest_actions.include?(":destroy") -%>
114
114
  end
@@ -5,7 +5,7 @@ class Create<%= plural_name.capitalize %> < ActiveRecord::Migration
5
5
  <%= "t.#{attribute.try(:type)} :#{attribute.try(:name)}" %>
6
6
  <% end -%>
7
7
  end
8
- <% for index in indexes -%>
8
+ <% indexes.each do |index| -%>
9
9
  add_index :<%= plural_name %>, :<%= index %>
10
10
  <% end -%>
11
11
  end
@@ -1,7 +1,7 @@
1
1
  - semantic_form_for(resource) do |f|
2
2
  - f.inputs do
3
3
  <% attributes.each do |attribute| -%>
4
- <%= "= f.input #{attribute.try(:name)}" if attribute %>
4
+ <%= "= f.input :#{attribute.try(:name)}" if attribute %>
5
5
  <% end -%>
6
6
  - f.buttons do
7
7
  = f.commit_button
@@ -1,3 +1,3 @@
1
1
  %h1 Editing <%= singular_name %>
2
2
 
3
- = render :partial 'form', :object => @<%= singular_name %>
3
+ = render :partial => 'form', :object => @<%= singular_name %>
@@ -6,7 +6,7 @@
6
6
  <%= "%th #{attribute.try(:column).try(:human_name)}" if attribute %>
7
7
  <% end -%>
8
8
 
9
- - for <%= singular_name %> in @<%= plural_name %>
9
+ - @<%= plural_name %>.each do |<%= singular_name %>|
10
10
  %tr
11
11
  <% attributes.each do |attribute| -%>
12
12
  <%= "%td=#{singular_name}.#{attribute.try(:name)}" %>
@@ -1,3 +1,3 @@
1
1
  %h1 Creating <%= singular_name %>
2
2
 
3
- = render :partial 'form', :object => <%= singular_name.capitalize %>.new
3
+ = render :partial => 'form', :object => <%= singular_name.capitalize %>.new
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dream_gens
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dreamr (James OKelly)
@@ -26,9 +26,6 @@ files:
26
26
  - README.textile
27
27
  - Rakefile
28
28
  - install.rb
29
- - dream_gens.rb
30
- - rails_generators/df/df_generator.rb
31
- - rails_generators/dr/dr_generator.rb
32
29
  - rails_generators/dream_feature/dream_feature_generator.rb
33
30
  - rails_generators/dream_feature/templates/domain_steps.erb
34
31
  - rails_generators/dream_feature/templates/feature.erb
data/dream_gens.rb DELETED
@@ -1,3 +0,0 @@
1
- module Dreamr
2
- VERSION = "0.6.1"
3
- end
@@ -1,4 +0,0 @@
1
- require File.dirname(__FILE__) + "/../dream_feature/dream_feature_generator"
2
- module Dreamr
3
- class DfGenerator < DreamFeatureGenerator ; end
4
- end
@@ -1,4 +0,0 @@
1
- require File.dirname(__FILE__) + "/../dream_resource/dream_resource_generator"
2
- module Dreamr
3
- class DrGenerator < DreamResourceGenerator ; end
4
- end