rails_templater 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rails_templater/version.rb +1 -1
- data/lib/template/generators/factory_girl/model/model_generator.rb +14 -0
- data/lib/template/generators/factory_girl/model/templates/fixtures.rb +9 -0
- data/lib/template/generators/factory_girl.rb +11 -0
- data/lib/template/recipes/default.rb +1 -3
- data/lib/template/recipes/mongoid.rb +1 -1
- data/lib/template/templater.rb +2 -0
- metadata +6 -3
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'generators/factory_girl'
|
2
|
+
|
3
|
+
module FactoryGirl
|
4
|
+
module Generators
|
5
|
+
class ModelGenerator < Base
|
6
|
+
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
|
7
|
+
class_option :dir, :type => :string, :default => "spec/factories", :desc => "The directory where the factories should go"
|
8
|
+
|
9
|
+
def create_fixture_file
|
10
|
+
template 'fixtures.rb', File.join(options[:dir], "#{table_name}.rb")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'rails/generators/named_base'
|
2
|
+
|
3
|
+
module FactoryGirl
|
4
|
+
module Generators
|
5
|
+
class Base < Rails::Generators::NamedBase #:nodoc:
|
6
|
+
def self.source_root
|
7
|
+
@_factory_girl_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'factory_girl', generator_name, 'templates'))
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/template/templater.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Kevin Faustino
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-01-
|
17
|
+
date: 2011-01-23 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -83,6 +83,9 @@ files:
|
|
83
83
|
- lib/rails_templater/cli.rb
|
84
84
|
- lib/rails_templater/version.rb
|
85
85
|
- lib/template/core_extensions.rb
|
86
|
+
- lib/template/generators/factory_girl.rb
|
87
|
+
- lib/template/generators/factory_girl/model/model_generator.rb
|
88
|
+
- lib/template/generators/factory_girl/model/templates/fixtures.rb
|
86
89
|
- lib/template/recipes/cucumber.rb
|
87
90
|
- lib/template/recipes/default.rb
|
88
91
|
- lib/template/recipes/design.rb
|