-
-
Notifications
You must be signed in to change notification settings - Fork 627
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'add-generators' of https://github.com/shakacode/react_o…
…n_rails into add-generators
- Loading branch information
Showing
7 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
lib/generators/react_on_rails/heroku_deployment_generator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require "rails/generators" | ||
require File.expand_path("../generator_helper", __FILE__) | ||
include GeneratorHelper | ||
|
||
module ReactOnRails | ||
module Generators | ||
class HerokuDeploymentGenerator < Rails::Generators::Base | ||
hide! | ||
source_root(File.expand_path("../templates", __FILE__)) | ||
|
||
def copy_heroku_deployment_files | ||
base_path = "heroku_deployment" | ||
%w(.buildpacks Procfile).each { |file| copy_file("#{base_path}/#{file}", file) } | ||
end | ||
|
||
def add_heroku_production_gems | ||
gem("rails_12factor", group: :production) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
lib/generators/react_on_rails/templates/heroku_deployment/.buildpacks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
https://github.com/heroku/heroku-buildpack-nodejs.git | ||
https://github.com/heroku/heroku-buildpack-ruby.git |
1 change: 1 addition & 0 deletions
1
lib/generators/react_on_rails/templates/heroku_deployment/Procfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
spec/react_on_rails/support/shared_examples/heroku_deployment_generator_examples.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
shared_examples "heroku_deployment" do | ||
it "should add heroku deployment files" do | ||
assert_file("Procfile") | ||
assert_file(".buildpacks") | ||
end | ||
|
||
it "should add heroku production gems" do | ||
assert_file("Gemfile") do |contents| | ||
assert_match("gem 'rails_12factor', group: :production", contents) | ||
end | ||
end | ||
end |