factory_girl_generator 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,22 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+ .bundle
21
+
22
+ ## PROJECT::SPECIFIC
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm gemset use factory_girl_generator
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
@@ -0,0 +1,24 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ factory_girl_generator (0.0.1)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ gemcutter (0.6.1)
10
+ git (1.2.5)
11
+ jeweler (1.4.0)
12
+ gemcutter (>= 0.1.0)
13
+ git (>= 1.2.5)
14
+ rubyforge (>= 2.0.0)
15
+ json_pure (1.4.6)
16
+ rubyforge (2.0.4)
17
+ json_pure (>= 1.1.7)
18
+
19
+ PLATFORMS
20
+ ruby
21
+
22
+ DEPENDENCIES
23
+ factory_girl_generator!
24
+ jeweler (>= 1.4.0)
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Les Hill
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,17 @@
1
+ = factory_girl_generator
2
+
3
+ Description goes here.
4
+
5
+ == Note on Patches/Pull Requests
6
+
7
+ * Fork the project.
8
+ * Make your feature addition or bug fix.
9
+ * Add tests for it. This is important so I don't break it in a
10
+ future version unintentionally.
11
+ * Commit, do not mess with rakefile, version, or history.
12
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
+ * Send me a pull request. Bonus points for topic branches.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2010 Les Hill. See LICENSE for details.
@@ -0,0 +1,29 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "factory_girl_generator"
8
+ gem.summary = %Q{Rails 3 generator for factory_girl}
9
+ gem.description = %Q{Rails 3 generator for factory_girl}
10
+ gem.email = "leshill@gmail.com"
11
+ gem.homepage = "http://github.com/leshill/factory_girl_generator"
12
+ gem.authors = ["Les Hill"]
13
+ gem.files.include "lib/**/*.rb"
14
+ gem.add_development_dependency "jeweler", ">= 1.4.0"
15
+ end
16
+ Jeweler::GemcutterTasks.new
17
+ rescue LoadError
18
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
+ end
20
+
21
+ require 'rake/rdoctask'
22
+ Rake::RDocTask.new do |rdoc|
23
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
24
+
25
+ rdoc.rdoc_dir = 'rdoc'
26
+ rdoc.title = "factory_girl_generator #{version}"
27
+ rdoc.rdoc_files.include('README*')
28
+ rdoc.rdoc_files.include('lib/**/*.rb')
29
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1 @@
1
+ require 'factory_girl_generator/railtie'
@@ -0,0 +1,6 @@
1
+ module FactoryGirlGenerator
2
+ class Railtie < ::Rails::Railtie
3
+ config.generators.fixture_replacement :factory_girl
4
+ config.generators.test_unit[:fixture_replacement] = :factory_girl
5
+ end
6
+ end
@@ -0,0 +1,9 @@
1
+ module FactoryGirl
2
+ module Generators
3
+ module TemplatePath
4
+ def source_root
5
+ File.expand_path("../factory_girl/#{generator_name}/templates", __FILE__)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,25 @@
1
+ require 'generators/factory_girl'
2
+
3
+ module FactoryGirl
4
+ module Generators
5
+ class ModelGenerator < Rails::Generators::NamedBase
6
+ extend TemplatePath
7
+
8
+ def self.default_dir
9
+ if Rails.configuration.generators.rails[:test_framework] == :test_unit
10
+ "test/factories"
11
+ else
12
+ "spec/factories"
13
+ end
14
+ end
15
+
16
+ argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
17
+ class_option :dir, :type => :string, :default => default_dir, :desc => "The directory where the factories should go"
18
+
19
+ def create_fixture_file
20
+ template 'factory.rb', File.join(options[:dir], "#{name}_factory.rb")
21
+ end
22
+
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,7 @@
1
+ # Read about factories at http://github.com/thoughtbot/factory_girl
2
+
3
+ Factory.define :<%= singular_name %> do |f|
4
+ <% for attribute in attributes -%>
5
+ f.<%= attribute.name %> <%= attribute.default.inspect %>
6
+ <% end -%>
7
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: factory_girl_generator
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Les Hill
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-08-17 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: jeweler
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 7
30
+ segments:
31
+ - 1
32
+ - 4
33
+ - 0
34
+ version: 1.4.0
35
+ type: :development
36
+ version_requirements: *id001
37
+ description: Rails 3 generator for factory_girl
38
+ email: leshill@gmail.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files:
44
+ - LICENSE
45
+ - README.rdoc
46
+ files:
47
+ - .document
48
+ - .gitignore
49
+ - .rvmrc
50
+ - Gemfile
51
+ - Gemfile.lock
52
+ - LICENSE
53
+ - README.rdoc
54
+ - Rakefile
55
+ - VERSION
56
+ - lib/factory_girl_generator.rb
57
+ - lib/factory_girl_generator/railtie.rb
58
+ - lib/generators/factory_girl.rb
59
+ - lib/generators/factory_girl/model/model_generator.rb
60
+ - lib/generators/factory_girl/model/templates/factory.rb
61
+ has_rdoc: true
62
+ homepage: http://github.com/leshill/factory_girl_generator
63
+ licenses: []
64
+
65
+ post_install_message:
66
+ rdoc_options:
67
+ - --charset=UTF-8
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ hash: 3
85
+ segments:
86
+ - 0
87
+ version: "0"
88
+ requirements: []
89
+
90
+ rubyforge_project:
91
+ rubygems_version: 1.3.7
92
+ signing_key:
93
+ specification_version: 3
94
+ summary: Rails 3 generator for factory_girl
95
+ test_files: []
96
+