flatiron-rails 0.0.2
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.
- checksums.yaml +7 -0
- data/bin/flatiron-rails +4 -0
- data/lib/flatiron_rails.rb +15 -0
- data/templates/flatiron.rb +357 -0
- metadata +64 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 928326b0f38b80bdc68b9d14fbe7bd9ca96b6282
|
4
|
+
data.tar.gz: 023a689c46cad4c16217c941b844383ce20111d2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0792b1a400a5c9d59dbf9ee989eee3dca1bcfc9fc91913195358e227215eb24675b76b9ab3add00c72e7abb1e7cc8b86575904bebc35dedf19706eb54fd0d1f3
|
7
|
+
data.tar.gz: da3dc1c289f6a0524ae2bf7aa85d0309ea3b1944ca243998055e64c14464e5d5b0f34f5b48da10b94be0ecbc1d66e9f6cf653a8186b6cc4c005889399ef9cbf7
|
data/bin/flatiron-rails
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
class FlatironRails
|
2
|
+
|
3
|
+
FLATIRON_ROOT = File.expand_path('../', File.dirname(__FILE__))
|
4
|
+
def self.run
|
5
|
+
if ARGV[0].nil? || ['-h','--help'].include?(ARGV[0]) || ARGV[1]
|
6
|
+
puts <<-HELP.gsub(/^ {6}/, '')
|
7
|
+
Usage:
|
8
|
+
flatiron-rails <app_name>
|
9
|
+
HELP
|
10
|
+
else
|
11
|
+
system("rails new #{ARGV[0]} -Tm #{FLATIRON_ROOT}/templates/flatiron.rb")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,357 @@
|
|
1
|
+
# Prevent automatic run of bundle install
|
2
|
+
def run_bundle ; end
|
3
|
+
|
4
|
+
# Remove sqlite3 from default gem group and set Ruby version to 2.1.0
|
5
|
+
File.open("Gemfile", "r+") do |f|
|
6
|
+
out = ""
|
7
|
+
f.each do |line|
|
8
|
+
if line =~ /source 'https:\/\/rubygems.org'/
|
9
|
+
out << line + "\nruby \"2.1.0\"\n"
|
10
|
+
elsif line =~ /# Use sqlite3 as the database for Active Record/
|
11
|
+
out << ""
|
12
|
+
elsif line =~ /gem 'sqlite3'/
|
13
|
+
out << "\n"
|
14
|
+
else
|
15
|
+
out << line
|
16
|
+
end
|
17
|
+
end
|
18
|
+
f.pos = 0
|
19
|
+
f.print out.chomp
|
20
|
+
f.truncate(f.pos)
|
21
|
+
end
|
22
|
+
|
23
|
+
gem_group :test, :development do
|
24
|
+
gem 'rspec-rails'
|
25
|
+
gem 'capybara'
|
26
|
+
gem 'selenium-webdriver'
|
27
|
+
gem 'better_errors'
|
28
|
+
gem 'sprockets_better_errors'
|
29
|
+
gem 'binding_of_caller'
|
30
|
+
gem 'factory_girl_rails'
|
31
|
+
gem 'simplecov'
|
32
|
+
gem 'database_cleaner'
|
33
|
+
gem 'sqlite3'
|
34
|
+
gem 'pry'
|
35
|
+
end
|
36
|
+
|
37
|
+
gem_group :production do
|
38
|
+
gem 'pg'
|
39
|
+
gem 'google-analytics-rails'
|
40
|
+
gem 'rails_12factor'
|
41
|
+
end
|
42
|
+
|
43
|
+
gem 'bootstrap-sass', '~> 3.1.1'
|
44
|
+
|
45
|
+
# Delete README.rdoc
|
46
|
+
run 'rm README.rdoc'
|
47
|
+
|
48
|
+
# Add template data to README.md
|
49
|
+
file 'README.md', <<-README.strip_heredoc.chomp
|
50
|
+
# #{app_name.split('_').map(&:capitalize).join(' ')}
|
51
|
+
README
|
52
|
+
|
53
|
+
# Add LICENSE
|
54
|
+
file 'LICENSE', <<-MIT.strip_heredoc.chomp
|
55
|
+
The MIT License (MIT)
|
56
|
+
|
57
|
+
Copyright (c) [year] [fullname]
|
58
|
+
|
59
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
60
|
+
of this software and associated documentation files (the "Software"), to deal
|
61
|
+
in the Software without restriction, including without limitation the rights
|
62
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
63
|
+
copies of the Software, and to permit persons to whom the Software is
|
64
|
+
furnished to do so, subject to the following conditions:
|
65
|
+
|
66
|
+
The above copyright notice and this permission notice shall be included in all
|
67
|
+
copies or substantial portions of the Software.
|
68
|
+
|
69
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
70
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
71
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
72
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
73
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
74
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
75
|
+
SOFTWARE.
|
76
|
+
MIT
|
77
|
+
|
78
|
+
# Set Rails version to 4.1.0.rc1
|
79
|
+
File.open("Gemfile", "r+") do |f|
|
80
|
+
out = ""
|
81
|
+
f.each do |line|
|
82
|
+
if line =~ /gem 'rails'/
|
83
|
+
out << "#{line.gsub(/, '(.*)'/, ', \'4.1.0.rc1\'')}"
|
84
|
+
else
|
85
|
+
out << line
|
86
|
+
end
|
87
|
+
end
|
88
|
+
f.pos = 0
|
89
|
+
f.print out.chomp
|
90
|
+
f.truncate(f.pos)
|
91
|
+
end
|
92
|
+
|
93
|
+
# Disable Turbolinks
|
94
|
+
File.open("Gemfile", "r+") do |f|
|
95
|
+
out = ""
|
96
|
+
f.each do |line|
|
97
|
+
unless line =~ /gem 'turbolinks'/ || line =~ /# Turbolinks/
|
98
|
+
out << line
|
99
|
+
end
|
100
|
+
end
|
101
|
+
f.pos = 0
|
102
|
+
f.print out.chomp
|
103
|
+
f.truncate(f.pos)
|
104
|
+
end
|
105
|
+
|
106
|
+
File.open("app/assets/javascripts/application.js", "r+") do |f|
|
107
|
+
out = ""
|
108
|
+
f.each do |line|
|
109
|
+
unless line =~ /\/\/= require turbolinks/
|
110
|
+
out << line
|
111
|
+
end
|
112
|
+
end
|
113
|
+
f.pos = 0
|
114
|
+
f.print out.chomp
|
115
|
+
f.truncate(f.pos)
|
116
|
+
end
|
117
|
+
|
118
|
+
File.open("app/views/layouts/application.html.erb", "r+") do |f|
|
119
|
+
out = ""
|
120
|
+
f.each do |line|
|
121
|
+
if line =~ /, 'data-turbolinks-track' => true/
|
122
|
+
out << "#{line.gsub(", 'data-turbolinks-track' => true", '')}"
|
123
|
+
else
|
124
|
+
out << line
|
125
|
+
end
|
126
|
+
end
|
127
|
+
f.pos = 0
|
128
|
+
f.print out.chomp
|
129
|
+
f.truncate(f.pos)
|
130
|
+
end
|
131
|
+
|
132
|
+
# Bundle
|
133
|
+
system("bundle")
|
134
|
+
|
135
|
+
# Generate RSpec files
|
136
|
+
generate(:"rspec:install")
|
137
|
+
|
138
|
+
# Edit spec/spec_helper.rb
|
139
|
+
File.open("spec/spec_helper.rb", "r+") do |f|
|
140
|
+
out = ""
|
141
|
+
f.each do |line|
|
142
|
+
if line =~ /require 'rspec\/autorun'/
|
143
|
+
# add SimpleCov
|
144
|
+
out << line
|
145
|
+
out << <<-CODE.strip_heredoc
|
146
|
+
require 'simplecov'
|
147
|
+
SimpleCov.start 'rails'
|
148
|
+
CODE
|
149
|
+
elsif line =~ /config\.fixture_path/
|
150
|
+
# comment out fixtures
|
151
|
+
out << " ##{line[1..-1]}"
|
152
|
+
elsif line =~ /config\.use_transactional_fixtures/
|
153
|
+
# set transactional fixtures to false
|
154
|
+
out << line.sub("true", "false")
|
155
|
+
elsif line =~ /RSpec\.configure do/
|
156
|
+
# add Database Cleaner
|
157
|
+
out << line
|
158
|
+
out << <<-CODE.gsub(/^ {6}/, '')
|
159
|
+
config.include FactoryGirl::Syntax::Methods
|
160
|
+
|
161
|
+
config.before(:suite) do
|
162
|
+
DatabaseCleaner.strategy = :transaction
|
163
|
+
DatabaseCleaner.clean_with(:truncation)
|
164
|
+
end
|
165
|
+
|
166
|
+
config.before(:each) do
|
167
|
+
DatabaseCleaner.start
|
168
|
+
end
|
169
|
+
|
170
|
+
config.after(:each) do
|
171
|
+
DatabaseCleaner.clean
|
172
|
+
end
|
173
|
+
CODE
|
174
|
+
else
|
175
|
+
out << line
|
176
|
+
end
|
177
|
+
end
|
178
|
+
f.pos = 0
|
179
|
+
f.print out.chomp
|
180
|
+
f.truncate(f.pos)
|
181
|
+
end
|
182
|
+
|
183
|
+
# Make spec/features directory
|
184
|
+
run('mkdir -p spec/features')
|
185
|
+
run('touch spec/features/.keep')
|
186
|
+
|
187
|
+
# Create feature_helper.rb
|
188
|
+
file 'spec/feature_helper.rb', <<-CODE.strip_heredoc.chomp
|
189
|
+
require 'spec_helper'
|
190
|
+
require 'capybara/rails'
|
191
|
+
CODE
|
192
|
+
|
193
|
+
# Setup Guardfile
|
194
|
+
file 'Guardfile', %q(
|
195
|
+
# guard 'rails' do
|
196
|
+
# watch('Gemfile.lock')
|
197
|
+
# watch(%r{^(config|lib)/.*})
|
198
|
+
# end
|
199
|
+
|
200
|
+
|
201
|
+
guard :rspec do
|
202
|
+
watch(%r{^spec/.+_spec\.rb$})
|
203
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
204
|
+
watch('spec/spec_helper.rb') { "spec" }
|
205
|
+
|
206
|
+
# Rails example
|
207
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
208
|
+
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
209
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
210
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
211
|
+
watch('config/routes.rb') { "spec/routing" }
|
212
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
213
|
+
|
214
|
+
# Capybara features specs
|
215
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
216
|
+
|
217
|
+
# Turnip features and steps
|
218
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
219
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
220
|
+
end
|
221
|
+
).strip.gsub(/^ {2}/, '')
|
222
|
+
|
223
|
+
# Set up Google Analytics
|
224
|
+
environment 'GA.tracker = Rails.application.secrets.google_analytics_code', env: 'production'
|
225
|
+
|
226
|
+
File.open("app/views/layouts/application.html.erb", "r+") do |f|
|
227
|
+
out = ""
|
228
|
+
f.each do |line|
|
229
|
+
if line =~ /<%= csrf_meta_tags %>/
|
230
|
+
out << "#{line}"
|
231
|
+
out << " <%= analytics_init if Rails.env.production? %>\n"
|
232
|
+
else
|
233
|
+
out << line
|
234
|
+
end
|
235
|
+
end
|
236
|
+
f.pos = 0
|
237
|
+
f.print out.chomp
|
238
|
+
f.truncate(f.pos)
|
239
|
+
end
|
240
|
+
|
241
|
+
File.open("config/secrets.yml", "r+") do |f|
|
242
|
+
out = ""
|
243
|
+
f.each do |line|
|
244
|
+
if line =~ /production:/
|
245
|
+
out << "#{line}"
|
246
|
+
out << " google_analytics_code: 'YOUR CODE HERE'\n"
|
247
|
+
else
|
248
|
+
out << line
|
249
|
+
end
|
250
|
+
end
|
251
|
+
f.pos = 0
|
252
|
+
f.print out.chomp
|
253
|
+
f.truncate(f.pos)
|
254
|
+
end
|
255
|
+
|
256
|
+
#Sset up sprockets_better_errors
|
257
|
+
environment 'config.assets.raise_production_errors = true', env: 'development'
|
258
|
+
|
259
|
+
# Turn on precompile assets in production
|
260
|
+
File.open("config/environments/production.rb", "r+") do |f|
|
261
|
+
out = ""
|
262
|
+
f.each do |line|
|
263
|
+
if line =~ /config.assets.compile = false/
|
264
|
+
out << " config.assets.compile = true\n"
|
265
|
+
else
|
266
|
+
out << line
|
267
|
+
end
|
268
|
+
end
|
269
|
+
f.pos = 0
|
270
|
+
f.print out.chomp
|
271
|
+
f.truncate(f.pos)
|
272
|
+
end
|
273
|
+
|
274
|
+
# Set up Bootstrap
|
275
|
+
inside('app/assets/stylesheets') do
|
276
|
+
run "mv application.css application.css.scss"
|
277
|
+
end
|
278
|
+
|
279
|
+
File.open("app/assets/stylesheets/application.css.scss", "r+") do |f|
|
280
|
+
out = ""
|
281
|
+
f.each do |line|
|
282
|
+
if line =~ /\*= require_self/
|
283
|
+
out << "#{line}"
|
284
|
+
out << " //= depend_on_asset \"bootstrap/glyphicons-halflings-regular.eot\"\n"
|
285
|
+
out << " //= depend_on_asset \"bootstrap/glyphicons-halflings-regular.woff\"\n"
|
286
|
+
out << " //= depend_on_asset \"bootstrap/glyphicons-halflings-regular.ttf\"\n"
|
287
|
+
out << " //= depend_on_asset \"bootstrap/glyphicons-halflings-regular.svg\"\n"
|
288
|
+
elsif line =~ /\*\//
|
289
|
+
out << "#{line}"
|
290
|
+
out << "@import \"bootstrap\";"
|
291
|
+
else
|
292
|
+
out << line
|
293
|
+
end
|
294
|
+
end
|
295
|
+
f.pos = 0
|
296
|
+
f.print out.chomp
|
297
|
+
f.truncate(f.pos)
|
298
|
+
end
|
299
|
+
|
300
|
+
File.open("app/assets/javascripts/application.js", "r+") do |f|
|
301
|
+
out = ""
|
302
|
+
jquery_count = 0
|
303
|
+
f.each do |line|
|
304
|
+
if line =~ /\/\/= require jquery/
|
305
|
+
jquery_count += 1
|
306
|
+
if jquery_count == 1
|
307
|
+
out << "//= require bootstrap\n//= require jquery\n//= require jquery_ujs\n"
|
308
|
+
end
|
309
|
+
else
|
310
|
+
out << line
|
311
|
+
end
|
312
|
+
end
|
313
|
+
f.pos = 0
|
314
|
+
f.print out.chomp
|
315
|
+
f.truncate(f.pos)
|
316
|
+
end
|
317
|
+
|
318
|
+
# Add STACK description file
|
319
|
+
file 'STACK', <<-STACK.strip_heredoc.chomp
|
320
|
+
This generator has set up the following stack:
|
321
|
+
|
322
|
+
1. Testing
|
323
|
+
* RSpec
|
324
|
+
* Capybara
|
325
|
+
* Database Cleaner
|
326
|
+
* SimpleCov
|
327
|
+
* Guard
|
328
|
+
2. Frontend
|
329
|
+
* Bootstrap
|
330
|
+
* Disabled Turbolinks
|
331
|
+
* Google Analytics
|
332
|
+
* Precompiled assets in production
|
333
|
+
3. Gem groups set up for easy Heroku deployment
|
334
|
+
* Postgres will work out of the box. No configuration necessary.
|
335
|
+
|
336
|
+
TODO:
|
337
|
+
1. An MIT License file has been created for you
|
338
|
+
* Add your name and the year
|
339
|
+
2. A README.md file has been started for you
|
340
|
+
* Add relavent information and screenshots for your app
|
341
|
+
3. Google Analytics is set up to track your app
|
342
|
+
* Set up an application on Google Analytics
|
343
|
+
* You will need to add your analytics tracking code to `config/secrets.yml`
|
344
|
+
|
345
|
+
Deploying to Heroku:
|
346
|
+
1. `heroku create <appname>`
|
347
|
+
2. `git push heroku master`
|
348
|
+
3. `heroku run rake db:migrate`
|
349
|
+
4. `heroku open`
|
350
|
+
STACK
|
351
|
+
|
352
|
+
# Initialize git repository and make initial commit
|
353
|
+
git :init
|
354
|
+
git add: "."
|
355
|
+
git commit: %Q{ -m 'Initial commit' }
|
356
|
+
|
357
|
+
# TODO: Add ruby 2.1.0 to gemfile
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: flatiron-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Arel English
|
8
|
+
- Logan Hasson
|
9
|
+
- Katie Hoffman
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2014-03-24 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rails
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 4.1.0.rc1
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 4.1.0.rc1
|
29
|
+
description: Sets up a rails application using the default Flatiron School stack.
|
30
|
+
email: logan@flatironschool.com
|
31
|
+
executables:
|
32
|
+
- flatiron-rails
|
33
|
+
extensions: []
|
34
|
+
extra_rdoc_files: []
|
35
|
+
files:
|
36
|
+
- bin/flatiron-rails
|
37
|
+
- lib/flatiron_rails.rb
|
38
|
+
- templates/flatiron.rb
|
39
|
+
homepage: http://rubygems.org/gems/flatiron-rails
|
40
|
+
licenses:
|
41
|
+
- MIT
|
42
|
+
metadata: {}
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
requirements: []
|
58
|
+
rubyforge_project:
|
59
|
+
rubygems_version: 2.2.1
|
60
|
+
signing_key:
|
61
|
+
specification_version: 4
|
62
|
+
summary: flatiron-rails gem
|
63
|
+
test_files: []
|
64
|
+
has_rdoc:
|