heroku-rails-saas 0.1.0
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.
- data/CHANGELOG +39 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +46 -0
- data/LICENSE +65 -0
- data/README.md +211 -0
- data/Rakefile +43 -0
- data/TODO +0 -0
- data/heroku-rails.gemspec +38 -0
- data/lib/generators/heroku/config_generator.rb +19 -0
- data/lib/generators/templates/heroku.rake +33 -0
- data/lib/generators/templates/heroku.yml +52 -0
- data/lib/heroku-rails.rb +4 -0
- data/lib/heroku-rails/config.rb +146 -0
- data/lib/heroku-rails/hash_recursive_merge.rb +11 -0
- data/lib/heroku-rails/railtie.rb +8 -0
- data/lib/heroku-rails/runner.rb +278 -0
- data/lib/heroku/rails/tasks.rb +246 -0
- data/spec/fixtures/awesomeapp.yml +32 -0
- data/spec/fixtures/heroku-config.yml +16 -0
- data/spec/fixtures/mediocreapp.yml +14 -0
- data/spec/heroku/rails/heroku_config_spec.rb +157 -0
- data/spec/heroku/rails/heroku_runner_spec.rb +15 -0
- data/spec/spec_helper.rb +17 -0
- metadata +109 -0
data/CHANGELOG
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
Heroku Rails SaaS
|
2
|
+
|
3
|
+
v0.4.3
|
4
|
+
============================================
|
5
|
+
Forking Gem to Add support for multiple apps/environments to be run off the same rails code base
|
6
|
+
|
7
|
+
|
8
|
+
Heroku Rails
|
9
|
+
|
10
|
+
v0.2.0
|
11
|
+
============================================
|
12
|
+
Added Heroku Settings tasks, and rails generators
|
13
|
+
|
14
|
+
Cleaned out lots of tasks that are now handled by editing config/heroku.yml and running `rake heroku:setup`
|
15
|
+
|
16
|
+
Namespaced tasks such as heroku:deploy, heroku:console, etc. The only top level task now is `rake all ...` which sets all the environments. Individual environment tasks (e.g. `rake production ...`) are still generated without a namespace.
|
17
|
+
|
18
|
+
|
19
|
+
v0.0.1
|
20
|
+
============================================
|
21
|
+
Initial fork and reorganization
|
22
|
+
|
23
|
+
|
24
|
+
Heroku Sans
|
25
|
+
v0.2.0
|
26
|
+
============================================
|
27
|
+
|
28
|
+
Elijah Miller
|
29
|
+
Fix newline error in gem manifest
|
30
|
+
Improve instructions
|
31
|
+
|
32
|
+
Glenn Roberts
|
33
|
+
Gem-ify it
|
34
|
+
Improve generation of gems manifest
|
35
|
+
|
36
|
+
|
37
|
+
v0.0.1.
|
38
|
+
============================================
|
39
|
+
Initial release.
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
heroku-rails-saas (0.1.0)
|
5
|
+
heroku (>= 2.24.1)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ZenTest (4.7.0)
|
11
|
+
addressable (2.2.7)
|
12
|
+
autotest (4.4.6)
|
13
|
+
ZenTest (>= 4.4.1)
|
14
|
+
diff-lcs (1.1.3)
|
15
|
+
growl-glue (1.0.7)
|
16
|
+
heroku (2.24.1)
|
17
|
+
launchy (>= 0.3.2)
|
18
|
+
netrc (~> 0.7.1)
|
19
|
+
rest-client (~> 1.6.1)
|
20
|
+
rubyzip
|
21
|
+
launchy (2.1.0)
|
22
|
+
addressable (~> 2.2.6)
|
23
|
+
mime-types (1.18)
|
24
|
+
netrc (0.7.1)
|
25
|
+
rake (0.8.7)
|
26
|
+
rest-client (1.6.7)
|
27
|
+
mime-types (>= 1.16)
|
28
|
+
rspec (2.9.0)
|
29
|
+
rspec-core (~> 2.9.0)
|
30
|
+
rspec-expectations (~> 2.9.0)
|
31
|
+
rspec-mocks (~> 2.9.0)
|
32
|
+
rspec-core (2.9.0)
|
33
|
+
rspec-expectations (2.9.1)
|
34
|
+
diff-lcs (~> 1.1.3)
|
35
|
+
rspec-mocks (2.9.0)
|
36
|
+
rubyzip (0.9.7)
|
37
|
+
|
38
|
+
PLATFORMS
|
39
|
+
ruby
|
40
|
+
|
41
|
+
DEPENDENCIES
|
42
|
+
autotest
|
43
|
+
growl-glue
|
44
|
+
heroku-rails-saas!
|
45
|
+
rake (= 0.8.7)
|
46
|
+
rspec (~> 2.0)
|
data/LICENSE
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
Heroku Rails SaaS License:
|
2
|
+
Copyright (c) 2010 Lance Sanchez
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
|
23
|
+
Heroku Rails License:
|
24
|
+
Copyright (c) 2010 Jacques Crocker
|
25
|
+
|
26
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
27
|
+
a copy of this software and associated documentation files (the
|
28
|
+
"Software"), to deal in the Software without restriction, including
|
29
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
30
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
31
|
+
permit persons to whom the Software is furnished to do so, subject to
|
32
|
+
the following conditions:
|
33
|
+
|
34
|
+
The above copyright notice and this permission notice shall be
|
35
|
+
included in all copies or substantial portions of the Software.
|
36
|
+
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
38
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
39
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
40
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
41
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
42
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
43
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
44
|
+
|
45
|
+
Heroku Sans License:
|
46
|
+
Copyright (c) 2008 Elijah Miller
|
47
|
+
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
49
|
+
a copy of this software and associated documentation files (the
|
50
|
+
"Software"), to deal in the Software without restriction, including
|
51
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
52
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
53
|
+
permit persons to whom the Software is furnished to do so, subject to
|
54
|
+
the following conditions:
|
55
|
+
|
56
|
+
The above copyright notice and this permission notice shall be
|
57
|
+
included in all copies or substantial portions of the Software.
|
58
|
+
|
59
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
60
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
61
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
62
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
63
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
64
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
65
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,211 @@
|
|
1
|
+
Heroku Rails SaaS
|
2
|
+
=============
|
3
|
+
|
4
|
+
Easier configuration and deployment of Rails apps on Heroku
|
5
|
+
|
6
|
+
Configure all your Heroku enviroments via a YML file (config/heroku.yml) that defines all your environments, addons, and environment variables.
|
7
|
+
Configure your app specific Heroku environment via a YML file (config/heroku/awesomeapp.yml) thats defines all your environments, addons, and
|
8
|
+
environment variables for awesomeapp.
|
9
|
+
|
10
|
+
## Install
|
11
|
+
|
12
|
+
### Rails 3
|
13
|
+
|
14
|
+
Add this to your Gemfile:
|
15
|
+
|
16
|
+
group :development do
|
17
|
+
gem 'heroku-rails'
|
18
|
+
end
|
19
|
+
|
20
|
+
## Configure
|
21
|
+
|
22
|
+
In config/heroku.yml you will need add the Heroku apps that you would like to attach to this project. You can generate this file and edit it by running:
|
23
|
+
|
24
|
+
rails generate heroku:config
|
25
|
+
|
26
|
+
If you want to defined more
|
27
|
+
|
28
|
+
### Example Configuration File
|
29
|
+
|
30
|
+
For all configuration settings
|
31
|
+
|
32
|
+
config:
|
33
|
+
BUNDLE_WITHOUT: "test:development"
|
34
|
+
CONFIG_VAR1: "config1"
|
35
|
+
CONFIG_VAR2: "config2"
|
36
|
+
|
37
|
+
# Be sure to add yourself as a collaborator, otherwise your
|
38
|
+
# access to the app will be revoked.
|
39
|
+
collaborators:
|
40
|
+
- "my-heroku-email@somedomain.com"
|
41
|
+
- "another-heroku-email@somedomain.com"
|
42
|
+
|
43
|
+
addons:
|
44
|
+
- scheduler:standard
|
45
|
+
# add any other addons here
|
46
|
+
|
47
|
+
For an app specific settings awesomeapp
|
48
|
+
|
49
|
+
apps:
|
50
|
+
production: awesomeapp
|
51
|
+
staging: awesomeapp-staging
|
52
|
+
legacy: awesomeapp-legacy
|
53
|
+
|
54
|
+
stacks:
|
55
|
+
bamboo-mri-1.9.2
|
56
|
+
|
57
|
+
production:
|
58
|
+
CONFIG_VAR1: "config1-production"
|
59
|
+
|
60
|
+
collaborators
|
61
|
+
- "awesomeapp@somedomain.com"
|
62
|
+
|
63
|
+
domains:
|
64
|
+
production:
|
65
|
+
- "awesomeapp.com"
|
66
|
+
- "www.awesomeapp.com"
|
67
|
+
|
68
|
+
production:
|
69
|
+
- ssl:piggyback
|
70
|
+
- cron:daily
|
71
|
+
- newrelic:bronze
|
72
|
+
|
73
|
+
|
74
|
+
### Setting up Heroku
|
75
|
+
|
76
|
+
To set heroku up (using your heroku.yml), just run.
|
77
|
+
|
78
|
+
rake all heroku:setup
|
79
|
+
|
80
|
+
This will create the heroku apps you have defined, and create the settings for each.
|
81
|
+
|
82
|
+
Run `rake heroku:setup` every time you edit the heroku.yml. It will only make incremental changes (based on what you've added/removed). If nothing has changed in the heroku.yml since the last `heroku:setup`, then no heroku changes will be sent.
|
83
|
+
|
84
|
+
|
85
|
+
## Usage
|
86
|
+
|
87
|
+
After configuring your Heroku apps you can use rake tasks to control the
|
88
|
+
apps.
|
89
|
+
|
90
|
+
rake <app_name>:production heroku:deploy
|
91
|
+
|
92
|
+
A rake task with the shorthand name of each app is now available and adds that
|
93
|
+
server to the list that subsequent commands will execute on. Because this list
|
94
|
+
is additive, you can easily select which servers to run a command on.
|
95
|
+
|
96
|
+
rake <app_name>:demo <app_name>:staging heroku:restart
|
97
|
+
|
98
|
+
A special rake task 'all' is created that causes any further commands to
|
99
|
+
execute on all heroku apps (Note: Any environment labeled `production` will not
|
100
|
+
be included, you must explicitly state it).
|
101
|
+
|
102
|
+
Futhermore there are rake task 'environments' created from environments in configs
|
103
|
+
that causes any further commands to execute on all heroku apps.
|
104
|
+
|
105
|
+
rake all:production heroku:info
|
106
|
+
|
107
|
+
Need to add remotes for each app?
|
108
|
+
|
109
|
+
rake all heroku:remotes
|
110
|
+
|
111
|
+
A full list of tasks provided:
|
112
|
+
|
113
|
+
rake all # Select all non Production Heroku apps for later command
|
114
|
+
rake all:production # Select all Production Heroku apps for later command
|
115
|
+
rake heroku:deploy # Deploys, migrates and restarts latest code.
|
116
|
+
rake heroku:apps # Lists configured apps
|
117
|
+
rake heroku:info # Queries the heroku status info on each app
|
118
|
+
rake heroku:console # Opens a remote console
|
119
|
+
rake heroku:capture # Captures a bundle on Heroku
|
120
|
+
rake heroku:remotes # Add git remotes for all apps in this project
|
121
|
+
rake heroku:migrate # Migrates and restarts remote servers
|
122
|
+
rake heroku:restart # Restarts remote servers
|
123
|
+
|
124
|
+
rake heroku:setup # runs all heroku setup scripts
|
125
|
+
rake heroku:setup:addons # sets up the heroku addons
|
126
|
+
rake heroku:setup:collaborators # sets up the heroku collaborators
|
127
|
+
rake heroku:setup:config # sets up the heroku config env variables
|
128
|
+
rake heroku:setup:domains # sets up the heroku domains
|
129
|
+
rake heroku:setup:stacks # sets the correct stack for each heroku app
|
130
|
+
|
131
|
+
rake heroku:db:setup # Migrates and restarts remote servers
|
132
|
+
|
133
|
+
You can easily alias frequently used tasks within your application's Rakefile:
|
134
|
+
|
135
|
+
task :deploy => ["heroku:deploy"]
|
136
|
+
task :console => ["heroku:console"]
|
137
|
+
task :capture => ["heroku:capture"]
|
138
|
+
|
139
|
+
With this in place, you can be a bit more terse:
|
140
|
+
|
141
|
+
rake all:staging console
|
142
|
+
rake all deploy
|
143
|
+
|
144
|
+
### Deploy Hooks
|
145
|
+
|
146
|
+
You can easily hook into the deploy process by defining any of the following rake tasks.
|
147
|
+
|
148
|
+
When you ran `rails generate heroku:config`, it created a list of empty rake tasks within lib/tasks/heroku.rake. Edit these rake tasks to provide custom logic for before/after deployment.
|
149
|
+
|
150
|
+
namespace :heroku do
|
151
|
+
# runs before all the deploys complete
|
152
|
+
task :before_deploy do
|
153
|
+
|
154
|
+
end
|
155
|
+
|
156
|
+
# runs before each push to a particular heroku deploy environment
|
157
|
+
task :before_each_deploy do
|
158
|
+
|
159
|
+
end
|
160
|
+
|
161
|
+
# runs after each push to a particular heroku deploy environment
|
162
|
+
task :after_each_deploy do
|
163
|
+
|
164
|
+
end
|
165
|
+
|
166
|
+
# runs after all the deploys complete
|
167
|
+
task :after_deploy do
|
168
|
+
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
|
173
|
+
## About Heroku Rails SaaS
|
174
|
+
|
175
|
+
### Links
|
176
|
+
|
177
|
+
Homepage:: <https://github.com/darkbushido/heroku-rails-saas>
|
178
|
+
|
179
|
+
Issue Tracker:: <http://github.com/darkbushido/heroku-rails-saas/issues>
|
180
|
+
|
181
|
+
### License
|
182
|
+
|
183
|
+
License:: Copyright (c) 2012 Lance Sanchez <lance.sanchez@gmail.com> released under the MIT license.
|
184
|
+
|
185
|
+
## Forked from Heroku Rails
|
186
|
+
|
187
|
+
Heroku Rails SaaS is a fork/extension for Heroku Rails to add the ability to manage multiple apps with multiple enviroments
|
188
|
+
|
189
|
+
### Heroku Rails Contributors
|
190
|
+
|
191
|
+
* Jacques Crocker (railsjedi@gmail.com)
|
192
|
+
|
193
|
+
### Heroku Rails License
|
194
|
+
|
195
|
+
License:: Copyright (c) 2010 Jacques Crocker <railsjedi@gmail.com>, released under the MIT license.
|
196
|
+
|
197
|
+
## Forked from Heroku Sans
|
198
|
+
|
199
|
+
Heroku Rails is a fork and rewrite/reorganiziation of the heroku_sans gem. Heroku Sans is a simple and elegant set of Rake tasks for managing Heroku environments. Check out that project here: <http://github.com/fastestforward/heroku_san>
|
200
|
+
|
201
|
+
### Heroku Sans Contributors
|
202
|
+
|
203
|
+
* Elijah Miller (elijah.miller@gmail.com)
|
204
|
+
* Glenn Roberts (glenn.roberts@siyelo.com)
|
205
|
+
* Damien Mathieu (42@dmathieu.com)
|
206
|
+
|
207
|
+
### Heroku Sans License
|
208
|
+
|
209
|
+
License:: Copyright (c) 2009 Elijah Miller <elijah.miller@gmail.com>, released under the MIT license.
|
210
|
+
|
211
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require "bundler"
|
2
|
+
Bundler.setup
|
3
|
+
|
4
|
+
require 'rake'
|
5
|
+
require 'rake/gempackagetask'
|
6
|
+
|
7
|
+
gemspec = eval(File.read('heroku-rails.gemspec'))
|
8
|
+
Rake::GemPackageTask.new(gemspec) do |pkg|
|
9
|
+
pkg.gem_spec = gemspec
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "build the gem and release it to rubygems.org"
|
13
|
+
task :release => :gem do
|
14
|
+
puts "Tagging #{gemspec.version}..."
|
15
|
+
system "git tag -a #{gemspec.version} -m 'Tagging #{gemspec.version}'"
|
16
|
+
puts "Pushing to Github..."
|
17
|
+
system "git push --tags"
|
18
|
+
puts "Pushing to rubygems.org..."
|
19
|
+
system "gem push pkg/#{gemspec.name}-#{gemspec.version}.gem"
|
20
|
+
end
|
21
|
+
|
22
|
+
require "rspec"
|
23
|
+
require "rspec/core/rake_task"
|
24
|
+
|
25
|
+
Rspec::Core::RakeTask.new(:spec) do |spec|
|
26
|
+
spec.pattern = "spec/**/*_spec.rb"
|
27
|
+
end
|
28
|
+
|
29
|
+
Rspec::Core::RakeTask.new('spec:progress') do |spec|
|
30
|
+
spec.rspec_opts = %w(--format progress)
|
31
|
+
spec.pattern = "spec/**/*_spec.rb"
|
32
|
+
end
|
33
|
+
|
34
|
+
require "rake/rdoctask"
|
35
|
+
Rake::RDocTask.new do |rdoc|
|
36
|
+
rdoc.rdoc_dir = "rdoc"
|
37
|
+
rdoc.title = "Heroku Rails SaaS #{gemspec.version}"
|
38
|
+
rdoc.rdoc_files.include("README*")
|
39
|
+
rdoc.rdoc_files.include("lib/**/*.rb")
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
task :default => :spec
|
data/TODO
ADDED
File without changes
|
@@ -0,0 +1,38 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "heroku-rails-saas"
|
3
|
+
s.version = "0.1.0"
|
4
|
+
|
5
|
+
s.authors = [ "Elijah Miller", "Glenn Roberts", "Jacques Crocker", "Lance Sanchez"]
|
6
|
+
|
7
|
+
s.summary = "Deployment and configuration tools for Heroku/Rails"
|
8
|
+
s.description = "Manage multiple Heroku instances/apps for a single Rails app using Rake."
|
9
|
+
|
10
|
+
s.email = "railsjedi@gmail.com"
|
11
|
+
s.homepage = "http://github.com/darkbushido/heroku-rails-saas"
|
12
|
+
s.rubyforge_project = "none"
|
13
|
+
|
14
|
+
s.require_paths = ["lib"]
|
15
|
+
s.files = Dir['lib/**/*',
|
16
|
+
'spec/**/*',
|
17
|
+
'heroku-rails.gemspec',
|
18
|
+
'Gemfile',
|
19
|
+
'Gemfile.lock',
|
20
|
+
'CHANGELOG',
|
21
|
+
'LICENSE',
|
22
|
+
'Rakefile',
|
23
|
+
'README.md',
|
24
|
+
'TODO']
|
25
|
+
|
26
|
+
s.test_files = Dir['spec/**/*']
|
27
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
28
|
+
s.extra_rdoc_files = [
|
29
|
+
"LICENSE",
|
30
|
+
"README.md",
|
31
|
+
"TODO",
|
32
|
+
"CHANGELOG"
|
33
|
+
]
|
34
|
+
|
35
|
+
s.add_runtime_dependency "heroku", ">= 2.24.1"
|
36
|
+
s.add_development_dependency "rspec", "~> 2.0"
|
37
|
+
end
|
38
|
+
|