flatiron-rails 0.0.3 → 0.0.5
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/bin/flatiron-rails +0 -0
- data/templates/flatiron.rb +116 -7
- 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: 575938bab2932893843465dea7cc4f33f0341d58
|
4
|
+
data.tar.gz: fdc0ead661e6caefaa504a07f72f831affe78f64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd46dc20444894d250545a3523d9abf9ce051d3bfece723d856df7c9f5038add03e25ba40903c3f0ff98a2787fbaac8c70490fa5b2529dfd07529c38b8f58296
|
7
|
+
data.tar.gz: 897fbeb85f9b45e5f414c8147c66e263aef6f6769c592cd489c76e255fafa85a4879a36e0caf862752c61eac6ca55ff2e96e2b8df80cbfef2bb3f5bee24ecce8
|
data/bin/flatiron-rails
CHANGED
File without changes
|
data/templates/flatiron.rb
CHANGED
@@ -343,15 +343,124 @@ file 'STACK', <<-STACK.strip_heredoc.chomp
|
|
343
343
|
* You will need to add your analytics tracking code to `config/secrets.yml`
|
344
344
|
|
345
345
|
Deploying to Heroku:
|
346
|
-
1. `
|
347
|
-
2. `
|
348
|
-
|
349
|
-
|
346
|
+
1. `bin/setup <app_name>`
|
347
|
+
2. `bin/deploy`
|
348
|
+
|
349
|
+
Deploying to Ninefold:
|
350
|
+
1. Create your app on Ninefold
|
351
|
+
2. Add the given SSH key to your account on GitHub
|
352
|
+
3. Choose the option for a single-server app
|
353
|
+
4. Choose Ruby 2.1.0
|
354
|
+
5. Change the name of the Environment Variable from SECRET_TOKEN to SECRET_KEY_BASE
|
355
|
+
6. Click deploy (it will probably fail)
|
356
|
+
7. Copy the relevant database information from the Database tab
|
357
|
+
8. Paste that info in your `config/secrets.yml` file
|
358
|
+
9. Push your changes
|
359
|
+
10. Re-deploy on Ninefold
|
350
360
|
STACK
|
351
361
|
|
362
|
+
# Helper methods for Ninefold setup
|
363
|
+
def setup_database_yml_for_ninefold
|
364
|
+
File.open("config/database.yml", "r+") do |f|
|
365
|
+
out = ""
|
366
|
+
f.each do |line|
|
367
|
+
if line =~ /url:/
|
368
|
+
out << <<-DB.gsub(/^ {8}/, '')
|
369
|
+
adapter: postgresql
|
370
|
+
encoding: utf8
|
371
|
+
database: Rails.application.secrets.ninefold_db
|
372
|
+
username: Rails.application.secrets.ninefold_user
|
373
|
+
password: Rails.application.secrets.ninefold_pass
|
374
|
+
host: localhost
|
375
|
+
port: 5432
|
376
|
+
pool: 10
|
377
|
+
DB
|
378
|
+
else
|
379
|
+
out << line
|
380
|
+
end
|
381
|
+
end
|
382
|
+
f.pos = 0
|
383
|
+
f.print out.chomp
|
384
|
+
f.truncate(f.pos)
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
def setup_secrets_yml_for_ninefold
|
389
|
+
File.open("config/secrets.yml", "r+") do |f|
|
390
|
+
out = ""
|
391
|
+
f.each do |line|
|
392
|
+
if line =~ /production:/
|
393
|
+
out << "#{line}"
|
394
|
+
out << <<-SECRETS.gsub(/^ {8}/, '')
|
395
|
+
ninefold_db: 'YOUR NINEFOLD DATABASE NAME HERE'
|
396
|
+
ninefold_user: 'NINEFOLD DATABASE USERNAME HERE'
|
397
|
+
ninefold_pass: 'NINEFOLD DATABASE PASSWORD HERE'
|
398
|
+
SECRETS
|
399
|
+
else
|
400
|
+
out << line
|
401
|
+
end
|
402
|
+
end
|
403
|
+
f.pos = 0
|
404
|
+
f.print out.chomp
|
405
|
+
f.truncate(f.pos)
|
406
|
+
end
|
407
|
+
end
|
408
|
+
|
409
|
+
def remove_12_factor
|
410
|
+
File.open("Gemfile", "r+") do |f|
|
411
|
+
out = ""
|
412
|
+
f.each do |line|
|
413
|
+
unless line =~ /gem "rails_12factor"/
|
414
|
+
out << line
|
415
|
+
end
|
416
|
+
end
|
417
|
+
f.pos = 0
|
418
|
+
f.print out.chomp
|
419
|
+
f.truncate(f.pos)
|
420
|
+
end
|
421
|
+
end
|
422
|
+
|
423
|
+
# Change setup for Ninefold
|
424
|
+
if yes?("Set up for Ninefold instead of Heroku? [y/N]")
|
425
|
+
setup_database_yml_for_ninefold
|
426
|
+
setup_secrets_yml_for_ninefold
|
427
|
+
remove_12_factor
|
428
|
+
else
|
429
|
+
file 'bin/setup', <<-SETUP.strip_heredoc.chomp
|
430
|
+
#!/usr/bin/env ruby
|
431
|
+
if ['-h', '--help'].include?(ARGV[0]) || ARGV[1]
|
432
|
+
puts <<-HELP.gsub(/^ {6}/, '')
|
433
|
+
Usage:
|
434
|
+
flatiron-rails [<app_name>]
|
435
|
+
HELP
|
436
|
+
elsif ARGV[0]
|
437
|
+
system("heroku create \#{ARGV[0]}")
|
438
|
+
else
|
439
|
+
system("heroku create \#{Dir.pwd.split('/').last}")
|
440
|
+
end
|
441
|
+
SETUP
|
442
|
+
|
443
|
+
file 'bin/deploy', <<-DEPLOY.strip_heredoc.chomp
|
444
|
+
#!/usr/bin/env ruby
|
445
|
+
io = IO.popen("git remote -v")
|
446
|
+
log = io.readlines
|
447
|
+
|
448
|
+
if !log.any? {|line| line.match(/heroku/)}
|
449
|
+
puts <<-ERROR.gsub(/^ {6}/, '')
|
450
|
+
You must run `bin/setup` first!
|
451
|
+
ERROR
|
452
|
+
else
|
453
|
+
system("git push heroku master && heroku run rake db:migrate && heroku open")
|
454
|
+
end
|
455
|
+
DEPLOY
|
456
|
+
|
457
|
+
inside('bin') do
|
458
|
+
run "chmod +x setup"
|
459
|
+
run "chmod +x deploy"
|
460
|
+
end
|
461
|
+
end
|
462
|
+
|
352
463
|
# Initialize git repository and make initial commit
|
353
464
|
git :init
|
354
465
|
git add: "."
|
355
|
-
git commit: %Q{ -m 'Initial commit' }
|
356
|
-
|
357
|
-
# TODO: Add ruby 2.1.0 to gemfile
|
466
|
+
git commit: %Q{ -m '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.5
|
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-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|