heroploy 0.0.1
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/.gitignore +17 -0
- data/.travis.yml +6 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +64 -0
- data/Rakefile +4 -0
- data/heroploy.gemspec +24 -0
- data/lib/heroploy/deploy_config.rb +39 -0
- data/lib/heroploy/git_commands.rb +44 -0
- data/lib/heroploy/heroku_commands.rb +17 -0
- data/lib/heroploy/shell.rb +11 -0
- data/lib/heroploy/tasks.rb +87 -0
- data/lib/heroploy/version.rb +3 -0
- data/lib/heroploy.rb +6 -0
- data/lib/railtie.rb +9 -0
- data/spec/lib/heroploy/git_commands_spec.rb +118 -0
- data/spec/lib/heroploy/heroku_commands_spec.rb +30 -0
- data/spec/lib/heroploy/shell_spec.rb +16 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/support/shell_support.rb +22 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1abe27a12facd2dc9f5efb27cfd5c959186ef25a
|
4
|
+
data.tar.gz: 1e2995fb4cd6a6af47366cda82c7362adcd032c9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 37e04d64e2abdb2730baeeb28233b25b4471e8b9c1e6000fc3b92e9bb70ede30eaa3f678871baaf8c1e7ac002c23127e21cf84a4efd0c9696ba0ceeb81657d81
|
7
|
+
data.tar.gz: 2e8a442f4431e1b1fbf0b2667033905ac12e927066a309abbe480efe0875cfdc2697a92fb6ac118c10cd254f8dffeb16adb2a8116d43bc7aec69b6ec1fd2a893
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 John Brunton
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# Heroploy
|
2
|
+
|
3
|
+
[](https://travis-ci.org/jbrunton/heroploy)
|
4
|
+
[](https://codeclimate.com/github/jbrunton/heroploy)
|
5
|
+
|
6
|
+
A few helpful rake tasks to manage deploying Rails apps to development, staging and production Heroku servers.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
gem 'heroploy'
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install heroploy
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
Add a .heroploy file in your application's root directory which describes the Heroku apps you will deploy to, and the checks you would like when deploying to each.
|
25
|
+
|
26
|
+
For example:
|
27
|
+
|
28
|
+
```yaml
|
29
|
+
apps:
|
30
|
+
development:
|
31
|
+
heroku: my-app-development
|
32
|
+
|
33
|
+
staging:
|
34
|
+
heroku: my-app-staging
|
35
|
+
checks:
|
36
|
+
pushed: true
|
37
|
+
branch: master
|
38
|
+
|
39
|
+
production:
|
40
|
+
heroku: my-app-production
|
41
|
+
tag: 'RELEASE_%Y%m%dT%H%M%S%z'
|
42
|
+
checks:
|
43
|
+
pushed: true
|
44
|
+
branch: master
|
45
|
+
staged: true
|
46
|
+
```
|
47
|
+
|
48
|
+
This file:
|
49
|
+
* Describes ```development```, ```staging``` and ```production``` deployment rules for three Heroku apps (named ```my-app-development```, ```my-app-staging``` and ```my-app-production``` on Heroku).
|
50
|
+
* Allows any branch to be pushed directly to ```development```.
|
51
|
+
* Only allows ```master``` to be pushed to ```staging```, and requires all changes to have first been pushed to ```origin```.
|
52
|
+
* Only allows deployment to ```production``` if the changes have first been staged on ```staging```.
|
53
|
+
|
54
|
+
To deploy to one of these environments, run ```rake heroploy:<environment>:deploy```. For example:
|
55
|
+
|
56
|
+
rake heroploy:production:deploy
|
57
|
+
|
58
|
+
## Contributing
|
59
|
+
|
60
|
+
1. Fork it
|
61
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
62
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
63
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
64
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/heroploy.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'heroploy/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "heroploy"
|
8
|
+
spec.version = Heroploy::VERSION
|
9
|
+
spec.authors = ["John Brunton"]
|
10
|
+
spec.email = ["john_brunton@hotmail.co.uk"]
|
11
|
+
spec.description = %q{Helpful rake tasks to manage deploying to development, staging and production Heroku servers}
|
12
|
+
spec.summary = %q{Helpful rake tasks for deploying to Heroku}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
class ChecksConfig
|
2
|
+
attr_reader :pushed
|
3
|
+
attr_reader :branch
|
4
|
+
attr_reader :staged
|
5
|
+
|
6
|
+
def initialize(attrs)
|
7
|
+
attrs ||= {}
|
8
|
+
@pushed = attrs['pushed']
|
9
|
+
@branch = attrs['branch']
|
10
|
+
@staged = attrs['staged']
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class AppConfig
|
15
|
+
attr_reader :name
|
16
|
+
attr_reader :remote
|
17
|
+
attr_reader :heroku
|
18
|
+
attr_reader :tag
|
19
|
+
attr_reader :checks
|
20
|
+
|
21
|
+
def initialize(name, attrs)
|
22
|
+
@name = name
|
23
|
+
@remote = attrs['remote'] || name
|
24
|
+
@heroku = attrs['heroku']
|
25
|
+
@tag = attrs['tag']
|
26
|
+
@checks = ChecksConfig.new(attrs['checks'])
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class DeployConfig
|
31
|
+
attr_reader :apps
|
32
|
+
|
33
|
+
def initialize(file_name)
|
34
|
+
@apps = YAML::load(File.open(file_name))['apps']
|
35
|
+
@apps.each do |app_name, attrs|
|
36
|
+
@apps[app_name] = AppConfig.new(app_name, attrs)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'heroploy/shell'
|
2
|
+
|
3
|
+
module GitCommands
|
4
|
+
def git_fetch
|
5
|
+
Shell.exec "git fetch"
|
6
|
+
end
|
7
|
+
|
8
|
+
def current_branch
|
9
|
+
branch = Shell.eval "git rev-parse --abbrev-ref HEAD"
|
10
|
+
branch.strip
|
11
|
+
end
|
12
|
+
|
13
|
+
def git_push_to_master(remote, local_branch)
|
14
|
+
if ENV['force'] == 'true' then opts = "--force " end
|
15
|
+
Shell.exec "git push #{opts}#{remote} #{local_branch}:master"
|
16
|
+
end
|
17
|
+
|
18
|
+
def git_remote_exists?(name)
|
19
|
+
remotes = Shell.eval("git remote").strip.split(/\s+/)
|
20
|
+
remotes.include?(name)
|
21
|
+
end
|
22
|
+
|
23
|
+
def git_remote_has_branch?(remote, branch_name)
|
24
|
+
branches = Shell.eval("git branch -r").strip.split(/\s+/)
|
25
|
+
branches.include?("#{remote}/#{branch_name}")
|
26
|
+
end
|
27
|
+
|
28
|
+
def git_remote_behind?(remote, remote_branch_name, local_branch_name = nil)
|
29
|
+
if local_branch_name.nil? then local_branch_name = remote_branch_name end
|
30
|
+
!Shell.eval("git log #{remote}/#{remote_branch_name}..#{local_branch_name}").empty?
|
31
|
+
end
|
32
|
+
|
33
|
+
def git_staged?(remote, local_branch)
|
34
|
+
!git_remote_behind?(remote, 'master', local_branch)
|
35
|
+
end
|
36
|
+
|
37
|
+
def git_tag(tag, message)
|
38
|
+
Shell.exec("git tag -a #{tag} -m \"#{message}\"")
|
39
|
+
end
|
40
|
+
|
41
|
+
def git_push_tag(tag)
|
42
|
+
Shell.exec("git push origin #{tag}")
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'heroploy/shell'
|
2
|
+
|
3
|
+
module HerokuCommands
|
4
|
+
def heroku_exec(cmd, app_name)
|
5
|
+
Shell.exec "heroku #{cmd} --app #{app_name}"
|
6
|
+
end
|
7
|
+
|
8
|
+
def heroku_run(cmd, app_name)
|
9
|
+
heroku_exec("run #{cmd}", app_name)
|
10
|
+
end
|
11
|
+
|
12
|
+
def heroku_migrate(app_name)
|
13
|
+
Bundler.with_clean_env do
|
14
|
+
heroku_run("rake db:migrate", app_name)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
require 'heroploy/git_commands'
|
2
|
+
require 'heroploy/heroku_commands'
|
3
|
+
require 'heroploy/deploy_config'
|
4
|
+
|
5
|
+
namespace :heroploy do
|
6
|
+
include GitCommands
|
7
|
+
include HerokuCommands
|
8
|
+
|
9
|
+
desc 'do a git fetch'
|
10
|
+
task :fetch do
|
11
|
+
git_fetch
|
12
|
+
end
|
13
|
+
|
14
|
+
deploy_config = DeployConfig.new('.heroploy.yml')
|
15
|
+
|
16
|
+
deploy_config.apps.each do |app_name, config|
|
17
|
+
namespace app_name do
|
18
|
+
namespace :check do
|
19
|
+
desc "check remote exists for #{app_name}"
|
20
|
+
task :remote do
|
21
|
+
remote = config.remote || app_name
|
22
|
+
unless git_remote_exists?(remote)
|
23
|
+
raise "Could not find remote '#{remote}'"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
desc "check changes have been pushed to origin"
|
28
|
+
task :pushed do
|
29
|
+
if config.checks.pushed then
|
30
|
+
branch_name = current_branch
|
31
|
+
unless git_remote_has_branch?('origin', branch_name)
|
32
|
+
raise "Branch #{branch_name} doesn't exist in origin"
|
33
|
+
end
|
34
|
+
|
35
|
+
if git_remote_behind?('origin', branch_name) then
|
36
|
+
raise "Branch #{branch_name} is behind origin/#{branch_name}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
desc "check we can deploy to #{app_name} from the current branch"
|
42
|
+
task :branch do
|
43
|
+
if config.checks.branch then
|
44
|
+
unless current_branch == config.checks.branch
|
45
|
+
raise "Cannot deploy branch #{current_branch} to #{app_name}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
desc "check the changes have already been staged"
|
51
|
+
task :staged do
|
52
|
+
if config.checks.staged then
|
53
|
+
staging_app_name = config.checks.staged == true ? 'staging' : config.checks.staged
|
54
|
+
unless git_staged?(deploy_config.apps[staging_app_name].remote, current_branch)
|
55
|
+
raise "Changes not yet staged on #{app_name}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
desc "do all the checks for #{app_name}"
|
61
|
+
task :all => [:remote, :pushed, :branch, :staged]
|
62
|
+
end
|
63
|
+
|
64
|
+
desc "push the current branch to master on #{app_name}"
|
65
|
+
task :push do
|
66
|
+
git_push_to_master(config.remote, current_branch)
|
67
|
+
end
|
68
|
+
|
69
|
+
desc "run database migrations on #{app_name}"
|
70
|
+
task :migrate do
|
71
|
+
heroku_migrate(config.heroku)
|
72
|
+
end
|
73
|
+
|
74
|
+
desc "tag the deployment to #{app_name}"
|
75
|
+
task :tag do
|
76
|
+
if config.tag then
|
77
|
+
tag = DateTime.now.strftime(config.tag)
|
78
|
+
git_tag(tag, "Deployed #{current_branch} to #{app_name}")
|
79
|
+
git_push_tag(tag)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
desc "deploy to #{app_name}"
|
84
|
+
task :deploy => ['check:all', :push, :migrate, :tag]
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
data/lib/heroploy.rb
ADDED
data/lib/railtie.rb
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GitCommands do
|
4
|
+
before(:each) do
|
5
|
+
stub_shell
|
6
|
+
end
|
7
|
+
|
8
|
+
let(:commands) { Object.new.extend(GitCommands) }
|
9
|
+
|
10
|
+
context "#git_fetch" do
|
11
|
+
it "executes a git fetch" do
|
12
|
+
expect_command("git fetch")
|
13
|
+
commands.git_fetch
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "#current_branch" do
|
18
|
+
let(:expected_rev_parse_output) { "master\n" }
|
19
|
+
|
20
|
+
it "evaluates git rev-parse to figure out the current branch" do
|
21
|
+
expect_eval("git rev-parse --abbrev-ref HEAD").and_return(expected_rev_parse_output)
|
22
|
+
commands.current_branch
|
23
|
+
end
|
24
|
+
|
25
|
+
it "trims the output to just the branch name" do
|
26
|
+
expect_eval.and_return(expected_rev_parse_output)
|
27
|
+
expect(commands.current_branch).to eq("master")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context "#git_push_to_master" do
|
32
|
+
it "pushes the local branch to the remote master" do
|
33
|
+
expect_command("git push my-remote my-branch:master")
|
34
|
+
commands.git_push_to_master("my-remote", "my-branch")
|
35
|
+
end
|
36
|
+
|
37
|
+
it "appends the --force option if the 'force' ENV variable is set" do
|
38
|
+
expect(ENV).to receive(:[]).and_return('true')
|
39
|
+
expect_command("git push --force my-remote my-branch:master")
|
40
|
+
commands.git_push_to_master("my-remote", "my-branch")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "#git_remote_exists?" do
|
45
|
+
it "evaluates git remote to enumerate the available remotes" do
|
46
|
+
expect_eval("git remote")
|
47
|
+
commands.git_remote_exists?("my-remote")
|
48
|
+
end
|
49
|
+
|
50
|
+
it "returns true if the given remote exists" do
|
51
|
+
expect_eval("git remote").and_return("origin\nstaging\nproduction")
|
52
|
+
expect(commands.git_remote_exists?("staging")).to eq(true)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "returns false if the given remote doesn't exist" do
|
56
|
+
expect_eval("git remote").and_return("origin\nproduction")
|
57
|
+
expect(commands.git_remote_exists?("staging")).to eq(false)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context "#git_remote_has_branch?" do
|
62
|
+
it "evaluates git branch -r to determine the remote branches" do
|
63
|
+
expect_eval("git branch -r")
|
64
|
+
commands.git_remote_has_branch?("my-remote", "my-branch")
|
65
|
+
end
|
66
|
+
|
67
|
+
it "returns true if the remote has a branch with the given name" do
|
68
|
+
expect_eval("git branch -r").and_return(" my-remote/my-branch\n my-remote/other-branch\n")
|
69
|
+
expect(commands.git_remote_has_branch?("my-remote", "my-branch")).to be(true)
|
70
|
+
end
|
71
|
+
|
72
|
+
it "returns false if the remote has no branch with the given name" do
|
73
|
+
expect_eval("git branch -r").and_return(" my-remote/other-branch\n")
|
74
|
+
expect(commands.git_remote_has_branch?("my-remote", "my-branch")).to be(false)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
context "#git_remote_behind?" do
|
79
|
+
it "inspects the git log to see if the remote is ahead" do
|
80
|
+
expect_eval("git log my-remote/my-remote-branch..my-local-branch")
|
81
|
+
commands.git_remote_behind?("my-remote", "my-remote-branch", "my-local-branch")
|
82
|
+
end
|
83
|
+
|
84
|
+
it "uses the remote branch name as the local branch name if none is supplied" do
|
85
|
+
expect_eval("git log my-remote/my-branch..my-branch")
|
86
|
+
commands.git_remote_behind?("my-remote", "my-branch")
|
87
|
+
end
|
88
|
+
|
89
|
+
it "returns true if git log returns commits" do
|
90
|
+
expect_eval("git log my-remote/my-remote-branch..my-local-branch").and_return("commit a1b2c3d")
|
91
|
+
expect(commands.git_remote_behind?("my-remote", "my-remote-branch", "my-local-branch")).to eq(true)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "returns false if git log returns no commits" do
|
95
|
+
expect_eval("git log my-remote/my-remote-branch..my-local-branch").and_return("")
|
96
|
+
expect(commands.git_remote_behind?("my-remote", "my-remote-branch", "my-local-branch")).to eq(false)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
context "#git_staged?" do
|
101
|
+
it "returns true if the remote master is up to date" do
|
102
|
+
expect_eval("git log my-remote/master..my-local-branch").and_return("")
|
103
|
+
expect(commands.git_staged?("my-remote", "my-local-branch")).to eq(true)
|
104
|
+
end
|
105
|
+
|
106
|
+
it "returns false if the remote master is behind" do
|
107
|
+
expect_eval("git log my-remote/master..my-local-branch").and_return("commit a1b2c3d")
|
108
|
+
expect(commands.git_staged?("my-remote", "my-local-branch")).to eq(false)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
context "#git_tag" do
|
113
|
+
it "creates a tag with the given name and message" do
|
114
|
+
expect_command("git tag -a my-tag -m \"my message\"")
|
115
|
+
commands.git_tag("my-tag", "my message")
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe HerokuCommands do
|
4
|
+
before(:each) do
|
5
|
+
stub_shell
|
6
|
+
end
|
7
|
+
|
8
|
+
let(:commands) { Object.new.extend(HerokuCommands) }
|
9
|
+
|
10
|
+
context "#heroku_exec" do
|
11
|
+
it "executes the heroku command for the given app" do
|
12
|
+
expect_command("heroku help --app my-app")
|
13
|
+
commands.heroku_exec("help", "my-app")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "#heroku_run" do
|
18
|
+
it "runs the given command on the heroku server" do
|
19
|
+
expect_command("heroku run rake db:migrate --app my-app")
|
20
|
+
commands.heroku_run("rake db:migrate", "my-app")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "#heroku_migrate" do
|
25
|
+
it "runs rake db:migrate on the heroku server" do
|
26
|
+
expect_command("heroku run rake db:migrate --app my-app")
|
27
|
+
commands.heroku_migrate("my-app")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Shell do
|
4
|
+
context "#eval" do
|
5
|
+
it "evaluates the given command using backticks" do
|
6
|
+
expect(Shell).to receive(:`).with('date')
|
7
|
+
Shell.eval('date')
|
8
|
+
end
|
9
|
+
|
10
|
+
it "returns the standard output from the shell command" do
|
11
|
+
expected_output = "Sun 19 Jan 2014 01:20:23 GMT\n"
|
12
|
+
expect(Shell).to receive(:`).and_return(expected_output)
|
13
|
+
expect(Shell.eval('date')).to eq(expected_output)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
module ShellSupport
|
2
|
+
def stub_shell
|
3
|
+
Shell.stub(:eval).and_return("")
|
4
|
+
Shell.stub(:exec)
|
5
|
+
end
|
6
|
+
|
7
|
+
def expect_command(cmd = nil)
|
8
|
+
if cmd.nil?
|
9
|
+
expect(Shell).to receive(:exec)
|
10
|
+
else
|
11
|
+
expect(Shell).to receive(:exec).with(cmd)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def expect_eval(cmd = nil)
|
16
|
+
if cmd.nil?
|
17
|
+
expect(Shell).to receive(:eval)
|
18
|
+
else
|
19
|
+
expect(Shell).to receive(:eval).with(cmd)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: heroploy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- John Brunton
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Helpful rake tasks to manage deploying to development, staging and production
|
56
|
+
Heroku servers
|
57
|
+
email:
|
58
|
+
- john_brunton@hotmail.co.uk
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- .gitignore
|
64
|
+
- .travis.yml
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- heroploy.gemspec
|
70
|
+
- lib/heroploy.rb
|
71
|
+
- lib/heroploy/deploy_config.rb
|
72
|
+
- lib/heroploy/git_commands.rb
|
73
|
+
- lib/heroploy/heroku_commands.rb
|
74
|
+
- lib/heroploy/shell.rb
|
75
|
+
- lib/heroploy/tasks.rb
|
76
|
+
- lib/heroploy/version.rb
|
77
|
+
- lib/railtie.rb
|
78
|
+
- spec/lib/heroploy/git_commands_spec.rb
|
79
|
+
- spec/lib/heroploy/heroku_commands_spec.rb
|
80
|
+
- spec/lib/heroploy/shell_spec.rb
|
81
|
+
- spec/spec_helper.rb
|
82
|
+
- spec/support/shell_support.rb
|
83
|
+
homepage: ''
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
metadata: {}
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 2.0.3
|
104
|
+
signing_key:
|
105
|
+
specification_version: 4
|
106
|
+
summary: Helpful rake tasks for deploying to Heroku
|
107
|
+
test_files:
|
108
|
+
- spec/lib/heroploy/git_commands_spec.rb
|
109
|
+
- spec/lib/heroploy/heroku_commands_spec.rb
|
110
|
+
- spec/lib/heroploy/shell_spec.rb
|
111
|
+
- spec/spec_helper.rb
|
112
|
+
- spec/support/shell_support.rb
|