-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.rb
More file actions
158 lines (132 loc) · 3.47 KB
/
template.rb
File metadata and controls
158 lines (132 loc) · 3.47 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# Gemfile extentions
gem 'rails-i18n'
gem 'haml-rails'
gem 'bootstrap-sass'
gem 'simple-navigation-bootstrap'
gem 'bootstrap_form'
gem_group :development do
gem 'capistrano', '3.9.0'
gem 'capistrano-bundler'
gem 'capistrano-rvm'
gem 'capistrano-rails'
gem 'capistrano-passenger'
end
gem_group :development, :test do
gem 'rspec-rails' # , '~> 3.5.0'
gem 'factory_girl_rails' # , '~> 3.1.0'
gem 'simplecov-rcov' # , '~> 0.2.3', :require => false
gem 'simplecov' # , '~> 0.6.1', :require => false
gem 'database_cleaner' # , '~> 0.7.2'
end
require 'rvm'
create_file '.ruby-version', RUBY_VERSION
create_file '.ruby-gemset', app_name
RVM.use_from_path! app_path
unless run 'bundle --version'
run 'gem install bundler --no-rdoc --no-ri'
end
application do
<<-RUBY
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
config.time_zone = 'Berlin'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
config.i18n.default_locale = :de
config.i18n.available_locales = :de
RUBY
end
run_bundle
generate 'rspec:install'
inject_into_file 'spec/rails_helper.rb', :after => "require 'rspec/rails'" do
<<-RUBY
require 'support/factory_girl'
RUBY
end
insert_into_file "spec/rails_helper.rb", after: "RSpec.configure do |config|\n" do
<<-RUBY
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, :js => true) do
DatabaseCleaner.strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
config.include FactoryGirl::Syntax::Methods
RUBY
end
gsub_file "spec/rails_helper.rb",
"config.use_transactional_fixtures = true",
"config.use_transactional_fixtures = false"
inject_into_file 'spec/spec_helper.rb', before: 'RSpec.configure' do
<<-RUBY
require 'simplecov'
SimpleCov.start
RUBY
end
create_file 'config/navigation.rb' do
<<-RUBY
SimpleNavigation::Configuration.run do |navigation|
navigation.renderer = Bootstrap
navigation.items do |primary|
end
end
RUBY
end
remove_file 'app/views/layouts/*.erb'
create_file 'app/views/layouts/application.html.haml' do
<<-RUBY
<!DOCTYPE html>
%html
%head
%title ProjectPlaner
= csrf_meta_tags
= stylesheet_link_tag 'application', media: 'all'
= javascript_include_tag 'application'
%body
- if user_authenticated?
%div.navbar-left
%div.container-fluid
= render_navigation :renderer => :bootstrap
%div.container
= yield
RUBY
end
insert_into_file 'app/assets/javascripts/application.js', before: '//= require_tree .' do
"//= require bootstrap\n"
end
remove_file 'app/assets/stylesheets/application.css'
create_file 'app/assets/stylesheets/application.scss' do
<<-CSS
@import 'rails_bootstrap_forms';
@import "bootstrap-sprockets";
@import "bootstrap";
CSS
end
run 'cap install'
after_bundle do
append_file '.gitignore', before: :end do
<<-GIT
/.idea*
.DS_Store
/.bundle
config/database.yml
config/secrets.yml
/coverage
/log/*
!/log/.keep
/tmp
GIT
end
git :init
git add: '.'
git commit: "-a -m 'Initial commit'"
end