appscrolls 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +8 -0
- data/.rspec +2 -0
- data/.travis.yml +6 -0
- data/ChangeLog.md +63 -0
- data/Gemfile +3 -0
- data/Guardfile +18 -0
- data/MIT_LICENSE +20 -0
- data/README.md +154 -0
- data/Rakefile +78 -0
- data/appscrolls.gemspec +32 -0
- data/bin/appscrolls +7 -0
- data/features/step_definitions/common_steps.rb +211 -0
- data/features/support/common.rb +51 -0
- data/features/support/env.rb +18 -0
- data/lib/appscrolls.rb +10 -0
- data/lib/appscrolls/command.rb +85 -0
- data/lib/appscrolls/config.rb +86 -0
- data/lib/appscrolls/scroll.rb +106 -0
- data/lib/appscrolls/scrolls.rb +38 -0
- data/lib/appscrolls/template.rb +67 -0
- data/lib/rails/generators/.DS_Store +0 -0
- data/lib/rails/generators/run_template/USAGE +13 -0
- data/lib/rails/generators/run_template/run_template_generator.rb +13 -0
- data/sample.rb +75 -0
- data/scrolls/active_admin.rb +19 -0
- data/scrolls/capybara.rb +34 -0
- data/scrolls/cucumber.rb +21 -0
- data/scrolls/delayed_job.rb +94 -0
- data/scrolls/env_yaml.rb +53 -0
- data/scrolls/eycloud.rb +72 -0
- data/scrolls/eycloud_recipes_on_deploy.rb +20 -0
- data/scrolls/git.rb +17 -0
- data/scrolls/github.rb +38 -0
- data/scrolls/guard.rb +75 -0
- data/scrolls/jquery.rb +11 -0
- data/scrolls/mysql.rb +51 -0
- data/scrolls/passenger.rb +11 -0
- data/scrolls/postgresql.rb +54 -0
- data/scrolls/prototype.rb +21 -0
- data/scrolls/puma.rb +11 -0
- data/scrolls/rails_basics.rb +54 -0
- data/scrolls/redis.rb +19 -0
- data/scrolls/resque.rb +59 -0
- data/scrolls/rspec.rb +21 -0
- data/scrolls/simple_form.rb +19 -0
- data/scrolls/split.rb +35 -0
- data/scrolls/spork.rb +19 -0
- data/scrolls/sqlite3.rb +10 -0
- data/scrolls/test_unit.rb +11 -0
- data/scrolls/thin.rb +10 -0
- data/scrolls/twitter_bootstrap.rb +41 -0
- data/scrolls/unicorn.rb +10 -0
- data/scrolls/zzz/activerecord.rb +69 -0
- data/scrolls/zzz/cancan.rb +16 -0
- data/scrolls/zzz/carrierwave.rb +42 -0
- data/scrolls/zzz/carrierwave_direct.rb +13 -0
- data/scrolls/zzz/cartographer.rb +33 -0
- data/scrolls/zzz/devise.rb +52 -0
- data/scrolls/zzz/devise_invitable.rb +23 -0
- data/scrolls/zzz/event_calendar.rb +12 -0
- data/scrolls/zzz/factory_girl.rb +38 -0
- data/scrolls/zzz/ffaker.rb +22 -0
- data/scrolls/zzz/fixture_builder.rb +35 -0
- data/scrolls/zzz/forgery.rb +15 -0
- data/scrolls/zzz/haml.rb +11 -0
- data/scrolls/zzz/heroku.rb +58 -0
- data/scrolls/zzz/hoptoad.rb +34 -0
- data/scrolls/zzz/inherited_resources.rb +12 -0
- data/scrolls/zzz/intercom.rb +35 -0
- data/scrolls/zzz/jammit.rb +43 -0
- data/scrolls/zzz/jasmine.rb +12 -0
- data/scrolls/zzz/mini_magick.rb +13 -0
- data/scrolls/zzz/mongo_mapper.rb +20 -0
- data/scrolls/zzz/mongohq.rb +61 -0
- data/scrolls/zzz/mongoid.rb +20 -0
- data/scrolls/zzz/mootools.rb +23 -0
- data/scrolls/zzz/newrelic.rb +11 -0
- data/scrolls/zzz/nifty_generators.rb +21 -0
- data/scrolls/zzz/oa_oauth.rb +12 -0
- data/scrolls/zzz/omniauth.rb +55 -0
- data/scrolls/zzz/paper_trail.rb +17 -0
- data/scrolls/zzz/pow.rb +12 -0
- data/scrolls/zzz/rails_admin.rb +22 -0
- data/scrolls/zzz/rails_dev_tweaks.rb +10 -0
- data/scrolls/zzz/rails_erd.rb +9 -0
- data/scrolls/zzz/rails_footnotes.rb +14 -0
- data/scrolls/zzz/ransack.rb +32 -0
- data/scrolls/zzz/rmagick.rb +13 -0
- data/scrolls/zzz/sass.rb +13 -0
- data/scrolls/zzz/sequel.rb +13 -0
- data/scrolls/zzz/settingslogic.rb +43 -0
- data/scrolls/zzz/shoulda_matchers.rb +11 -0
- data/scrolls/zzz/sidekiq.rb +23 -0
- data/scrolls/zzz/slim.rb +11 -0
- data/scrolls/zzz/thinking_sphinx.rb +14 -0
- data/scrolls/zzz/vanity.rb +35 -0
- data/spec/appscrolls/config_spec.rb +99 -0
- data/spec/appscrolls/scroll_spec.rb +103 -0
- data/spec/appscrolls/scrolls/sanity_spec.rb +30 -0
- data/spec/appscrolls/scrolls_spec.rb +24 -0
- data/spec/appscrolls/template_spec.rb +57 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/support/rails_directory.rb +17 -0
- data/spec/support/template_runner.rb +28 -0
- data/templates/helpers.erb +45 -0
- data/templates/layout.erb +44 -0
- data/templates/new_scroll.erb +28 -0
- data/templates/scroll.erb +10 -0
- data/version.rb +3 -0
- metadata +297 -0
data/scrolls/split.rb
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
gem 'split', :require => 'split/dashboard'
|
|
2
|
+
|
|
3
|
+
after_bundler do
|
|
4
|
+
route %{match '/split/#{config['split_admin_secret']}', :to => Split::Dashboard, :anchor => false}
|
|
5
|
+
|
|
6
|
+
initializer "split_config.rb", <<-RUBY
|
|
7
|
+
Split.configure do |config|
|
|
8
|
+
config.db_failover = true # handle redis errors gracefully
|
|
9
|
+
config.db_failover_on_db_error = proc{|error| Rails.logger.error(error.message) }
|
|
10
|
+
config.allow_multiple_experiments = true
|
|
11
|
+
# config.robot_regex = /my_custom_robot_regex/
|
|
12
|
+
# config.ignore_ip_addresses << '81.19.48.130'
|
|
13
|
+
end
|
|
14
|
+
RUBY
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
__END__
|
|
18
|
+
|
|
19
|
+
name: Split
|
|
20
|
+
description: Rack Based AB testing framework
|
|
21
|
+
author: drnic
|
|
22
|
+
website: https://github.com/andrew/split
|
|
23
|
+
screencast: http://railscasts.com/episodes/331-a-b-testing-with-split
|
|
24
|
+
|
|
25
|
+
requires: [redis]
|
|
26
|
+
run_after: [redis]
|
|
27
|
+
run_before: []
|
|
28
|
+
|
|
29
|
+
category: other
|
|
30
|
+
exclusive: ab-testing
|
|
31
|
+
|
|
32
|
+
config:
|
|
33
|
+
- split_admin_secret:
|
|
34
|
+
type: string
|
|
35
|
+
prompt: "Enter a secret string for the Split dashboard route /split/YOUR-SECRET-STRING:"
|
data/scrolls/spork.rb
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
gem 'spork', '~> 1.0.rc'
|
|
2
|
+
|
|
3
|
+
after_bundler do
|
|
4
|
+
run "bundle exec spork --bootstrap"
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
__END__
|
|
8
|
+
|
|
9
|
+
name: Spork
|
|
10
|
+
description: DRb server for testing frameworks that forks before each run to ensure a clean testing state
|
|
11
|
+
author: drnic
|
|
12
|
+
website: https://github.com/sporkrb/spork
|
|
13
|
+
|
|
14
|
+
requires: []
|
|
15
|
+
run_after: []
|
|
16
|
+
run_before: []
|
|
17
|
+
|
|
18
|
+
category: testing
|
|
19
|
+
# exclusive:
|
data/scrolls/sqlite3.rb
ADDED
data/scrolls/thin.rb
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
gem_group :assets do
|
|
2
|
+
gem 'twitter-bootstrap-rails'
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
after_bundler do
|
|
6
|
+
generate "bootstrap:install"
|
|
7
|
+
layout = config["twitter_bootstrap_layout"]
|
|
8
|
+
generate "bootstrap:layout application #{layout} -f"
|
|
9
|
+
|
|
10
|
+
html_to_find = layout == "fluid" ? '<div class="row-fluid">' : '<div class="content">'
|
|
11
|
+
gsub_file "app/views/layouts/application.html.erb", /#{html_to_find}/, <<-HTML
|
|
12
|
+
<% flash.each do |name, msg| %>
|
|
13
|
+
<div class="alert alert-<%= name == :notice ? "success" : "error" %>">
|
|
14
|
+
<a class="close" data-dismiss="alert">×</a>
|
|
15
|
+
<%= msg %>
|
|
16
|
+
</div>
|
|
17
|
+
<% end %>
|
|
18
|
+
#{html_to_find}
|
|
19
|
+
HTML
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
__END__
|
|
24
|
+
|
|
25
|
+
name: Twitter Bootstrap Rails
|
|
26
|
+
description: Add Twitter Bootstrap CSS
|
|
27
|
+
|
|
28
|
+
category: stylesheet
|
|
29
|
+
exclusive: stylesheet
|
|
30
|
+
tags: [css, stylesheet]
|
|
31
|
+
|
|
32
|
+
requires: [simple_form]
|
|
33
|
+
run_before: [simple_form]
|
|
34
|
+
|
|
35
|
+
config:
|
|
36
|
+
- twitter_bootstrap_layout:
|
|
37
|
+
prompt: "Which Twitter Bootstrap layout?"
|
|
38
|
+
type: multiple_choice
|
|
39
|
+
choices: [["Fluid", "fluid"], ["Fixed", "fixed"]]
|
|
40
|
+
|
|
41
|
+
|
data/scrolls/unicorn.rb
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
if config['database']
|
|
2
|
+
say_wizard "Configuring '#{config['database']}' database settings..."
|
|
3
|
+
old_gem = gem_for_database
|
|
4
|
+
@options = @options.dup.merge(:database => config['database'])
|
|
5
|
+
|
|
6
|
+
# SQLite3 gem requires special treatment.
|
|
7
|
+
gem_string = case gem_for_database
|
|
8
|
+
when "sqlite3"; "gem 'sqlite3-ruby', :require => 'sqlite3'"
|
|
9
|
+
when "mysql2"; "gem 'mysql2', '>= 0.3.10'"
|
|
10
|
+
else "gem '#{gem_for_database}'"
|
|
11
|
+
end
|
|
12
|
+
gsub_file 'Gemfile', Regexp.new("gem '#{old_gem}'(, '[^']*')?(, :require => '[^']*')?"), gem_string
|
|
13
|
+
|
|
14
|
+
template "config/databases/#{@options[:database]}.yml", "config/database.yml.new"
|
|
15
|
+
run 'mv config/database.yml.new config/database.yml'
|
|
16
|
+
puts "db: #{@options[:database]}"
|
|
17
|
+
puts "postgres_role: #{config['postgres_role']}"
|
|
18
|
+
if @options[:database] == 'postgresql'
|
|
19
|
+
role = ask_wizard("Please enter role:")
|
|
20
|
+
run "createuser -U postgres -d #{role}" unless role.blank?
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
after_bundler do
|
|
25
|
+
rake "db:create:all" if config['auto_create']
|
|
26
|
+
|
|
27
|
+
if config['populate_rake_task']
|
|
28
|
+
populate_rake = <<-RB
|
|
29
|
+
require './config/environment'
|
|
30
|
+
namespace :db do
|
|
31
|
+
desc "Populate the database with sample data"
|
|
32
|
+
task :populate do
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
RB
|
|
36
|
+
File.open("lib/tasks/populate.rake", 'w') {|f| f.write(populate_rake)}
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
__END__
|
|
41
|
+
|
|
42
|
+
name: ActiveRecord
|
|
43
|
+
description: "Use the default ActiveRecord database store."
|
|
44
|
+
author: mbleigh
|
|
45
|
+
|
|
46
|
+
exclusive: orm
|
|
47
|
+
category: persistence
|
|
48
|
+
tags: [sql, defaults, orm]
|
|
49
|
+
|
|
50
|
+
config:
|
|
51
|
+
- database:
|
|
52
|
+
type: multiple_choice
|
|
53
|
+
prompt: "Which database are you using?"
|
|
54
|
+
choices:
|
|
55
|
+
- ["MySQL", mysql]
|
|
56
|
+
- ["Oracle", oracle]
|
|
57
|
+
- ["PostgreSQL", postgresql]
|
|
58
|
+
- ["SQLite", sqlite3]
|
|
59
|
+
- ["Frontbase", frontbase]
|
|
60
|
+
- ["IBM DB", ibm_db]
|
|
61
|
+
|
|
62
|
+
- auto_create:
|
|
63
|
+
type: boolean
|
|
64
|
+
prompt: "Automatically create database with default configuration?"
|
|
65
|
+
|
|
66
|
+
- populate_rake_task:
|
|
67
|
+
type: boolean
|
|
68
|
+
prompt: "Add db:populate rake task?"
|
|
69
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
gem 'cancan'
|
|
2
|
+
|
|
3
|
+
after_bundler do
|
|
4
|
+
rake "db:migrate"
|
|
5
|
+
generate "cancan:ability"
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
__END__
|
|
9
|
+
|
|
10
|
+
name: Cancan
|
|
11
|
+
description: "Utilize Cancan for authorization."
|
|
12
|
+
author: amolk
|
|
13
|
+
|
|
14
|
+
category: authentication
|
|
15
|
+
exclusive: authorization
|
|
16
|
+
tags: [authorization, authentication]
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
gem 'fog'
|
|
2
|
+
gem 'carrierwave'
|
|
3
|
+
|
|
4
|
+
region = config['region']
|
|
5
|
+
bucket = ask_wizard("Please enter S3 bucket")
|
|
6
|
+
|
|
7
|
+
carrierwave_initializer = <<-RB
|
|
8
|
+
CarrierWave.configure do |config|
|
|
9
|
+
config.fog_credentials = {
|
|
10
|
+
:provider => 'AWS',
|
|
11
|
+
:aws_access_key_id => 'CHANGEME',
|
|
12
|
+
:aws_secret_access_key => 'CHANGEME',
|
|
13
|
+
:region => '#{region}'
|
|
14
|
+
}
|
|
15
|
+
config.fog_directory = '#{bucket}'
|
|
16
|
+
config.fog_public = true
|
|
17
|
+
# config.fog_host = 'https://assets.changeme.com.au'
|
|
18
|
+
# config.fog_attributes = {'Cache-Control' => 'max-age=315576000'}
|
|
19
|
+
end
|
|
20
|
+
RB
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
__END__
|
|
25
|
+
|
|
26
|
+
name: Carrierwave
|
|
27
|
+
description: "Use Carrierwave for file uploading"
|
|
28
|
+
author: jonochang
|
|
29
|
+
|
|
30
|
+
exclusive: file-uploads
|
|
31
|
+
tags: [file-uploads]
|
|
32
|
+
|
|
33
|
+
config:
|
|
34
|
+
- region:
|
|
35
|
+
type: multiple_choice
|
|
36
|
+
prompt: "Which region are you using?"
|
|
37
|
+
choices:
|
|
38
|
+
- ["US Standard", us-east-1]
|
|
39
|
+
- ["Oregon", us-west-2]
|
|
40
|
+
- ["Ireland", eu-west-1]
|
|
41
|
+
- ["Singapore", ap-southeast-1]
|
|
42
|
+
- ["Tokyo", ap-northeast-1]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
gem 'carrierwave_direct'
|
|
2
|
+
|
|
3
|
+
__END__
|
|
4
|
+
|
|
5
|
+
name: Carrierwave Direct
|
|
6
|
+
description: "Use Carrierwave Direct for uploading carrierwave files directly to Amazon S3"
|
|
7
|
+
author: jonochang
|
|
8
|
+
|
|
9
|
+
exclusive: file-uploads
|
|
10
|
+
category: file-uploads
|
|
11
|
+
tags: [file-uploads]
|
|
12
|
+
run_after: [carrierwave]
|
|
13
|
+
requires: [carrierwave]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
after_bundler do
|
|
2
|
+
|
|
3
|
+
#fixes missing Command error when running rails plugin
|
|
4
|
+
if File.open('script/rails').grep(/module Commands; end/) == []
|
|
5
|
+
source_rails = <<-RB
|
|
6
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
|
7
|
+
RB
|
|
8
|
+
|
|
9
|
+
add_commands = <<-RB
|
|
10
|
+
module Commands; end
|
|
11
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
|
12
|
+
RB
|
|
13
|
+
|
|
14
|
+
gsub_file 'script/rails', source_rails, add_commands
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
run 'rails plugin install git://github.com/jonochang/cartographer.git'
|
|
18
|
+
|
|
19
|
+
if File.open('config/environment.rb').grep(/CARTOGRAPHER_GMAP_VERSION/) == []
|
|
20
|
+
source = "require File.expand_path('../application', __FILE__)"
|
|
21
|
+
add_cartographer_const = "require File.expand_path('../application', __FILE__)\n\nCARTOGRAPHER_GMAP_VERSION = 3"
|
|
22
|
+
gsub_file 'config/environment.rb', source, add_cartographer_const
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
__END__
|
|
27
|
+
|
|
28
|
+
name: cartographer
|
|
29
|
+
description: "Google Maps on Rails"
|
|
30
|
+
author: jonochang
|
|
31
|
+
|
|
32
|
+
category: mapping
|
|
33
|
+
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
gem 'devise'
|
|
2
|
+
|
|
3
|
+
inject_into_file 'config/environments/development.rb', "\nconfig.action_mailer.default_url_options = { :host => 'localhost:3000' }\n", :after => "Application.configure do"
|
|
4
|
+
inject_into_file 'config/environments/test.rb', "\nconfig.action_mailer.default_url_options = { :host => 'localhost:7000' }\n", :after => "Application.configure do"
|
|
5
|
+
inject_into_file 'config/environments/production.rb', "\nconfig.action_mailer.default_url_options = { :host => '#{app_name}.com' }\n", :after => "Application.configure do"
|
|
6
|
+
|
|
7
|
+
inject_into_file 'config/routes.rb', "\nroot :to => 'home#index'\n", :after => "Testapp::Application.routes.draw do"
|
|
8
|
+
|
|
9
|
+
after_bundler do
|
|
10
|
+
generate 'devise:install'
|
|
11
|
+
|
|
12
|
+
if scrolls.include? 'mongo_mapper'
|
|
13
|
+
gem 'mm-devise'
|
|
14
|
+
gsub_file 'config/initializers/devise.rb', 'devise/orm/', 'devise/orm/mongo_mapper_active_model'
|
|
15
|
+
generate 'mongo_mapper:devise User'
|
|
16
|
+
elsif scrolls.include? 'mongoid'
|
|
17
|
+
gsub_file 'config/initializers/devise.rb', 'devise/orm/active_record', 'devise/orm/mongoid'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
generate 'devise user'
|
|
21
|
+
generate "devise:views"
|
|
22
|
+
|
|
23
|
+
if config['add_app_helpers']
|
|
24
|
+
new_helpers = <<-RB
|
|
25
|
+
module ApplicationHelper
|
|
26
|
+
|
|
27
|
+
def current_user
|
|
28
|
+
@current_user
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def logged_in?
|
|
32
|
+
@current_user != nil
|
|
33
|
+
end
|
|
34
|
+
RB
|
|
35
|
+
gsub_file 'app/helpers/application_helper.rb', 'module ApplicationHelper', new_helpers
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
__END__
|
|
40
|
+
|
|
41
|
+
name: Devise
|
|
42
|
+
description: Utilize Devise for authentication, automatically configured for your selected ORM.
|
|
43
|
+
author: mbleigh
|
|
44
|
+
|
|
45
|
+
category: authentication
|
|
46
|
+
exclusive: authentication
|
|
47
|
+
|
|
48
|
+
config:
|
|
49
|
+
- add_app_helpers:
|
|
50
|
+
type: boolean
|
|
51
|
+
prompt: "Add logged_in and current_user helpers?"
|
|
52
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
gem 'devise_invitable'
|
|
2
|
+
|
|
3
|
+
after_bundler do
|
|
4
|
+
generate 'devise_invitable:install'
|
|
5
|
+
generate 'devise_invitable user'
|
|
6
|
+
generate 'devise_invitable:views users'
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
__END__
|
|
10
|
+
|
|
11
|
+
name: Devise Invitable
|
|
12
|
+
description: Utilize Devise Invitable to allow users to invite other users to sign up to the system
|
|
13
|
+
author: jonochang
|
|
14
|
+
|
|
15
|
+
category: authentication
|
|
16
|
+
exclusive: authentication
|
|
17
|
+
run_after: [devise]
|
|
18
|
+
|
|
19
|
+
config:
|
|
20
|
+
- generate_user_scoped_view:
|
|
21
|
+
type: boolean
|
|
22
|
+
prompt: "Generate Devise Invitable user scoped views?"
|
|
23
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
gem 'event-calendar', :require => 'event_calendar'
|
|
2
|
+
|
|
3
|
+
__END__
|
|
4
|
+
|
|
5
|
+
name: Event Calendar
|
|
6
|
+
description: "Use Event Calendar to show multiple overlapping events across calendar days and rows"
|
|
7
|
+
author: jonochang
|
|
8
|
+
|
|
9
|
+
exclusive: calendar
|
|
10
|
+
category: calendar
|
|
11
|
+
tags: [calendar]
|
|
12
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
gem 'factory_girl', :group => [:development, :test]
|
|
2
|
+
gem 'factory_girl_rails', :group => [:development, :test]
|
|
3
|
+
|
|
4
|
+
after_bundler do
|
|
5
|
+
File.open('spec/factories.rb', 'w') {|f| f.write("FactoryGirl.define do
|
|
6
|
+
end")}
|
|
7
|
+
|
|
8
|
+
factory_user = <<-RB
|
|
9
|
+
FactoryGirl.define do
|
|
10
|
+
factory :user do
|
|
11
|
+
factory_password = Forgery(:basic).password
|
|
12
|
+
email { Forgery(:internet).email_address }
|
|
13
|
+
password factory_password
|
|
14
|
+
password_confirmation factory_password
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
RB
|
|
18
|
+
if config['use_devise']
|
|
19
|
+
gsub_file 'spec/factories.rb', 'FactoryGirl.define do', factory_user
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
__END__
|
|
24
|
+
|
|
25
|
+
name: Factory Girl
|
|
26
|
+
description: "Use Factory Girl to replace fixtures"
|
|
27
|
+
author: jonochang
|
|
28
|
+
|
|
29
|
+
exclusive: fixtures
|
|
30
|
+
category: testing
|
|
31
|
+
tags: [fixtures, testing]
|
|
32
|
+
|
|
33
|
+
config:
|
|
34
|
+
- use_devise:
|
|
35
|
+
type: boolean
|
|
36
|
+
prompt: "Add factory for devise user?"
|
|
37
|
+
if_scroll: devise
|
|
38
|
+
|