flatiron-rails 0.0.6 → 0.0.7
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 +4 -4
- data/templates/flatiron.rb +68 -81
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7753f25cf1693a4db2ee1677a035406c70fecf85
|
4
|
+
data.tar.gz: 65edbea509bbb7ae1136224e765e8e3e6bd4489d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 556bcd5ac68139b2d16407b8508af59e9e61144fbbb78ec7547b31be57c28cc49ea16fd432ca2a57a8ad582ffc1b376484999293f9c6f5f45d360f0313bef9f7
|
7
|
+
data.tar.gz: 49999da8cf7371041507c4224fff6f056e73c69e9f9baf581252829f84e3404f979ac822976ffb15ddc601872cc129e4077d02443dd24d9b06968e3445958784
|
data/templates/flatiron.rb
CHANGED
@@ -23,12 +23,12 @@ def add_secret_for(options)
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
# Helper method to remove
|
27
|
-
def
|
28
|
-
File.open(
|
26
|
+
# Helper method to remove lines from a file
|
27
|
+
def remove_line_from_file(file, line_to_match)
|
28
|
+
File.open(file, "r+") do |f|
|
29
29
|
out = ""
|
30
30
|
f.each do |line|
|
31
|
-
unless line =~ /#{
|
31
|
+
unless line =~ /#{line_to_match}/i
|
32
32
|
out << line
|
33
33
|
end
|
34
34
|
end
|
@@ -38,23 +38,45 @@ def remove_from_gemfile(gem_name)
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
#
|
42
|
-
|
41
|
+
# Helper method to remove part of a line in a file
|
42
|
+
def remove_part_of_line_from_file(file, line_to_remove)
|
43
|
+
File.open(file, "r+") do |f|
|
44
|
+
out = ""
|
45
|
+
f.each do |line|
|
46
|
+
if line =~ /#{line_to_remove}/
|
47
|
+
out << "#{line.gsub("#{line_to_remove}", '')}"
|
48
|
+
else
|
49
|
+
out << line
|
50
|
+
end
|
51
|
+
end
|
52
|
+
f.pos = 0
|
53
|
+
f.print out.chomp
|
54
|
+
f.truncate(f.pos)
|
55
|
+
end
|
56
|
+
end
|
43
57
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
58
|
+
# Helper method to add a line to a file
|
59
|
+
def add_line_to_file(file, line_to_add, line_to_add_after)
|
60
|
+
File.open(file, "r+") do |f|
|
61
|
+
out = ""
|
62
|
+
f.each do |line|
|
63
|
+
if line =~ /#{line_to_add_after}/
|
64
|
+
out << line + line_to_add
|
65
|
+
else
|
66
|
+
out << line
|
67
|
+
end
|
51
68
|
end
|
69
|
+
f.pos = 0
|
70
|
+
f.print out.chomp
|
71
|
+
f.truncate(f.pos)
|
52
72
|
end
|
53
|
-
f.pos = 0
|
54
|
-
f.print out.chomp
|
55
|
-
f.truncate(f.pos)
|
56
73
|
end
|
57
74
|
|
75
|
+
# Remove sqlite3 from default gem group and set Ruby version to 2.1.0
|
76
|
+
remove_line_from_file("Gemfile", "sqlite3")
|
77
|
+
add_line_to_file("Gemfile", "\nruby \"2.1.0\"\n", "rubygems")
|
78
|
+
|
79
|
+
# Setup gem groups
|
58
80
|
gem_group :test, :development do
|
59
81
|
gem 'rspec-rails'
|
60
82
|
gem 'capybara'
|
@@ -75,6 +97,7 @@ gem_group :production do
|
|
75
97
|
gem 'rails_12factor'
|
76
98
|
end
|
77
99
|
|
100
|
+
# Add bootstrap gem
|
78
101
|
gem 'bootstrap-sass', '~> 3.1.1'
|
79
102
|
|
80
103
|
# Delete README.rdoc
|
@@ -126,33 +149,9 @@ File.open("Gemfile", "r+") do |f|
|
|
126
149
|
end
|
127
150
|
|
128
151
|
# Disable Turbolinks
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
out = ""
|
133
|
-
f.each do |line|
|
134
|
-
unless line =~ /\/\/= require turbolinks/
|
135
|
-
out << line
|
136
|
-
end
|
137
|
-
end
|
138
|
-
f.pos = 0
|
139
|
-
f.print out.chomp
|
140
|
-
f.truncate(f.pos)
|
141
|
-
end
|
142
|
-
|
143
|
-
File.open("app/views/layouts/application.html.erb", "r+") do |f|
|
144
|
-
out = ""
|
145
|
-
f.each do |line|
|
146
|
-
if line =~ /, 'data-turbolinks-track' => true/
|
147
|
-
out << "#{line.gsub(", 'data-turbolinks-track' => true", '')}"
|
148
|
-
else
|
149
|
-
out << line
|
150
|
-
end
|
151
|
-
end
|
152
|
-
f.pos = 0
|
153
|
-
f.print out.chomp
|
154
|
-
f.truncate(f.pos)
|
155
|
-
end
|
152
|
+
remove_line_from_file("Gemfile", "turbolinks")
|
153
|
+
remove_line_from_file("app/assets/javascripts/application.js", "turbolinks")
|
154
|
+
remove_part_of_line_from_file("app/views/layouts/application.html.erb", ", 'data-turbolinks-track' => true")
|
156
155
|
|
157
156
|
# Optionally set up Devise
|
158
157
|
devise = false
|
@@ -270,22 +269,7 @@ file 'Guardfile', %q(
|
|
270
269
|
|
271
270
|
# Set up Google Analytics
|
272
271
|
environment 'GA.tracker = Rails.application.secrets.google_analytics_code', env: 'production'
|
273
|
-
|
274
|
-
File.open("app/views/layouts/application.html.erb", "r+") do |f|
|
275
|
-
out = ""
|
276
|
-
f.each do |line|
|
277
|
-
if line =~ /<%= csrf_meta_tags %>/
|
278
|
-
out << "#{line}"
|
279
|
-
out << " <%= analytics_init if Rails.env.production? %>\n"
|
280
|
-
else
|
281
|
-
out << line
|
282
|
-
end
|
283
|
-
end
|
284
|
-
f.pos = 0
|
285
|
-
f.print out.chomp
|
286
|
-
f.truncate(f.pos)
|
287
|
-
end
|
288
|
-
|
272
|
+
add_line_to_file("app/views/layouts/application.html.erb", " <%= analytics_init if Rails.env.production? %>\n", "<%= csrf_meta_tags %>")
|
289
273
|
add_secret_for(google_analytics_code: 'YOUR CODE HERE', env: :production)
|
290
274
|
|
291
275
|
#Set up sprockets_better_errors
|
@@ -311,27 +295,19 @@ inside('app/assets/stylesheets') do
|
|
311
295
|
run "mv application.css application.css.scss"
|
312
296
|
end
|
313
297
|
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
elsif line =~ /\*\//
|
324
|
-
out << "#{line}"
|
325
|
-
out << "@import \"bootstrap\";"
|
326
|
-
else
|
327
|
-
out << line
|
328
|
-
end
|
329
|
-
end
|
330
|
-
f.pos = 0
|
331
|
-
f.print out.chomp
|
332
|
-
f.truncate(f.pos)
|
298
|
+
depend_on_lines = [
|
299
|
+
" //= depend_on_asset \"bootstrap/glyphicons-halflings-regular.svg\"\n",
|
300
|
+
" //= depend_on_asset \"bootstrap/glyphicons-halflings-regular.ttf\"\n",
|
301
|
+
" //= depend_on_asset \"bootstrap/glyphicons-halflings-regular.woff\"\n",
|
302
|
+
" //= depend_on_asset \"bootstrap/glyphicons-halflings-regular.eot\"\n"
|
303
|
+
]
|
304
|
+
|
305
|
+
depend_on_lines.each do |line|
|
306
|
+
add_line_to_file("app/assets/stylesheets/application.css.scss", line, /\*= require_self/)
|
333
307
|
end
|
334
308
|
|
309
|
+
add_line_to_file("app/assets/stylesheets/application.css.scss", "@import \"bootstrap\";", /\*\//)
|
310
|
+
|
335
311
|
File.open("app/assets/javascripts/application.js", "r+") do |f|
|
336
312
|
out = ""
|
337
313
|
jquery_count = 0
|
@@ -378,7 +354,9 @@ file 'STACK', <<-STACK.strip_heredoc.chomp
|
|
378
354
|
* You will need to add your analytics tracking code to `config/secrets.yml`
|
379
355
|
|
380
356
|
Deploying to Heroku:
|
381
|
-
1. `bin/setup <app_name
|
357
|
+
1. `bin/setup [<app_name>]`
|
358
|
+
* <app_name> is optional. It will, by default, attempt to create an
|
359
|
+
app on Heroku using your Rails application name.
|
382
360
|
2. `bin/deploy`
|
383
361
|
|
384
362
|
Deploying to Ninefold:
|
@@ -430,14 +408,14 @@ end
|
|
430
408
|
if yes?("Set up for Ninefold instead of Heroku? [y/N]")
|
431
409
|
setup_database_yml_for_ninefold
|
432
410
|
setup_secrets_yml_for_ninefold
|
433
|
-
|
411
|
+
remove_line_from_file("Gemfile", "rails_12factor")
|
434
412
|
else
|
435
413
|
file 'bin/setup', <<-SETUP.strip_heredoc.chomp
|
436
414
|
#!/usr/bin/env ruby
|
437
415
|
if ['-h', '--help'].include?(ARGV[0]) || ARGV[1]
|
438
416
|
puts <<-HELP.gsub(/^ {6}/, '')
|
439
417
|
Usage:
|
440
|
-
|
418
|
+
bin/setup [<app_name>]
|
441
419
|
HELP
|
442
420
|
elsif ARGV[0]
|
443
421
|
system("heroku create \#{ARGV[0]}")
|
@@ -464,6 +442,15 @@ else
|
|
464
442
|
run "chmod +x setup"
|
465
443
|
run "chmod +x deploy"
|
466
444
|
end
|
445
|
+
|
446
|
+
begin
|
447
|
+
heroku = IO.popen("heroku")
|
448
|
+
rescue
|
449
|
+
if yes?("It looks like you don't have Heroku installed yet. Install now? [y/N]")
|
450
|
+
system("brew install heroku")
|
451
|
+
system("heroku login")
|
452
|
+
end
|
453
|
+
end
|
467
454
|
end
|
468
455
|
|
469
456
|
# Initialize git repository and make initial commit
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flatiron-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arel English
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-03-
|
13
|
+
date: 2014-03-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|