travis_github_deployer 0.2.3 → 0.2.4
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/README.md +4 -4
- data/lib/travis_github_deployer/travis_github_deployer.rb +6 -1
- data/lib/travis_github_deployer/version.rb +1 -1
- data/spec/travis_github_deployer_spec.rb +14 -10
- metadata +44 -46
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a8f20a4c4ce37d11b2ef8b7424c5beb0640f9b10
|
4
|
+
data.tar.gz: 9edd37bab8fa9a5ac853a806c18f6794b4927329
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4f74213d9dcda4b693b10abaa637a272e90566fc23616d91b383c777151062237d69a23b343535192862613d48673339677296296ab771025ff9ff9fd1b23aee
|
7
|
+
data.tar.gz: cc29b250a8817db828b3686e63d794b34e1b0907ce32c2e0fb00e3da463fa7a9f44ce8a6df2f390ab4c16316dcfe806c63544a1c5fcd8701fa82e0c60f77059a
|
data/README.md
CHANGED
@@ -23,7 +23,7 @@ $ cd <name of your repository>
|
|
23
23
|
$ curl -u <your username> -d '{"scopes":["public_repo"],"note":"Travis CI deployer"}' \
|
24
24
|
https://api.github.com/authorizations
|
25
25
|
$ travis encrypt 'GIT_NAME="<your name>" GIT_EMAIL=<your email> \
|
26
|
-
|
26
|
+
GIT_TOKEN=<your token>' --add
|
27
27
|
```
|
28
28
|
|
29
29
|
### How does this work?
|
@@ -39,14 +39,14 @@ This will get an authentication token. With it, Travis CI can commit under your
|
|
39
39
|
|
40
40
|
```bash
|
41
41
|
$ travis encrypt 'GIT_NAME="<your name>" GIT_EMAIL=<your email> \
|
42
|
-
|
42
|
+
GIT_TOKEN=<your token>' --add
|
43
43
|
```
|
44
44
|
|
45
|
-
This will take the
|
45
|
+
This will take the token and add it to a 'secure' section in your travis.yml. The Travis Github Deployer will grab it from that section and use it to push up the changes to your repository
|
46
46
|
|
47
47
|
## Setting up the Travis Github Deployer
|
48
48
|
|
49
|
-
The Travis Github Deployer uses one config file: ".travis_github_deployer"
|
49
|
+
The Travis Github Deployer uses one config file: ".travis_github_deployer.yml"
|
50
50
|
|
51
51
|
A typical file looks like this:
|
52
52
|
|
@@ -45,6 +45,11 @@ class TravisGithubDeployer
|
|
45
45
|
return
|
46
46
|
end
|
47
47
|
|
48
|
+
if (ENV['GIT_NAME'].nil?)
|
49
|
+
puts "In fork and won't be deploying"
|
50
|
+
return
|
51
|
+
end
|
52
|
+
|
48
53
|
load_configuration
|
49
54
|
clone_destination_repository
|
50
55
|
copy_files_in_destination_repository
|
@@ -124,7 +129,7 @@ class TravisGithubDeployer
|
|
124
129
|
source = Pathname.new(source_location)
|
125
130
|
destination = Pathname.new(destination_repository_dir)
|
126
131
|
destination += destination_location
|
127
|
-
FileUtils.
|
132
|
+
FileUtils.cp_r(source, destination)
|
128
133
|
}
|
129
134
|
|
130
135
|
end
|
@@ -6,13 +6,15 @@ describe "travis github deployer" do
|
|
6
6
|
subject { TravisGithubDeployer.new}
|
7
7
|
|
8
8
|
before(:each) do
|
9
|
-
|
9
|
+
ENV::clear
|
10
|
+
@git = double
|
10
11
|
GitCommandLine.should_receive(:new).and_return(@git)
|
11
12
|
subject
|
12
13
|
end
|
13
14
|
|
14
15
|
it "can deploy to an destination repository" do
|
15
16
|
ENV['TRAVIS_PULL_REQUEST']="false"
|
17
|
+
ENV['GIT_NAME']="Foo"
|
16
18
|
subject.should_receive(:load_configuration)
|
17
19
|
subject.should_receive(:clone_destination_repository)
|
18
20
|
subject.should_receive(:change_current_directory_to_cloned_repository)
|
@@ -28,6 +30,13 @@ describe "travis github deployer" do
|
|
28
30
|
subject.should_receive(:puts).with("In pull request and won't be deploying")
|
29
31
|
subject.deploy
|
30
32
|
end
|
33
|
+
|
34
|
+
it "will not deploy when run in a fork, e.g. when GIT_NAME isn't set" do
|
35
|
+
ENV['TRAVIS_PULL_REQUEST']="false"
|
36
|
+
subject.should_not_receive(:load_configuration)
|
37
|
+
subject.should_receive(:puts).with("In fork and won't be deploying")
|
38
|
+
subject.deploy
|
39
|
+
end
|
31
40
|
|
32
41
|
context "Prepare repository for being able to commit" do
|
33
42
|
|
@@ -58,11 +67,6 @@ describe "travis github deployer" do
|
|
58
67
|
subject.set_username_based_on_environment_variable
|
59
68
|
end
|
60
69
|
|
61
|
-
it "Should give an error message when the GIT_NAME isn't set" do
|
62
|
-
ENV['GIT_NAME'] = nil
|
63
|
-
expect {subject.set_username_based_on_environment_variable}.to raise_error(StandardError, "The GIT_NAME environment variable wasn't set.")
|
64
|
-
end
|
65
|
-
|
66
70
|
it "Should be able to set the password based on an environment variable" do
|
67
71
|
ENV['GIT_EMAIL'] = "basv@bestcompanythatexists.com"
|
68
72
|
@git.should_receive(:config_email).with("basv@bestcompanythatexists.com")
|
@@ -70,7 +74,7 @@ describe "travis github deployer" do
|
|
70
74
|
end
|
71
75
|
|
72
76
|
it "Should be able to write the github token based on an environment variable" do
|
73
|
-
credential_file =
|
77
|
+
credential_file = double
|
74
78
|
ENV['GIT_TOKEN'] = "Token"
|
75
79
|
|
76
80
|
@git.should_receive(:config_credential_helper_store_file).with(".git/travis_deploy_credentials")
|
@@ -85,14 +89,14 @@ describe "travis github deployer" do
|
|
85
89
|
|
86
90
|
it "should be able to copy a file from the root of the source repository to the root of the destination reportistory" do
|
87
91
|
subject.should_receive(:files_to_deploy).and_return( { "sourcefile" => ""})
|
88
|
-
FileUtils.should_receive(:
|
92
|
+
FileUtils.should_receive(:cp_r).with(Pathname.new("sourcefile"), Pathname.new("travis_github_deployer_repository"))
|
89
93
|
subject.copy_files_in_destination_repository
|
90
94
|
end
|
91
95
|
|
92
96
|
it "Should be able to copy multiple files" do
|
93
97
|
subject.should_receive(:files_to_deploy).and_return({ "dir/onefile" => "destonefile", "twofile" => "dir/desttwofile"})
|
94
|
-
FileUtils.should_receive(:
|
95
|
-
FileUtils.should_receive(:
|
98
|
+
FileUtils.should_receive(:cp_r).with(Pathname.new("dir/onefile"), Pathname.new("travis_github_deployer_repository/destonefile"))
|
99
|
+
FileUtils.should_receive(:cp_r).with(Pathname.new("twofile"), Pathname.new("travis_github_deployer_repository/dir/desttwofile"))
|
96
100
|
subject.copy_files_in_destination_repository
|
97
101
|
end
|
98
102
|
end
|
metadata
CHANGED
@@ -1,48 +1,51 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: travis_github_deployer
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.2.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.4
|
6
5
|
platform: ruby
|
7
|
-
authors:
|
6
|
+
authors:
|
8
7
|
- Bas Vodde
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2014-09-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
16
14
|
name: rake
|
17
|
-
|
18
|
-
|
19
|
-
none: false
|
20
|
-
requirements:
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
21
17
|
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version:
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
24
20
|
type: :runtime
|
25
|
-
version_requirements: *id001
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: rspec
|
28
21
|
prerelease: false
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
32
31
|
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
32
|
+
- !ruby/object:Gem::Version
|
34
33
|
version: 2.0.0
|
35
34
|
type: :development
|
36
|
-
|
37
|
-
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.0.0
|
41
|
+
description: A Script and a library that help in deploying files from Travis CI builds
|
42
|
+
to a Github Repository
|
38
43
|
email: basv@odd-e.com
|
39
|
-
executables:
|
44
|
+
executables:
|
40
45
|
- travis_github_deployer
|
41
46
|
extensions: []
|
42
|
-
|
43
47
|
extra_rdoc_files: []
|
44
|
-
|
45
|
-
files:
|
48
|
+
files:
|
46
49
|
- README.md
|
47
50
|
- Rakefile
|
48
51
|
- bin/travis_github_deployer
|
@@ -54,32 +57,27 @@ files:
|
|
54
57
|
- spec/travis_github_deployer_spec.rb
|
55
58
|
- travis_github_deployer.gemfile
|
56
59
|
homepage: https://github.com/basvodde/travis_github_deployer
|
57
|
-
licenses:
|
60
|
+
licenses:
|
58
61
|
- MIT
|
62
|
+
metadata: {}
|
59
63
|
post_install_message:
|
60
64
|
rdoc_options: []
|
61
|
-
|
62
|
-
require_paths:
|
65
|
+
require_paths:
|
63
66
|
- lib
|
64
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
-
|
66
|
-
requirements:
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
67
69
|
- - ">="
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version:
|
70
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
-
|
72
|
-
requirements:
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
73
74
|
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
76
77
|
requirements: []
|
77
|
-
|
78
78
|
rubyforge_project:
|
79
|
-
rubygems_version:
|
79
|
+
rubygems_version: 2.2.2
|
80
80
|
signing_key:
|
81
|
-
specification_version:
|
81
|
+
specification_version: 4
|
82
82
|
summary: Script to deploy to github from Travis CI
|
83
83
|
test_files: []
|
84
|
-
|
85
|
-
has_rdoc:
|