scaffoldhub 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- scaffoldhub (0.1.0)
4
+ scaffoldhub (0.1.1)
5
5
  rails
6
6
 
7
7
  GEM
@@ -0,0 +1,17 @@
1
+ require 'rails/generators/rails/helper/helper_generator'
2
+
3
+ module Helper
4
+ class ScaffoldhubGenerator < Rails::Generators::HelperGenerator
5
+
6
+ include Scaffoldhub::Helper
7
+
8
+ class_option :scaffold, :default => 'default', :banner => "SCAFFOLD_NAME", :type => :string, :desc => "Scaffold to use"
9
+ class_option :local, :default => false, :banner => "LOCAL SCAFFOLD", :type => :boolean, :desc => "Use a local scaffold, not scaffoldhub.org"
10
+
11
+ def create_helper_files
12
+ each_template_file(:helper) do |helper_template_file|
13
+ template helper_template_file.src, File.join("app/helpers", class_path, "#{file_name}_helper.rb")
14
+ end
15
+ end
16
+ end
17
+ end
@@ -8,6 +8,12 @@ module ScaffoldController
8
8
  remove_hook_for :template_engine
9
9
  hook_for :template_engine, :as => :scaffoldhub
10
10
 
11
+ remove_hook_for :helper
12
+ # Invoke the helper using the controller name (pluralized)
13
+ hook_for :helper, :as => :scaffoldhub do |invoked|
14
+ invoke invoked, [ controller_name ]
15
+ end
16
+
11
17
  class_option :scaffold, :default => 'default', :banner => "SCAFFOLD_NAME", :type => :string, :desc => "Scaffold to use"
12
18
  class_option :local, :default => false, :banner => "LOCAL SCAFFOLD", :type => :boolean, :desc => "Use a local scaffold, not scaffoldhub.org"
13
19
 
@@ -6,6 +6,6 @@ require 'scaffoldhub/helper'
6
6
  require 'scaffoldhub/runner'
7
7
 
8
8
  module Scaffoldhub
9
- VERSION = '0.1.0'
9
+ VERSION = '0.1.1'
10
10
  SCAFFOLD_HUB_SERVER = 'www.scaffoldhub.org'
11
11
  end
@@ -48,7 +48,7 @@ module Scaffoldhub
48
48
  @@tags = []
49
49
  @@gems = []
50
50
 
51
- define_dsl_file_keyword :model, :migration, :controller, :view, :layout
51
+ define_dsl_file_keyword :model, :migration, :controller, :view, :layout, :helper
52
52
 
53
53
  class << self
54
54
 
@@ -38,6 +38,8 @@ Scaffoldhub::Specification.new do
38
38
  # view file with this path & filename: app/views/PLURAL_NAME/view_file_name.rb
39
39
  view 'templates/_form.html.erb'
40
40
 
41
+ helper 'templates/helper.rb', :rename => 'NAME_helper.rb'
42
+
41
43
  gem 'some_gem', '1.0'
42
44
  gem "some_other_gem", :group => :test, :git => "git://github.com/rails/rails"
43
45
 
@@ -57,6 +57,12 @@ describe Scaffoldhub::ScaffoldSpec do
57
57
  find_spec(subject, :controller, 'templates/controller.rb').should_not be_nil
58
58
  end
59
59
 
60
+ it 'should parse the helper file' do
61
+ helper_spec = find_spec(subject, :helper, 'templates/helper.rb')
62
+ helper_spec.should_not be_nil
63
+ helper_spec[:rename].should == 'NAME_helper.rb'
64
+ end
65
+
60
66
  it 'should parse a view file' do
61
67
  find_spec(subject, :view, 'templates/_form.html.erb').should_not be_nil
62
68
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scaffoldhub
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pat Shaughnessy
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-07 00:00:00 -04:00
18
+ date: 2011-06-09 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -98,6 +98,7 @@ files:
98
98
  - bin/scaffoldhub
99
99
  - lib/generators/active_record/scaffoldhub_generator.rb
100
100
  - lib/generators/erb/scaffoldhub_generator.rb
101
+ - lib/generators/helper/scaffoldhub_generator.rb
101
102
  - lib/generators/new_scaffold/new_scaffold_generator.rb
102
103
  - lib/generators/new_scaffold/templates/scaffold_spec.rb.erb
103
104
  - lib/generators/new_scaffold/templates/screenshot.png