-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwizardry.rb
53 lines (45 loc) · 1.3 KB
/
wizardry.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
def install_template(path, source_path: nil)
source_path ||= path
template_path = File.expand_path(File.join('..', source_path), __FILE__)
template = File.read(template_path)
file path, template, force: true
end
def commit(message)
yield
git add: "."
git commit: "-m '#{message}'"
end
git :init
gem_group :development, :test do
gem "rspec-rails", "~> 3.5.0"
gem "factory_girl_rails", "~> 4.7"
gem "capybara", "~> 2.7", require: false
gem "poltergeist", "~> 1.10", require: false
gem 'database_cleaner'
end
after_bundle do
commit "Initial commit" do
environment <<-RUBY
config.generators do |generate|
generate.helper false
generate.assets false
generate.view_specs false
end
RUBY
install_template ".gitignore", source_path: "gitignore"
install_template "app/views/layouts/application.html.erb"
rails_command "db:create"
rails_command "db:migrate"
end
commit "Setup testing environment" do
generate "rspec:install"
install_template "spec/spec_helper.rb"
install_template "spec/rails_helper.rb"
install_template "spec/feature_helper.rb"
install_template "spec/features/homepage_spec.rb"
end
commit "Add home controller" do
generate "controller", "home", "index"
install_template "config/routes.rb"
end
end