github_heroku_deployer 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/Guardfile +5 -0
- data/LICENSE +22 -0
- data/README.md +117 -0
- data/Rakefile +2 -0
- data/github_heroku_deployer.gemspec +26 -0
- data/lib/github_heroku_deployer/configuration.rb +56 -0
- data/lib/github_heroku_deployer/exceptions.rb +3 -0
- data/lib/github_heroku_deployer/git.rb +66 -0
- data/lib/github_heroku_deployer/heroku.rb +51 -0
- data/lib/github_heroku_deployer/version.rb +3 -0
- data/lib/github_heroku_deployer.rb +57 -0
- data/spec/lib/github_heroku_deployer/configuration_spec.rb +42 -0
- data/spec/lib/github_heroku_deployer/git_spec.rb +5 -0
- data/spec/lib/github_heroku_deployer/heroku_spec.rb +5 -0
- data/spec/lib/github_heroku_deployer_spec.rb +82 -0
- data/spec/spec_helper.rb +3 -0
- metadata +186 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 G5
|
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,117 @@
|
|
1
|
+
# Github Heroku Deployer
|
2
|
+
|
3
|
+
Ruby gem to deploy Github repos to Heroku
|
4
|
+
|
5
|
+
|
6
|
+
## Current Version
|
7
|
+
|
8
|
+
0.0.1
|
9
|
+
|
10
|
+
|
11
|
+
## Requirements
|
12
|
+
|
13
|
+
* ["heroku_api", "~> 0.3.5"](http://rubygems.org/gems/heroku-api)
|
14
|
+
* ["git", "~> 1.2.5"](http://rubygems.org/gems/git)
|
15
|
+
* ["git-ssh-wrapper", "~> 0.1.0"](http://rubygems.org/gems/git-ssh-wrapper)
|
16
|
+
|
17
|
+
|
18
|
+
## Installation
|
19
|
+
|
20
|
+
### Gemfile
|
21
|
+
|
22
|
+
Add this line to your application's Gemfile:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
gem 'github_heroku_deployer'
|
26
|
+
```
|
27
|
+
|
28
|
+
### Manual
|
29
|
+
|
30
|
+
Or install it yourself:
|
31
|
+
|
32
|
+
```bash
|
33
|
+
gem install github_heroku_deployer
|
34
|
+
```
|
35
|
+
|
36
|
+
|
37
|
+
## Usage
|
38
|
+
|
39
|
+
Set defaults in an initializer, defaults are shown:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
GithubHerokuDeployer.configure do |config|
|
43
|
+
config.ssh = false
|
44
|
+
config.github_repo = ENV["GITHUB_REPO"]
|
45
|
+
config.heroku_api_key = ENV["HEROKU_API_KEY"]
|
46
|
+
config.heroku_app_name = ENV["HEROKU_APP_NAME"]
|
47
|
+
config.heroku_repo = ENV["HEROKU_REPO"]
|
48
|
+
config.heroku_username = ENV["HEROKU_USERNAME"]
|
49
|
+
end
|
50
|
+
```
|
51
|
+
|
52
|
+
Export you environment variables wherever you do that:
|
53
|
+
|
54
|
+
```bash
|
55
|
+
export GITHUB_REPO=git@github.com:your/repo.git
|
56
|
+
export HEROKU_API_KEY=heroku_api_key
|
57
|
+
export HEROKU_APP_NAME=heroku_app_name
|
58
|
+
export HEROKU_REPO=git@heroku.com:repo.git
|
59
|
+
export HEROKU_USERNAME=heroku_username
|
60
|
+
```
|
61
|
+
|
62
|
+
Deploy:
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
GithubHerokuDeployer.deploy
|
66
|
+
```
|
67
|
+
|
68
|
+
TODO Override defaults:
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
GithubHerokuDeployer.deploy(github_repo: github_repo)
|
72
|
+
```
|
73
|
+
|
74
|
+
|
75
|
+
## Authors
|
76
|
+
|
77
|
+
* Jessica Lynn Suttles / [@jlsuttles](https://github.com/jlsuttles)
|
78
|
+
|
79
|
+
|
80
|
+
## Contributing
|
81
|
+
|
82
|
+
1. Fork it
|
83
|
+
2. Get it running
|
84
|
+
3. Create your feature branch (`git checkout -b my-new-feature`)
|
85
|
+
4. Write your code and **specs**
|
86
|
+
5. Commit your changes (`git commit -am 'Add some feature'`)
|
87
|
+
6. Push to the branch (`git push origin my-new-feature`)
|
88
|
+
7. Create new Pull Request
|
89
|
+
|
90
|
+
If you find bugs, have feature requests or questions, please
|
91
|
+
[file an issue](https://github.com/G5/github_heroku_deployer/issues).
|
92
|
+
|
93
|
+
|
94
|
+
## License
|
95
|
+
|
96
|
+
Copyright (c) 2012 G5
|
97
|
+
|
98
|
+
MIT License
|
99
|
+
|
100
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
101
|
+
a copy of this software and associated documentation files (the
|
102
|
+
"Software"), to deal in the Software without restriction, including
|
103
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
104
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
105
|
+
permit persons to whom the Software is furnished to do so, subject to
|
106
|
+
the following conditions:
|
107
|
+
|
108
|
+
The above copyright notice and this permission notice shall be
|
109
|
+
included in all copies or substantial portions of the Software.
|
110
|
+
|
111
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
112
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
113
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
114
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
115
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
116
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
117
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/github_heroku_deployer/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = "github_heroku_deployer"
|
6
|
+
gem.version = GithubHerokuDeployer::VERSION
|
7
|
+
gem.authors = ["Jessica Lynn Suttles"]
|
8
|
+
gem.email = ["jlsuttles@gmail.com"]
|
9
|
+
gem.description = %q{Deploys Github repos to Heroku}
|
10
|
+
gem.summary = %q{Deploys Github repos to Heroku}
|
11
|
+
gem.homepage = ""
|
12
|
+
|
13
|
+
gem.files = `git ls-files`.split($\)
|
14
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
15
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
16
|
+
gem.require_paths = ["lib"]
|
17
|
+
|
18
|
+
gem.add_runtime_dependency "heroku-api", "~> 0.3.5"
|
19
|
+
gem.add_runtime_dependency "git", "~> 1.2.5"
|
20
|
+
gem.add_runtime_dependency "git-ssh-wrapper", "~> 0.1.0"
|
21
|
+
|
22
|
+
gem.add_development_dependency "rspec", "~> 2.11.0"
|
23
|
+
gem.add_development_dependency "guard-rspec", "~> 2.1.0"
|
24
|
+
gem.add_development_dependency "rb-fsevent", "~> 0.9.2"
|
25
|
+
gem.add_development_dependency "debugger", "~> 1.2.1"
|
26
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module GithubHerokuDeployer
|
2
|
+
class Configuration
|
3
|
+
OPTIONS = {
|
4
|
+
github_repo: ENV["GITHUB_REPO"],
|
5
|
+
heroku_api_key: ENV["HEROKU_API_KEY"],
|
6
|
+
heroku_app_name: ENV["HEROKU_APP_NAME"],
|
7
|
+
heroku_repo: ENV["HEROKU_REPO"],
|
8
|
+
heroku_username: ENV["HEROKU_USERNAME"],
|
9
|
+
ssh_enabled: false,
|
10
|
+
}
|
11
|
+
|
12
|
+
# Defines accessors for all OPTIONS
|
13
|
+
OPTIONS.each_pair do |key, value|
|
14
|
+
attr_accessor key
|
15
|
+
end
|
16
|
+
|
17
|
+
# Initializes defaults to be the environment varibales of the same names
|
18
|
+
def initialize
|
19
|
+
OPTIONS.each_pair do |key, value|
|
20
|
+
self.send("#{key}=", value)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Allows config options to be read like a hash
|
25
|
+
#
|
26
|
+
# @param [Symbol] option Key for a given attribute
|
27
|
+
def [](option)
|
28
|
+
send(option)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Returns a hash of all configurable options
|
32
|
+
def to_hash
|
33
|
+
OPTIONS.inject({}) do |hash, option|
|
34
|
+
key = option.first
|
35
|
+
hash[key] = self.send(key)
|
36
|
+
hash
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Returns a hash of all configurable options merged with +hash+
|
41
|
+
#
|
42
|
+
# @param [Hash] hash A set of configuration options that will take
|
43
|
+
# precedence over the defaults
|
44
|
+
def merge(hash)
|
45
|
+
to_hash.merge(hash)
|
46
|
+
end
|
47
|
+
|
48
|
+
def validate_presence(options)
|
49
|
+
OPTIONS.each_pair do |key, value|
|
50
|
+
if options[key].nil?
|
51
|
+
raise GithubHerokuDeployer::ConfigurationException, "#{key} is missing"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require "git"
|
2
|
+
require "git-ssh-wrapper"
|
3
|
+
|
4
|
+
module GithubHerokuDeployer
|
5
|
+
class Git
|
6
|
+
|
7
|
+
def initialize(options)
|
8
|
+
@ssh_enabled = options[:ssh_enabled]
|
9
|
+
@heroku_repo = options[:heroku_repo]
|
10
|
+
@github_repo = options[:github_repo]
|
11
|
+
end
|
12
|
+
|
13
|
+
def push_app_to_heroku(remote="heroku", branch="master")
|
14
|
+
wrapper = GitSSHWrapper.new(private_key_path: "~/.ssh/id_rsa")
|
15
|
+
repo.add_remote("heroku", @heroku_repo) unless repo.remote("heroku").url
|
16
|
+
`cd #{repo.dir}; env #{wrapper.git_ssh} git push -f #{remote} #{branch}`
|
17
|
+
ensure
|
18
|
+
wrapper.unlink
|
19
|
+
end
|
20
|
+
|
21
|
+
def repo
|
22
|
+
@repo ||= setup_repo
|
23
|
+
end
|
24
|
+
|
25
|
+
def setup_repo
|
26
|
+
# remove_folder
|
27
|
+
clone_or_pull
|
28
|
+
open_repo
|
29
|
+
end
|
30
|
+
|
31
|
+
# def remove_folder
|
32
|
+
# `rm -r #{folder}`
|
33
|
+
# end
|
34
|
+
|
35
|
+
def folder
|
36
|
+
@folder ||= "repos/#{Zlib.crc32(@github_repo)}"
|
37
|
+
end
|
38
|
+
|
39
|
+
def clone_or_pull
|
40
|
+
!exists_locally? ? clone : pull
|
41
|
+
end
|
42
|
+
|
43
|
+
def exists_locally?
|
44
|
+
File.exists?(File.join(folder, ".git", "config"))
|
45
|
+
end
|
46
|
+
|
47
|
+
def clone
|
48
|
+
wrapper = GitSSHWrapper.new(private_key_path: "~/.ssh/id_rsa")
|
49
|
+
`env #{wrapper.git_ssh} git clone #{@github_repo} #{folder}`
|
50
|
+
ensure
|
51
|
+
wrapper.unlink
|
52
|
+
end
|
53
|
+
|
54
|
+
def pull
|
55
|
+
wrapper = GitSSHWrapper.new(private_key_path: "~/.ssh/id_rsa")
|
56
|
+
dir = Dir.pwd # need to cd back to here
|
57
|
+
`cd #{folder}; env #{wrapper.git_ssh} git pull; cd #{dir}`
|
58
|
+
ensure
|
59
|
+
wrapper.unlink
|
60
|
+
end
|
61
|
+
|
62
|
+
def open_repo
|
63
|
+
::Git.open(folder)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require "heroku-api"
|
2
|
+
|
3
|
+
module GithubHerokuDeployer
|
4
|
+
class Heroku
|
5
|
+
|
6
|
+
def initialize(options)
|
7
|
+
@heroku_api_key = options[:heroku_api_key]
|
8
|
+
@heroku_app_name = options[:heroku_app_name]
|
9
|
+
end
|
10
|
+
|
11
|
+
def heroku
|
12
|
+
@heroku ||= ::Heroku::API.new(api_key: @heroku_api_key)
|
13
|
+
end
|
14
|
+
|
15
|
+
def app
|
16
|
+
@app ||= find_or_create_app
|
17
|
+
end
|
18
|
+
|
19
|
+
def find_or_create_app
|
20
|
+
find_app || create_app
|
21
|
+
end
|
22
|
+
|
23
|
+
def find_app
|
24
|
+
heroku.get_app(@heroku_app_name)
|
25
|
+
end
|
26
|
+
|
27
|
+
def create_app
|
28
|
+
heroku.post_app(name: @heroku_app_name)
|
29
|
+
end
|
30
|
+
|
31
|
+
# def delete_app
|
32
|
+
# heroku.delete_app(@heroku_app_name)
|
33
|
+
# end
|
34
|
+
|
35
|
+
# def add_deployhooks_http(url)
|
36
|
+
# add_addon("deployhooks:http", url: url)
|
37
|
+
# end
|
38
|
+
|
39
|
+
# def add_addon(addon, options={})
|
40
|
+
# heroku.post_addon(@heroku_app_name, addon, options)
|
41
|
+
# end
|
42
|
+
|
43
|
+
# def delete_addon(addon)
|
44
|
+
# heroku.delete_addon(@heroku_app_name, addon)
|
45
|
+
# end
|
46
|
+
|
47
|
+
# def migrate
|
48
|
+
# heroku.post_ps(@heroku_app_name, "rake db:migrate")
|
49
|
+
# end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require "github_heroku_deployer/exceptions"
|
2
|
+
require "github_heroku_deployer/configuration"
|
3
|
+
require "github_heroku_deployer/git"
|
4
|
+
require "github_heroku_deployer/heroku"
|
5
|
+
require "github_heroku_deployer/version"
|
6
|
+
|
7
|
+
module GithubHerokuDeployer
|
8
|
+
class << self
|
9
|
+
# A GithubHerokuDeployer configuration object. Must act like a hash and
|
10
|
+
# return sensible values for all GithubHerokuDeployer configuration options.
|
11
|
+
#
|
12
|
+
# @see GithubHerokuDeployer::Configuration.
|
13
|
+
attr_writer :configuration
|
14
|
+
|
15
|
+
# The configuration object.
|
16
|
+
#
|
17
|
+
# @see GithubHerokuDeployer.configure
|
18
|
+
def configuration
|
19
|
+
@configuration ||= Configuration.new
|
20
|
+
end
|
21
|
+
|
22
|
+
# Call this method to modify defaults in your initializers.
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# GithubHerokuDeployer.configure do |config|
|
26
|
+
# config.github_repo = ENV["GITHUB_REPO"]
|
27
|
+
# config.heroku_api_key = ENV["HEROKU_API_KEY"]
|
28
|
+
# config.heroku_app_name = ENV["HEROKU_APP_NAME"]
|
29
|
+
# config.heroku_repo = ENV["HEROKU_REPO"]
|
30
|
+
# config.heroku_username = ENV["HEROKU_USERNAME"]
|
31
|
+
# config.ssh_enabled = false
|
32
|
+
# end
|
33
|
+
def configure
|
34
|
+
yield(configuration)
|
35
|
+
end
|
36
|
+
|
37
|
+
def deploy(options={})
|
38
|
+
options = configuration.merge(options)
|
39
|
+
validate_options(options)
|
40
|
+
heroku_find_or_create_app(options)
|
41
|
+
git_push_app_to_heroku(options)
|
42
|
+
true
|
43
|
+
end
|
44
|
+
|
45
|
+
def validate_options(options)
|
46
|
+
configuration.validate_presence(options)
|
47
|
+
end
|
48
|
+
|
49
|
+
def heroku_find_or_create_app(options)
|
50
|
+
Heroku.new(options).find_or_create_app
|
51
|
+
end
|
52
|
+
|
53
|
+
def git_push_app_to_heroku(options)
|
54
|
+
Git.new(options).push_app_to_heroku
|
55
|
+
end
|
56
|
+
end # class << self
|
57
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'github_heroku_deployer'
|
3
|
+
require 'github_heroku_deployer/configuration'
|
4
|
+
|
5
|
+
describe GithubHerokuDeployer::Configuration do
|
6
|
+
it { should respond_to :"[]" }
|
7
|
+
it { should respond_to :to_hash }
|
8
|
+
it { should respond_to :merge }
|
9
|
+
|
10
|
+
it "provides default values" do
|
11
|
+
assert_config_default :github_repo, ENV["GITHUB_REPO"]
|
12
|
+
end
|
13
|
+
|
14
|
+
it "allows values to be overwritten" do
|
15
|
+
assert_config_overridable :github_repo
|
16
|
+
end
|
17
|
+
|
18
|
+
it "acts like a hash" do
|
19
|
+
config = GithubHerokuDeployer::Configuration.new
|
20
|
+
hash = config.to_hash
|
21
|
+
GithubHerokuDeployer::Configuration::OPTIONS.each_pair do |key, value|
|
22
|
+
config[key].should eq(hash[key])
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it "is mergable" do
|
27
|
+
config = GithubHerokuDeployer::Configuration.new
|
28
|
+
hash = config.to_hash
|
29
|
+
config.merge(:key => 'value').should eq(hash.merge(:key => 'value'))
|
30
|
+
end
|
31
|
+
|
32
|
+
def assert_config_default(option, default_value, config = nil)
|
33
|
+
config ||= GithubHerokuDeployer::Configuration.new
|
34
|
+
config.send(option).should eq(default_value)
|
35
|
+
end
|
36
|
+
|
37
|
+
def assert_config_overridable(option, value = 'a value')
|
38
|
+
config = GithubHerokuDeployer::Configuration.new
|
39
|
+
config.send(:"#{option}=", value)
|
40
|
+
config.send(option).should eq(value)
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'github_heroku_deployer'
|
3
|
+
|
4
|
+
describe GithubHerokuDeployer do
|
5
|
+
it { should respond_to :configuration }
|
6
|
+
it { should respond_to :configure }
|
7
|
+
it { should respond_to :deploy }
|
8
|
+
|
9
|
+
describe "::configuration" do
|
10
|
+
it "should be the configuration object" do
|
11
|
+
GithubHerokuDeployer.configuration.should(
|
12
|
+
be_a_kind_of GithubHerokuDeployer::Configuration)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "give a new instance if non defined" do
|
16
|
+
GithubHerokuDeployer.configuration = nil
|
17
|
+
GithubHerokuDeployer.configuration.should(
|
18
|
+
be_a_kind_of GithubHerokuDeployer::Configuration)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "::configure" do
|
23
|
+
it "should yield the configuration object" do
|
24
|
+
GithubHerokuDeployer.configure do |config|
|
25
|
+
config.should equal(GithubHerokuDeployer.configuration)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "::deploy" do
|
31
|
+
|
32
|
+
context "when unconfigured" do
|
33
|
+
before :each do
|
34
|
+
GithubHerokuDeployer.configure do |config|
|
35
|
+
config.github_repo = nil
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
it "requires github_repo to be set" do
|
40
|
+
lambda { GithubHerokuDeployer.deploy }.should(
|
41
|
+
raise_error ::GithubHerokuDeployer::ConfigurationException)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context "when configured" do
|
46
|
+
before :each do
|
47
|
+
@deployer = mock("github_heroku_deployer")
|
48
|
+
@deployer.stub!(:deploy).and_return(true)
|
49
|
+
end
|
50
|
+
|
51
|
+
# TODO: how can I test this better?
|
52
|
+
it "deploys public repos" do
|
53
|
+
GithubHerokuDeployer.configure do |config|
|
54
|
+
config.github_repo = ENV["PUBLIC_GITHUB_REPO"]
|
55
|
+
end
|
56
|
+
# GithubHerokuDeployer.deploy.should be true
|
57
|
+
@deployer.deploy.should be true
|
58
|
+
end
|
59
|
+
|
60
|
+
# TODO: how can I test this better?
|
61
|
+
it "deploys private repos" do
|
62
|
+
GithubHerokuDeployer.configure do |config|
|
63
|
+
config.ssh_enabled = true
|
64
|
+
config.github_repo = ENV["PRIVATE_GITHUB_REPO"]
|
65
|
+
end
|
66
|
+
# GithubHerokuDeployer.deploy.should be true
|
67
|
+
@deployer.deploy.should be true
|
68
|
+
end
|
69
|
+
|
70
|
+
# TODO: how can I test this better?
|
71
|
+
it "overrides defaults" do
|
72
|
+
GithubHerokuDeployer.configure do |config|
|
73
|
+
config.github_repo = ""
|
74
|
+
end
|
75
|
+
|
76
|
+
override = ENV["PUBLIC_GITHUB_REPO"]
|
77
|
+
override.should_not equal GithubHerokuDeployer.configuration[:github_repo]
|
78
|
+
@deployer.deploy(github_repo: override).should be true
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,186 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: github_heroku_deployer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jessica Lynn Suttles
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-10-26 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: heroku-api
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.3.5
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.3.5
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: git
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.2.5
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.2.5
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: git-ssh-wrapper
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.1.0
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.1.0
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 2.11.0
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.11.0
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: guard-rspec
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 2.1.0
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 2.1.0
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rb-fsevent
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 0.9.2
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.9.2
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: debugger
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.2.1
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 1.2.1
|
126
|
+
description: Deploys Github repos to Heroku
|
127
|
+
email:
|
128
|
+
- jlsuttles@gmail.com
|
129
|
+
executables: []
|
130
|
+
extensions: []
|
131
|
+
extra_rdoc_files: []
|
132
|
+
files:
|
133
|
+
- .gitignore
|
134
|
+
- Gemfile
|
135
|
+
- Guardfile
|
136
|
+
- LICENSE
|
137
|
+
- README.md
|
138
|
+
- Rakefile
|
139
|
+
- github_heroku_deployer.gemspec
|
140
|
+
- lib/github_heroku_deployer.rb
|
141
|
+
- lib/github_heroku_deployer/configuration.rb
|
142
|
+
- lib/github_heroku_deployer/exceptions.rb
|
143
|
+
- lib/github_heroku_deployer/git.rb
|
144
|
+
- lib/github_heroku_deployer/heroku.rb
|
145
|
+
- lib/github_heroku_deployer/version.rb
|
146
|
+
- spec/lib/github_heroku_deployer/configuration_spec.rb
|
147
|
+
- spec/lib/github_heroku_deployer/git_spec.rb
|
148
|
+
- spec/lib/github_heroku_deployer/heroku_spec.rb
|
149
|
+
- spec/lib/github_heroku_deployer_spec.rb
|
150
|
+
- spec/spec_helper.rb
|
151
|
+
homepage: ''
|
152
|
+
licenses: []
|
153
|
+
post_install_message:
|
154
|
+
rdoc_options: []
|
155
|
+
require_paths:
|
156
|
+
- lib
|
157
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
158
|
+
none: false
|
159
|
+
requirements:
|
160
|
+
- - ! '>='
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '0'
|
163
|
+
segments:
|
164
|
+
- 0
|
165
|
+
hash: -3045620689426831025
|
166
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
|
+
none: false
|
168
|
+
requirements:
|
169
|
+
- - ! '>='
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: '0'
|
172
|
+
segments:
|
173
|
+
- 0
|
174
|
+
hash: -3045620689426831025
|
175
|
+
requirements: []
|
176
|
+
rubyforge_project:
|
177
|
+
rubygems_version: 1.8.24
|
178
|
+
signing_key:
|
179
|
+
specification_version: 3
|
180
|
+
summary: Deploys Github repos to Heroku
|
181
|
+
test_files:
|
182
|
+
- spec/lib/github_heroku_deployer/configuration_spec.rb
|
183
|
+
- spec/lib/github_heroku_deployer/git_spec.rb
|
184
|
+
- spec/lib/github_heroku_deployer/heroku_spec.rb
|
185
|
+
- spec/lib/github_heroku_deployer_spec.rb
|
186
|
+
- spec/spec_helper.rb
|