github_bitbucket_deployer 0.4.2
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 +19 -0
- data/.travis.yml +10 -0
- data/Gemfile +4 -0
- data/Guardfile +5 -0
- data/LICENSE +22 -0
- data/README.md +133 -0
- data/Rakefile +2 -0
- data/github_bitbucket_deployer.gemspec +25 -0
- data/lib/github_bitbucket_deployer.rb +49 -0
- data/lib/github_bitbucket_deployer/configuration.rb +54 -0
- data/lib/github_bitbucket_deployer/exceptions.rb +4 -0
- data/lib/github_bitbucket_deployer/git.rb +103 -0
- data/lib/github_bitbucket_deployer/version.rb +3 -0
- data/spec/lib/github_bitbucket_deployer/configuration_spec.rb +42 -0
- data/spec/lib/github_bitbucket_deployer/git_spec.rb +5 -0
- data/spec/lib/github_bitbucket_deployer_spec.rb +65 -0
- data/spec/spec_helper.rb +14 -0
- metadata +150 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4820cbe9e8b032c3db7d59d2be77d80539790037
|
4
|
+
data.tar.gz: ac6b647de50319ee45de35979adc9654b3db9f15
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bc6b5b1b659986d83c491d4d7f1bc903d8969c68126db2ae1bad6713d2e836dd96ac77525356cf31bf28269dc88a896f90368fa9721dafd573b56819ee235cea
|
7
|
+
data.tar.gz: 39dd999a8fa195a7a6ff7094db494e3757f3d27b54c2f8755ccdd358463641a79a2ac89f82e84e47b90879e8704d9efbfc32a427302b90542be177d2dd6a12ca
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 1.9.3
|
4
|
+
script: bundle exec rspec
|
5
|
+
notifications:
|
6
|
+
campfire:
|
7
|
+
rooms:
|
8
|
+
secure: UwsCEilVpBakyB+/A84lOS0Gp7KsNEZOGOXdWuS4M0L2BtmHYEYzO5DM3KrQuBmeCPoBQKfZRGGmAAXoHIinD+ziRczfknzL8lesAFcEVLs9ZMwtTdkk3FyCyOWcNu+Q6Iw5s9bz8Jpuz9u2iIC1knyAePhWSH76zg9R0DZrYmI=
|
9
|
+
on_success: change
|
10
|
+
on_failure: always
|
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,133 @@
|
|
1
|
+
# Github Bitbucket Deployer
|
2
|
+
|
3
|
+
[](https://travis-ci.org/G5/github_bitbucket_deployer)
|
4
|
+
[](https://codeclimate.com/github/G5/github_bitbucket_deployer)
|
5
|
+
|
6
|
+
Ruby gem to deploy public and private Github repos to Bitbucket
|
7
|
+
|
8
|
+
|
9
|
+
## Current Version
|
10
|
+
|
11
|
+
0.3.1
|
12
|
+
|
13
|
+
|
14
|
+
## Requirements
|
15
|
+
|
16
|
+
* ["git", "~> 1.2.5"](http://rubygems.org/gems/git)
|
17
|
+
* ["git-ssh-wrapper", "~> 0.1.0"](http://rubygems.org/gems/git-ssh-wrapper)
|
18
|
+
|
19
|
+
|
20
|
+
## Installation
|
21
|
+
|
22
|
+
### Gemfile
|
23
|
+
|
24
|
+
Add this line to your application's Gemfile:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
gem 'github_bitbucket_deployer'
|
28
|
+
```
|
29
|
+
|
30
|
+
### Manual
|
31
|
+
|
32
|
+
Or install it yourself:
|
33
|
+
|
34
|
+
```bash
|
35
|
+
gem install github_bitbucket_deployer
|
36
|
+
```
|
37
|
+
|
38
|
+
|
39
|
+
## Usage
|
40
|
+
|
41
|
+
Set defaults in an initializer, defaults are shown:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
GithubBitbucketDeployer.configure do |config|
|
45
|
+
config.id_rsa = ENV["ID_RSA"]
|
46
|
+
config.logger = Logger.new(STDOUT)
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
Export you environment variables wherever you do that:
|
51
|
+
|
52
|
+
```bash
|
53
|
+
export ID_RSA=id_rsa
|
54
|
+
```
|
55
|
+
|
56
|
+
Create Bitbucket App:
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
GithubBitbucketDeployer.create
|
60
|
+
```
|
61
|
+
|
62
|
+
Deploy:
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
GithubBitbucketDeployer.deploy
|
66
|
+
```
|
67
|
+
|
68
|
+
Override defaults:
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
GithubBitbucketDeployer.deploy(github_repo: github_repo)
|
72
|
+
```
|
73
|
+
|
74
|
+
Manipulate Repo:
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
GithubBitbucketDeployer.deploy(github_repo: github_repo) { |repo| repo.add "/path/to/file" }
|
78
|
+
```
|
79
|
+
|
80
|
+
|
81
|
+
## Authors
|
82
|
+
|
83
|
+
* Jessica Lynn Suttles / [@jlsuttles](https://github.com/jlsuttles)
|
84
|
+
* Bookis Smuin / [@bookis](https://github.com/bookis)
|
85
|
+
* Michael Mitchell / [@variousred](https://github.com/variousred)
|
86
|
+
|
87
|
+
|
88
|
+
## Contributing
|
89
|
+
|
90
|
+
1. Fork it
|
91
|
+
2. Get it running
|
92
|
+
3. Create your feature branch (`git checkout -b my-new-feature`)
|
93
|
+
4. Write your code and **specs**
|
94
|
+
5. Commit your changes (`git commit -am 'Add some feature'`)
|
95
|
+
6. Push to the branch (`git push origin my-new-feature`)
|
96
|
+
7. Create new Pull Request
|
97
|
+
|
98
|
+
If you find bugs, have feature requests or questions, please
|
99
|
+
[file an issue](https://github.com/G5/github_bitbucket_deployer/issues).
|
100
|
+
|
101
|
+
|
102
|
+
## Specs
|
103
|
+
|
104
|
+
Export environment variables
|
105
|
+
```bash
|
106
|
+
export ID_RSA=id_rsa
|
107
|
+
```
|
108
|
+
|
109
|
+
|
110
|
+
## License
|
111
|
+
|
112
|
+
Copyright (c) 2012 G5
|
113
|
+
|
114
|
+
MIT License
|
115
|
+
|
116
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
117
|
+
a copy of this software and associated documentation files (the
|
118
|
+
"Software"), to deal in the Software without restriction, including
|
119
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
120
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
121
|
+
permit persons to whom the Software is furnished to do so, subject to
|
122
|
+
the following conditions:
|
123
|
+
|
124
|
+
The above copyright notice and this permission notice shall be
|
125
|
+
included in all copies or substantial portions of the Software.
|
126
|
+
|
127
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
128
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
129
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
130
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
131
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
132
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
133
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/github_bitbucket_deployer/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = "github_bitbucket_deployer"
|
6
|
+
gem.version = GithubBitbucketDeployer::VERSION
|
7
|
+
gem.authors = ["Jessica Lynn Suttles", "Michael Mitchell"]
|
8
|
+
gem.email = ["jlsuttles@gmail.com", "michaelmitchell@gmail.com"]
|
9
|
+
gem.description = %q{Deploys Github repos to bitbucket}
|
10
|
+
gem.summary = %q{Deploys public and private Github repos to bitbucket}
|
11
|
+
gem.homepage = "https://github.com/G5/github_bitbucket_deployer"
|
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_dependency "git", "~> 1.2.5"
|
19
|
+
gem.add_dependency "git-ssh-wrapper", "~> 0.1.0"
|
20
|
+
|
21
|
+
gem.add_development_dependency "simplecov", "~> 0.7.1"
|
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
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require "logger"
|
2
|
+
require "github_bitbucket_deployer/exceptions"
|
3
|
+
require "github_bitbucket_deployer/configuration"
|
4
|
+
require "github_bitbucket_deployer/git"
|
5
|
+
require "github_bitbucket_deployer/version"
|
6
|
+
|
7
|
+
module GithubBitbucketDeployer
|
8
|
+
class << self
|
9
|
+
# A GithubBitbucketDeployer configuration object. Must act like a hash and
|
10
|
+
# return sensible values for all GithubBitbucketDeployer configuration options.
|
11
|
+
#
|
12
|
+
# @see GithubBitbucketDeployer::Configuration.
|
13
|
+
attr_writer :configuration
|
14
|
+
|
15
|
+
# The configuration object.
|
16
|
+
#
|
17
|
+
# @see GithubBitbucketDeployer.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
|
+
# GithubBitbucketDeployer.configure do |config|
|
26
|
+
# config.id_rsa = ENV["ID_RSA"]
|
27
|
+
# config.logger = Logger.new(STDOUT)
|
28
|
+
# end
|
29
|
+
def configure
|
30
|
+
yield(configuration)
|
31
|
+
end
|
32
|
+
|
33
|
+
def deploy(options={}, &block)
|
34
|
+
options = configuration.merge(options)
|
35
|
+
validate_options(options)
|
36
|
+
git_push_app_to_bitbucket(options, &block)
|
37
|
+
true
|
38
|
+
end
|
39
|
+
|
40
|
+
def validate_options(options)
|
41
|
+
configuration.validate_presence(options)
|
42
|
+
end
|
43
|
+
|
44
|
+
def git_push_app_to_bitbucket(options, &block)
|
45
|
+
repo = Git.new(options)
|
46
|
+
repo.push_app_to_bitbucket(&block)
|
47
|
+
end
|
48
|
+
end # class << self
|
49
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module GithubBitbucketDeployer
|
2
|
+
class Configuration
|
3
|
+
OPTIONS = {
|
4
|
+
id_rsa: ENV["ID_RSA"],
|
5
|
+
logger: ::Logger.new(STDOUT),
|
6
|
+
repo_dir: ENV["REPO_DIR"]
|
7
|
+
}
|
8
|
+
|
9
|
+
# Defines accessors for all OPTIONS
|
10
|
+
OPTIONS.each_pair do |key, value|
|
11
|
+
attr_accessor key
|
12
|
+
end
|
13
|
+
|
14
|
+
# Initializes defaults to be the environment varibales of the same names
|
15
|
+
def initialize
|
16
|
+
OPTIONS.each_pair do |key, value|
|
17
|
+
self.send("#{key}=", value)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Allows config options to be read like a hash
|
22
|
+
#
|
23
|
+
# @param [Symbol] option Key for a given attribute
|
24
|
+
def [](option)
|
25
|
+
send(option)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Returns a hash of all configurable options
|
29
|
+
def to_hash
|
30
|
+
OPTIONS.inject({}) do |hash, option|
|
31
|
+
key = option.first
|
32
|
+
hash[key] = self.send(key)
|
33
|
+
hash
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Returns a hash of all configurable options merged with +hash+
|
38
|
+
#
|
39
|
+
# @param [Hash] hash A set of configuration options that will take
|
40
|
+
# precedence over the defaults
|
41
|
+
def merge(hash)
|
42
|
+
to_hash.merge(hash)
|
43
|
+
end
|
44
|
+
|
45
|
+
def validate_presence(options)
|
46
|
+
OPTIONS.each_pair do |key, value|
|
47
|
+
if options[key].nil?
|
48
|
+
raise GithubBitbucketDeployer::ConfigurationException, "#{key} is missing"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require "git"
|
2
|
+
require "git-ssh-wrapper"
|
3
|
+
|
4
|
+
module GithubBitbucketDeployer
|
5
|
+
class Git
|
6
|
+
|
7
|
+
def initialize(options)
|
8
|
+
@bitbucket_repo_url = options[:bitbucket_repo_url]
|
9
|
+
@git_repo_name = options[:git_repo_name]
|
10
|
+
@id_rsa = options[:id_rsa]
|
11
|
+
@logger = options[:logger]
|
12
|
+
@repo_dir = options[:repo_dir]
|
13
|
+
end
|
14
|
+
|
15
|
+
def push_app_to_bitbucket(remote="bitbucket", branch="master", &block)
|
16
|
+
@logger.info "push_app_to_bitbucket"
|
17
|
+
wrapper = ssh_wrapper
|
18
|
+
run "cd #{repo.dir}; git remote rm #{remote}" if repo.remote(remote).url
|
19
|
+
repo.add_remote(remote, @bitbucket_repo_url)
|
20
|
+
yield(repo) if block_given?
|
21
|
+
@logger.info "deploying #{repo.dir} to #{repo.remote(remote).url} from branch #{branch}"
|
22
|
+
run "cd #{repo.dir}; env #{wrapper.git_ssh} git push -f #{remote} #{branch}"
|
23
|
+
ensure
|
24
|
+
wrapper.unlink
|
25
|
+
end
|
26
|
+
|
27
|
+
def repo
|
28
|
+
@repo ||= setup_repo
|
29
|
+
end
|
30
|
+
|
31
|
+
def setup_repo
|
32
|
+
@logger.info "setup_repo"
|
33
|
+
clone_or_pull
|
34
|
+
open
|
35
|
+
end
|
36
|
+
|
37
|
+
def folder
|
38
|
+
@folder ||= setup_folder
|
39
|
+
end
|
40
|
+
|
41
|
+
def setup_folder
|
42
|
+
@logger.info "setup_folder"
|
43
|
+
folder = File.join(@repo_dir, Zlib.crc32(@git_repo_name).to_s)
|
44
|
+
FileUtils.mkdir_p(folder).first
|
45
|
+
end
|
46
|
+
|
47
|
+
def clone_or_pull
|
48
|
+
@logger.info "clone_or_pull"
|
49
|
+
exists_locally? ? pull : clone
|
50
|
+
end
|
51
|
+
|
52
|
+
def exists_locally?
|
53
|
+
File.exists?(File.join(folder, ".git", "config"))
|
54
|
+
end
|
55
|
+
|
56
|
+
def clone
|
57
|
+
@logger.info "git clone"
|
58
|
+
wrapper = ssh_wrapper
|
59
|
+
@logger.info "cloning #{@bitbucket_repo_url} to #{folder}"
|
60
|
+
run "unset GIT_WORK_TREE; env #{wrapper.git_ssh} git clone #{@bitbucket_repo_url} #{folder}"
|
61
|
+
ensure
|
62
|
+
wrapper.unlink
|
63
|
+
end
|
64
|
+
|
65
|
+
def pull
|
66
|
+
@logger.info "git pull"
|
67
|
+
wrapper = ssh_wrapper
|
68
|
+
dir = Dir.pwd # need to cd back to here
|
69
|
+
@logger.info "pulling from #{folder}"
|
70
|
+
run "cd #{folder}; env #{wrapper.git_ssh} git pull; cd #{dir}"
|
71
|
+
ensure
|
72
|
+
wrapper.unlink
|
73
|
+
end
|
74
|
+
|
75
|
+
def open
|
76
|
+
@logger.info "git open"
|
77
|
+
::Git.open(folder)
|
78
|
+
end
|
79
|
+
|
80
|
+
def ssh_wrapper
|
81
|
+
GitSSHWrapper.new(private_key_path: id_rsa_path)
|
82
|
+
end
|
83
|
+
|
84
|
+
def id_rsa_path
|
85
|
+
file = Tempfile.new("id_rsa")
|
86
|
+
file.write(@id_rsa)
|
87
|
+
file.rewind
|
88
|
+
file.path
|
89
|
+
end
|
90
|
+
|
91
|
+
def run(command)
|
92
|
+
@logger.info "git run command: #{command}"
|
93
|
+
result = system("#{command} 2>&1")
|
94
|
+
sleep 20
|
95
|
+
if result
|
96
|
+
@logger.info $?.to_s
|
97
|
+
else
|
98
|
+
raise GithubBitbucketDeployer::CommandException, $?.to_s
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'github_bitbucket_deployer'
|
3
|
+
require 'github_bitbucket_deployer/configuration'
|
4
|
+
|
5
|
+
describe GithubBitbucketDeployer::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 :id_rsa, ENV["ID_RSA"]
|
12
|
+
end
|
13
|
+
|
14
|
+
it "allows values to be overwritten" do
|
15
|
+
assert_config_overridable :id_rsa
|
16
|
+
end
|
17
|
+
|
18
|
+
it "acts like a hash" do
|
19
|
+
config = GithubBitbucketDeployer::Configuration.new
|
20
|
+
hash = config.to_hash
|
21
|
+
GithubBitbucketDeployer::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 = GithubBitbucketDeployer::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 ||= GithubBitbucketDeployer::Configuration.new
|
34
|
+
config.send(option).should eq(default_value)
|
35
|
+
end
|
36
|
+
|
37
|
+
def assert_config_overridable(option, value = 'a value')
|
38
|
+
config = GithubBitbucketDeployer::Configuration.new
|
39
|
+
config.send(:"#{option}=", value)
|
40
|
+
config.send(option).should eq(value)
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'github_bitbucket_deployer'
|
3
|
+
|
4
|
+
describe GithubBitbucketDeployer 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
|
+
GithubBitbucketDeployer.configuration.should(
|
12
|
+
be_a_kind_of GithubBitbucketDeployer::Configuration)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "give a new instance if non defined" do
|
16
|
+
GithubBitbucketDeployer.configuration = nil
|
17
|
+
GithubBitbucketDeployer.configuration.should(
|
18
|
+
be_a_kind_of GithubBitbucketDeployer::Configuration)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "::configure" do
|
23
|
+
it "should yield the configuration object" do
|
24
|
+
GithubBitbucketDeployer.configure do |config|
|
25
|
+
config.should equal(GithubBitbucketDeployer.configuration)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "::deploy" do
|
31
|
+
|
32
|
+
context "when unconfigured" do
|
33
|
+
before :each do
|
34
|
+
GithubBitbucketDeployer.configure do |config|
|
35
|
+
config.id_rsa = nil
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
it "requires github_repo to be set" do
|
40
|
+
lambda { GithubBitbucketDeployer.deploy }.should(
|
41
|
+
raise_error ::GithubBitbucketDeployer::ConfigurationException)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# TODO: how can I test these better?
|
46
|
+
context "when configured" do
|
47
|
+
before :each do
|
48
|
+
@deployer = mock("github_bitbucket_deployer")
|
49
|
+
@deployer.stub!(:deploy).and_return(true)
|
50
|
+
end
|
51
|
+
|
52
|
+
it "overrides defaults" do
|
53
|
+
GithubBitbucketDeployer.configure do |config|
|
54
|
+
config.id_rsa = ""
|
55
|
+
end
|
56
|
+
|
57
|
+
override = ENV["ID_RSA"]
|
58
|
+
override.should_not equal GithubBitbucketDeployer.configuration[:id_rsa]
|
59
|
+
@deployer.deploy(id_rsa: override).should be true
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: github_bitbucket_deployer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jessica Lynn Suttles
|
8
|
+
- Michael Mitchell
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-09-23 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: git
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 1.2.5
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 1.2.5
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: git-ssh-wrapper
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.1.0
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 0.1.0
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: simplecov
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 0.7.1
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.7.1
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rspec
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 2.11.0
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 2.11.0
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: guard-rspec
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 2.1.0
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 2.1.0
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rb-fsevent
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 0.9.2
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 0.9.2
|
98
|
+
description: Deploys Github repos to bitbucket
|
99
|
+
email:
|
100
|
+
- jlsuttles@gmail.com
|
101
|
+
- michaelmitchell@gmail.com
|
102
|
+
executables: []
|
103
|
+
extensions: []
|
104
|
+
extra_rdoc_files: []
|
105
|
+
files:
|
106
|
+
- ".gitignore"
|
107
|
+
- ".travis.yml"
|
108
|
+
- Gemfile
|
109
|
+
- Guardfile
|
110
|
+
- LICENSE
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- github_bitbucket_deployer.gemspec
|
114
|
+
- lib/github_bitbucket_deployer.rb
|
115
|
+
- lib/github_bitbucket_deployer/configuration.rb
|
116
|
+
- lib/github_bitbucket_deployer/exceptions.rb
|
117
|
+
- lib/github_bitbucket_deployer/git.rb
|
118
|
+
- lib/github_bitbucket_deployer/version.rb
|
119
|
+
- spec/lib/github_bitbucket_deployer/configuration_spec.rb
|
120
|
+
- spec/lib/github_bitbucket_deployer/git_spec.rb
|
121
|
+
- spec/lib/github_bitbucket_deployer_spec.rb
|
122
|
+
- spec/spec_helper.rb
|
123
|
+
homepage: https://github.com/G5/github_bitbucket_deployer
|
124
|
+
licenses: []
|
125
|
+
metadata: {}
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
requirements: []
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 2.4.7
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: Deploys public and private Github repos to bitbucket
|
146
|
+
test_files:
|
147
|
+
- spec/lib/github_bitbucket_deployer/configuration_spec.rb
|
148
|
+
- spec/lib/github_bitbucket_deployer/git_spec.rb
|
149
|
+
- spec/lib/github_bitbucket_deployer_spec.rb
|
150
|
+
- spec/spec_helper.rb
|