git-semaphore 0.0.9 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +9 -19
- data/.pryrc +6 -0
- data/.ruby-version +1 -1
- data/CODE_OF_CONDUCT.md +49 -0
- data/LICENSE.txt +17 -18
- data/README.md +166 -40
- data/Rakefile +8 -9
- data/bin/console +14 -0
- data/bin/setup +10 -0
- data/exe/git-semaphore +79 -0
- data/git-semaphore.gemspec +15 -19
- data/lib/git/semaphore/api.rb +133 -0
- data/lib/git/semaphore/api_cache.rb +59 -0
- data/lib/git/semaphore/api_enrich.rb +40 -0
- data/lib/git/semaphore/app.rb +121 -0
- data/lib/{git-semaphore → git/semaphore}/banner.rb +0 -0
- data/lib/{git-semaphore → git/semaphore}/copyright.rb +1 -1
- data/lib/{git-semaphore → git/semaphore}/version.rb +1 -1
- data/lib/git/semaphore.rb +77 -0
- metadata +55 -181
- data/.bundle/config +0 -3
- data/.irbrc +0 -13
- data/bin/git-semaphore +0 -115
- data/features/cassettes/cucumber_tags/api_branch_status.json +0 -20
- data/features/cassettes/cucumber_tags/api_project_branches.json +0 -14
- data/features/cassettes/cucumber_tags/api_projects.json +0 -46
- data/features/cassettes/cucumber_tags/vcr_api_branches.yml +0 -70
- data/features/cassettes/cucumber_tags/vcr_api_projects.yml +0 -102
- data/features/cassettes/cucumber_tags/vcr_api_rebuild_last_revision.yml +0 -55
- data/features/cassettes/cucumber_tags/vcr_api_status.yml +0 -76
- data/features/coming_soon.feature +0 -13
- data/features/env_config.feature +0 -11
- data/features/git_config.feature +0 -11
- data/features/help_and_version.feature +0 -33
- data/features/semaphore_app_api.feature +0 -29
- data/features/semaphore_app_config.feature +0 -37
- data/features/semaphore_auth_token.feature +0 -32
- data/features/semaphore_project_token.feature +0 -32
- data/features/step_definitions/git-semaphore_steps.rb +0 -121
- data/features/step_definitions/patch_methadone_steps.rb +0 -5
- data/features/step_definitions/vcr_semaphore_steps.rb +0 -25
- data/features/support/env.rb +0 -7
- data/features/support/semaphoreapp.rb +0 -2
- data/features/support/vcr.rb +0 -14
- data/features/working_directory.feature +0 -22
- data/lib/git-semaphore/api.rb +0 -60
- data/lib/git-semaphore/app.rb +0 -123
- data/lib/git-semaphore.rb +0 -15
- data/spec_helper.rb +0 -6
- data/vendor/bundle/.gitignore +0 -2
@@ -1,102 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: get
|
5
|
-
uri: https://semaphoreci.com/api/v1/projects?auth_token=Yds3w6o26FLfJTnVK2y9
|
6
|
-
body:
|
7
|
-
encoding: US-ASCII
|
8
|
-
string: ''
|
9
|
-
headers:
|
10
|
-
Accept-Encoding:
|
11
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
-
Accept:
|
13
|
-
- ! '*/*'
|
14
|
-
User-Agent:
|
15
|
-
- Ruby
|
16
|
-
response:
|
17
|
-
status:
|
18
|
-
code: 200
|
19
|
-
message: OK
|
20
|
-
headers:
|
21
|
-
Content-Type:
|
22
|
-
- application/json; charset=utf-8
|
23
|
-
Transfer-Encoding:
|
24
|
-
- chunked
|
25
|
-
Connection:
|
26
|
-
- keep-alive
|
27
|
-
Status:
|
28
|
-
- '200'
|
29
|
-
X-Powered-By:
|
30
|
-
- Phusion Passenger (mod_rails/mod_rack) 3.0.13
|
31
|
-
Strict-Transport-Security:
|
32
|
-
- max-age=31536000
|
33
|
-
X-Ua-Compatible:
|
34
|
-
- IE=Edge,chrome=1
|
35
|
-
Etag:
|
36
|
-
- ! '"e42bf466c06c9118300b3a6408b531b1"'
|
37
|
-
Cache-Control:
|
38
|
-
- max-age=0, private, must-revalidate
|
39
|
-
Set-Cookie:
|
40
|
-
- _base-app_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJTViMjRmMTczNjEyZjdmMzJjNWQ5OWZjNWI0YWIyYmM0BjsAVEkiGXdhcmRlbi51c2VyLnVzZXIua2V5BjsAVFsISSIJVXNlcgY7AEZbBmkCCANJIiIkMmEkMTAkN3VSVzl5MkpUMHVrdVA5TWVncEpYdQY7AFQ%3D--9772b226dbe76a1dfe0118335db573afbe9cacb2;
|
41
|
-
path=/; secure; HttpOnly
|
42
|
-
X-Request-Id:
|
43
|
-
- d458d702d771a4fdfeb6baffe3a5c87c
|
44
|
-
X-Runtime:
|
45
|
-
- '0.651900'
|
46
|
-
Date:
|
47
|
-
- Sat, 20 Oct 2012 09:39:18 GMT
|
48
|
-
X-Rack-Cache:
|
49
|
-
- miss
|
50
|
-
Server:
|
51
|
-
- nginx/1.2.1 + Phusion Passenger 3.0.13 (mod_rails/mod_rack)
|
52
|
-
body:
|
53
|
-
encoding: US-ASCII
|
54
|
-
string: ! '[
|
55
|
-
{
|
56
|
-
"id": 61,
|
57
|
-
"hash_id": "3f1004b8343faabda63d441734526c854380ab89",
|
58
|
-
"name": "testapp-sphinx",
|
59
|
-
"owner": "renderedtext",
|
60
|
-
"created_at": "2012-09-04T11:53:22Z",
|
61
|
-
"updated_at": "2012-09-04T12:01:17Z",
|
62
|
-
"branches": [
|
63
|
-
{
|
64
|
-
"branch_name": "master",
|
65
|
-
"branch_url": "http://10.0.1.76:3000/projects/61/branches/85",
|
66
|
-
"branch_status_url": "http://semaphoreci.com/api/v1/projects/3f1004b8343faabda63d441734526c854380ab89/85/status?auth_token=Yds3w6o26FLfJTnVK2y9",
|
67
|
-
"branch_history_url": "http://semaphoreci.com/api/v1/projects/3f1004b8343faabda63d441734526c854380ab89/85?auth_token=Yds3w6o26FLfJTnVK2y9",
|
68
|
-
"project_name": "testapp-sphinx",
|
69
|
-
"build_url": "http://10.0.1.76:3000/projects/61/branches/85/builds/1",
|
70
|
-
"build_number": 1,
|
71
|
-
"result": "passed",
|
72
|
-
"started_at": "2012-09-04T11:55:07Z",
|
73
|
-
"finished_at": "2012-09-04T12:01:16Z"
|
74
|
-
}
|
75
|
-
]
|
76
|
-
},
|
77
|
-
{
|
78
|
-
"id": 63,
|
79
|
-
"hash_id": "649e584dc507ca4b73e1374d3125ef0b567a949c",
|
80
|
-
"name": "testapp-mongodb",
|
81
|
-
"owner": "renderedtext",
|
82
|
-
"created_at": "2012-09-14T10:53:38Z",
|
83
|
-
"updated_at": "2012-09-14T11:16:51Z",
|
84
|
-
"branches": [
|
85
|
-
{
|
86
|
-
"branch_name": "mongoid3",
|
87
|
-
"branch_url": "http://10.0.1.76:3000/projects/63/branches/89",
|
88
|
-
"branch_status_url": "http://semaphoreci.com/api/v1/projects/3f1004b8343faabda63d441734526c854380ab89/85/status?auth_token=Yds3w6o26FLfJTnVK2y9",
|
89
|
-
"branch_history_url": "http://semaphoreci.com/api/v1/projects/3f1004b8343faabda63d441734526c854380ab89/85?auth_token=Yds3w6o26FLfJTnVK2y9",
|
90
|
-
"project_name": "testapp-mongodb",
|
91
|
-
"build_url": "http://10.0.1.76:3000/projects/63/branches/89/builds/3",
|
92
|
-
"build_number": 3,
|
93
|
-
"result": "passed",
|
94
|
-
"started_at": "2012-09-14T11:11:39Z",
|
95
|
-
"finished_at": "2012-09-14T11:16:51Z"
|
96
|
-
}
|
97
|
-
]
|
98
|
-
}
|
99
|
-
]'
|
100
|
-
http_version:
|
101
|
-
recorded_at: Sat, 20 Oct 2012 09:39:19 GMT
|
102
|
-
recorded_with: VCR 2.2.5
|
@@ -1,55 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://semaphoreci.com/api/v1/projects/649e584dc507ca4b73e1374d3125ef0b567a949c/89/build?auth_token=Yds3w6o26FLfJTnVK2y9
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: auth_token=Yds3w6o26FLfJTnVK2y9
|
9
|
-
headers:
|
10
|
-
Accept-Encoding:
|
11
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
-
Accept:
|
13
|
-
- '*/*'
|
14
|
-
User-Agent:
|
15
|
-
- Ruby
|
16
|
-
response:
|
17
|
-
status:
|
18
|
-
code: 200
|
19
|
-
message: OK
|
20
|
-
headers:
|
21
|
-
Content-Type:
|
22
|
-
- application/json; charset=utf-8
|
23
|
-
Transfer-Encoding:
|
24
|
-
- chunked
|
25
|
-
Connection:
|
26
|
-
- keep-alive
|
27
|
-
Status:
|
28
|
-
- '200'
|
29
|
-
X-Powered-By:
|
30
|
-
- Phusion Passenger (mod_rails/mod_rack) 3.0.14
|
31
|
-
Strict-Transport-Security:
|
32
|
-
- max-age=31536000
|
33
|
-
X-Ua-Compatible:
|
34
|
-
- IE=Edge,chrome=1
|
35
|
-
Cache-Control:
|
36
|
-
- no-cache
|
37
|
-
Set-Cookie:
|
38
|
-
- _semaphoreappdotcom_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFRkkiJTM4NGFhMzNmMzBlMWYwZWNjZGY1YTVmOTZmM2EwZGM5BjsAVA%3D%3D--221d375194d03282702a20d5dd5be5520e5eccca;
|
39
|
-
path=/; secure; HttpOnly
|
40
|
-
X-Request-Id:
|
41
|
-
- 7ca89a2918f9ed99308b0969f52d04b8
|
42
|
-
X-Runtime:
|
43
|
-
- '0.005673'
|
44
|
-
Date:
|
45
|
-
- Thu, 18 Dec 2014 09:38:06 GMT
|
46
|
-
X-Rack-Cache:
|
47
|
-
- invalidate, pass
|
48
|
-
Server:
|
49
|
-
- nginx/1.2.2 + Phusion Passenger 3.0.14 (mod_rails/mod_rack)
|
50
|
-
body:
|
51
|
-
encoding: UTF-8
|
52
|
-
string: ! '{"commits":[{"id":"dummy_commit","url":"https://github.com/company/dummy_project/commit/dummy_commit","author_name":"Dude","author_email":"dude@company.co.uk","message":"Spiky spike","timestamp":"2014-07-23T09:52:55Z"},{"id":"foobar","url":"https://github.com/company/dummy_project/commit/foobar","author_name":"Dude","author_email":"dude@company.co.uk","message":"Merge branch \"master\" into dumy-branch","timestamp":"2014-07-25T15:33:05Z"},{"id":"dummy_commit4","url":"https://github.com/company/dummy_project/commit/dummy_commit4","author_name":"Dude","author_email":"dude@company.co.uk","message":"Move letter-opener to production gem","timestamp":"2014-07-28T07:32:28Z"},{"id":"dummy_commit2","url":"https://github.com/company/dummy_project/commit/dummy_commit2","author_name":"Dude","author_email":"dude@company.co.uk","message":"Merge branch \"master\" into dumy-branch","timestamp":"2014-07-30T07:25:37Z"},{"id":"dummy_commit3","url":"https://github.com/company/dummy_project/commit/dummy_commit3","author_name":"Dude","author_email":"dude@company.co.uk","message":"Merge branch \"master\" into dumy-branch","timestamp":"2014-08-04T10:08:26Z"},{"id":"dummy_commit5","url":"https://github.com/company/dummy_project/commit/dummy_commit5","author_name":"Dude","author_email":"dude@company.co.uk","message":"Merge branch \"master\" into dumy-branch\n\nConflicts:\n\tGemfile","timestamp":"2014-12-18T09:05:53Z"}],"project_name":"dummy_project","branch_name":"dumy-branch","number":4,"result":null,"created_at":"2014-12-18T09:44:11Z","updated_at":"2014-12-18T09:44:11Z","started_at":null,"finished_at":null,"html_url":"https://semaphoreci.com/company/dummy_project/branches/dumy-branch/builds/4","build_log_url":"https://semaphoreci.com/api/v1/projects/dummy_project/313010/builds/4/log?auth_token=Yds3w6o26FLfJTnVK2y9","build_info_url":"https://semaphoreci.com/api/v1/projects/dummy_project/313010/builds/4?auth_token=Yds3w6o26FLfJTnVK2y9"}'
|
53
|
-
http_version:
|
54
|
-
recorded_at: Thu, 18 Dec 2014 09:38:06 GMT
|
55
|
-
recorded_with: VCR 2.9.3
|
@@ -1,76 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: get
|
5
|
-
uri: https://semaphoreci.com/api/v1/projects/649e584dc507ca4b73e1374d3125ef0b567a949c/89/status?auth_token=Yds3w6o26FLfJTnVK2y9
|
6
|
-
body:
|
7
|
-
encoding: US-ASCII
|
8
|
-
string: ''
|
9
|
-
headers:
|
10
|
-
Accept-Encoding:
|
11
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
-
Accept:
|
13
|
-
- ! '*/*'
|
14
|
-
User-Agent:
|
15
|
-
- Ruby
|
16
|
-
response:
|
17
|
-
status:
|
18
|
-
code: 200
|
19
|
-
message: OK
|
20
|
-
headers:
|
21
|
-
Content-Type:
|
22
|
-
- application/json; charset=utf-8
|
23
|
-
Transfer-Encoding:
|
24
|
-
- chunked
|
25
|
-
Connection:
|
26
|
-
- keep-alive
|
27
|
-
Status:
|
28
|
-
- '200'
|
29
|
-
X-Powered-By:
|
30
|
-
- Phusion Passenger (mod_rails/mod_rack) 3.0.13
|
31
|
-
Strict-Transport-Security:
|
32
|
-
- max-age=31536000
|
33
|
-
X-Ua-Compatible:
|
34
|
-
- IE=Edge,chrome=1
|
35
|
-
Etag:
|
36
|
-
- ! '"c1bdb2043e1b1523c34cdeb47860d6c2"'
|
37
|
-
Cache-Control:
|
38
|
-
- max-age=0, private, must-revalidate
|
39
|
-
Set-Cookie:
|
40
|
-
- _base-app_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJTY1Yzk0MzBhMzBhMzMxZGViMmQ2YjM2ZDEzMmNjYTUwBjsAVEkiGXdhcmRlbi51c2VyLnVzZXIua2V5BjsAVFsISSIJVXNlcgY7AEZbBmkCCANJIiIkMmEkMTAkN3VSVzl5MkpUMHVrdVA5TWVncEpYdQY7AFQ%3D--e5c2a33818fd15d965c8a7cbbb092d7c602516f5;
|
41
|
-
path=/; secure; HttpOnly
|
42
|
-
X-Request-Id:
|
43
|
-
- 45e070788bb4c7c80c85dea3a323bb2d
|
44
|
-
X-Runtime:
|
45
|
-
- '0.142061'
|
46
|
-
Date:
|
47
|
-
- Sat, 20 Oct 2012 12:15:21 GMT
|
48
|
-
X-Rack-Cache:
|
49
|
-
- miss
|
50
|
-
Server:
|
51
|
-
- nginx/1.2.1 + Phusion Passenger 3.0.13 (mod_rails/mod_rack)
|
52
|
-
body:
|
53
|
-
encoding: US-ASCII
|
54
|
-
string: ! '{
|
55
|
-
"branch_name": "gem_updates",
|
56
|
-
"branch_url": "https://semaphoreci.com/projects/44/branches/50",
|
57
|
-
"branch_status_url": "http://semaphoreci.com/api/v1/projects/649e584dc507ca4b73e1374d3125ef0b567a949c/89/status?auth_token=Yds3w6o26FLfJTnVK2y9",
|
58
|
-
"branch_history_url": "http://semaphoreci.com/api/v1/projects/649e584dc507ca4b73e1374d3125ef0b567a949c/89?auth_token=Yds3w6o26FLfJTnVK2y9",
|
59
|
-
"project_name": "base-app",
|
60
|
-
"build_url": "https://semaphoreci.com/projects/44/branches/50/builds/15",
|
61
|
-
"build_number": 15,
|
62
|
-
"result": "passed",
|
63
|
-
"started_at": "2012-07-09T15:23:53Z",
|
64
|
-
"finished_at": "2012-07-09T15:30:16Z",
|
65
|
-
"commit": {
|
66
|
-
"id": "dc395381e650f3bac18457909880829fc20e34ba",
|
67
|
-
"url": "https://github.com/renderedtext/base-app/commit/dc395381e650f3bac18457909880829fc20e34ba",
|
68
|
-
"author_name": "Vladimir Saric",
|
69
|
-
"author_email": "vladimir@renderedtext.com",
|
70
|
-
"message": "Update ''shoulda'' gem.",
|
71
|
-
"timestamp": "2012-07-04T18:14:08Z"
|
72
|
-
}
|
73
|
-
}'
|
74
|
-
http_version:
|
75
|
-
recorded_at: Sat, 20 Oct 2012 12:15:25 GMT
|
76
|
-
recorded_with: VCR 2.2.5
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Feature: Move Along, Nothing To See Here
|
2
|
-
|
3
|
-
Scenario: run the main script in a directory that is not a git working dir
|
4
|
-
|
5
|
-
When I run `git-semaphore`
|
6
|
-
Then the exit status should be 255
|
7
|
-
And the output should match /Error: "[^\042]*" is not a git working directory\.\.\. exiting!/
|
8
|
-
|
9
|
-
Scenario: run the main script in a directory that is a git working dir
|
10
|
-
|
11
|
-
When I run `git-semaphore` in a git working dir
|
12
|
-
Then the exit status should be 1
|
13
|
-
And the output should match /Coming soon! \(RuntimeError\)/
|
data/features/env_config.feature
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
Feature: Configuration, Configuration, Configuration
|
2
|
-
|
3
|
-
Scenario: run the main script with tokens set in the environment
|
4
|
-
|
5
|
-
Given a runtime environment with config:
|
6
|
-
| SEMAPHORE_AUTH_TOKEN | foo|
|
7
|
-
| SEMAPHORE_PROJECT_TOKEN | bar|
|
8
|
-
When I run `git-semaphore --env-config` in a git working dir
|
9
|
-
Then the exit status should be 0
|
10
|
-
And the output should match /export SEMAPHORE_AUTH_TOKEN="foo"/
|
11
|
-
And the output should match /export SEMAPHORE_PROJECT_TOKEN="bar"/
|
data/features/git_config.feature
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
Feature: Configuration, Configuration, Configuration
|
2
|
-
|
3
|
-
Scenario: run the main script with tokens set in the git configuration
|
4
|
-
|
5
|
-
Given a git repo in directory "blegga" with config:
|
6
|
-
| semaphore.authtoken | foo |
|
7
|
-
| semaphore.projecttoken | bar |
|
8
|
-
When I run `git-semaphore --git-config` in "blegga" directory
|
9
|
-
Then the exit status should be 0
|
10
|
-
And the output should match /git config --local --replace-all semaphore.authtoken "foo"/
|
11
|
-
And the output should match /git config --local --replace-all semaphore.projecttoken "bar"/
|
@@ -1,33 +0,0 @@
|
|
1
|
-
Feature: Help Me I've Got Versionitis
|
2
|
-
|
3
|
-
Scenario: get help for the main script
|
4
|
-
|
5
|
-
When I get help for "git-semaphore"
|
6
|
-
Then the exit status should be 0
|
7
|
-
And the banner should be present
|
8
|
-
And the banner should include the version
|
9
|
-
And the banner should document that this app takes options
|
10
|
-
And the following trollop options should be documented:
|
11
|
-
| -v, --version |
|
12
|
-
| -h, --help |
|
13
|
-
| -w, --working-dir |
|
14
|
-
| -p, --project-name |
|
15
|
-
| -b, --branch-name |
|
16
|
-
| -x, --check-auth |
|
17
|
-
| -y, --check-project |
|
18
|
-
| -z, --check-branch |
|
19
|
-
| -e, --env-config |
|
20
|
-
| -g, --git-config |
|
21
|
-
| -r, --projects |
|
22
|
-
| -a, --branches |
|
23
|
-
| -s, --status |
|
24
|
-
| -c, --commit-status |
|
25
|
-
| -u, --rebuild-last-revision |
|
26
|
-
|
27
|
-
Scenario: get the version of the main script
|
28
|
-
|
29
|
-
When I get the version of "git-semaphore"
|
30
|
-
Then the exit status should be 0
|
31
|
-
And the output should include the version
|
32
|
-
And the output should include the app name
|
33
|
-
And the output should include a copyright notice
|
@@ -1,29 +0,0 @@
|
|
1
|
-
Feature: Show Me What You've Got
|
2
|
-
|
3
|
-
@vcr_api_projects
|
4
|
-
Scenario: user's projects
|
5
|
-
|
6
|
-
Given I am an authenticated user on semaphoreci.com
|
7
|
-
And get the list of all my projects via their API
|
8
|
-
Then the JSON should be an array
|
9
|
-
|
10
|
-
@vcr_api_branches
|
11
|
-
Scenario: project's branches
|
12
|
-
|
13
|
-
Given I am an authenticated user on semaphoreci.com
|
14
|
-
And get the list of all the branches for one of my projects via their API
|
15
|
-
Then the JSON should be an array
|
16
|
-
|
17
|
-
@vcr_api_status
|
18
|
-
Scenario: branch status
|
19
|
-
|
20
|
-
Given I am an authenticated user on semaphoreci.com
|
21
|
-
And get the build status of one of the branches for one of my projects via their API
|
22
|
-
Then the JSON should be a hash
|
23
|
-
|
24
|
-
@vcr_api_rebuild_last_revision
|
25
|
-
Scenario: Rebuild last revision
|
26
|
-
|
27
|
-
Given I am an authenticated user on semaphoreci.com
|
28
|
-
And request to rebuild the last revision of one of the branches for one of my projects via their API
|
29
|
-
Then the JSON should be a hash
|
@@ -1,37 +0,0 @@
|
|
1
|
-
Feature: Configuration, Configuration, Configuration
|
2
|
-
|
3
|
-
Scenario: create an app instance inside a git repo without config
|
4
|
-
|
5
|
-
Given a git repo in directory "blegga"
|
6
|
-
And the "SEMAPHORE_AUTH_TOKEN" env variable is not set
|
7
|
-
And the "SEMAPHORE_PROJECT_TOKEN" env variable is not set
|
8
|
-
Then the application doesn't have an auth token
|
9
|
-
And the application doesn't have a project token
|
10
|
-
|
11
|
-
Scenario: create an app instance inside a git repo with config
|
12
|
-
|
13
|
-
Given a git repo in directory "blegga" with config:
|
14
|
-
| semaphore.authtoken | foo |
|
15
|
-
| semaphore.projecttoken | bar |
|
16
|
-
Then the application uses "foo" as the auth token
|
17
|
-
And the application uses "bar" as the project token
|
18
|
-
|
19
|
-
Scenario: create an app instance inside a git repo without config
|
20
|
-
|
21
|
-
Given a git repo in directory "blegga"
|
22
|
-
And a runtime environment with config:
|
23
|
-
| SEMAPHORE_AUTH_TOKEN | foofoo |
|
24
|
-
| SEMAPHORE_PROJECT_TOKEN | barbar |
|
25
|
-
Then the application uses "foofoo" as the auth token
|
26
|
-
And the application uses "barbar" as the project token
|
27
|
-
|
28
|
-
Scenario: create an app instance inside a git repo with config
|
29
|
-
|
30
|
-
Given a git repo in directory "blegga" with config:
|
31
|
-
| semaphore.authtoken | foo |
|
32
|
-
| semaphore.projecttoken | bar |
|
33
|
-
And a runtime environment with config:
|
34
|
-
| SEMAPHORE_AUTH_TOKEN | foofoo |
|
35
|
-
| SEMAPHORE_PROJECT_TOKEN | barbar |
|
36
|
-
Then the application uses "foo" as the auth token
|
37
|
-
And the application uses "bar" as the project token
|
@@ -1,32 +0,0 @@
|
|
1
|
-
Feature: How to Overcome Your Fear of Authority
|
2
|
-
|
3
|
-
Scenario: run the main script with the auth token set in the env
|
4
|
-
|
5
|
-
Given the "SEMAPHORE_AUTH_TOKEN" env variable is set
|
6
|
-
When I run `git-semaphore --check-auth` in a git working dir
|
7
|
-
Then the exit status should be 0
|
8
|
-
And the stderr should contain exactly:
|
9
|
-
"""
|
10
|
-
"""
|
11
|
-
|
12
|
-
Scenario: run the main script with the auth token set in git config
|
13
|
-
|
14
|
-
Given "semaphore.authtoken" git config is set for git repo "blegga"
|
15
|
-
When I run `git-semaphore --check-auth` in "blegga" directory
|
16
|
-
Then the exit status should be 0
|
17
|
-
And the stderr should contain exactly:
|
18
|
-
"""
|
19
|
-
"""
|
20
|
-
|
21
|
-
Scenario: run the main script with the auth token not set in the env
|
22
|
-
|
23
|
-
Given the "SEMAPHORE_AUTH_TOKEN" env variable is not set
|
24
|
-
And "semaphore.authtoken" git config is not set for git repo "blegga"
|
25
|
-
When I run `git-semaphore --check-auth` in "blegga" directory
|
26
|
-
Then the exit status should be 255
|
27
|
-
And the stderr should contain exactly:
|
28
|
-
"""
|
29
|
-
Please set - and export - the SEMAPHORE_AUTH_TOKEN env variable
|
30
|
-
Alternatively, set semaphore.authtoken in your local git config
|
31
|
-
|
32
|
-
"""
|
@@ -1,32 +0,0 @@
|
|
1
|
-
Feature: Always Carry Identification Wherever You Go
|
2
|
-
|
3
|
-
Scenario: run the main script with the project token set in the env
|
4
|
-
|
5
|
-
Given the "SEMAPHORE_PROJECT_TOKEN" env variable is set
|
6
|
-
When I run `git-semaphore --check-project` in a git working dir
|
7
|
-
Then the exit status should be 0
|
8
|
-
And the stderr should contain exactly:
|
9
|
-
"""
|
10
|
-
"""
|
11
|
-
|
12
|
-
Scenario: run the main script with the project token set in git config
|
13
|
-
|
14
|
-
Given "semaphore.projecttoken" git config is set for git repo "blegga"
|
15
|
-
When I run `git-semaphore --check-project` in "blegga" directory
|
16
|
-
Then the exit status should be 0
|
17
|
-
And the stderr should contain exactly:
|
18
|
-
"""
|
19
|
-
"""
|
20
|
-
|
21
|
-
Scenario: run the main script with the project token not set in the env
|
22
|
-
|
23
|
-
Given the "SEMAPHORE_PROJECT_TOKEN" env variable is not set
|
24
|
-
And "semaphore.projecttoken" git config is not set for git repo "blegga"
|
25
|
-
When I run `git-semaphore --check-project` in "blegga" directory
|
26
|
-
Then the exit status should be 255
|
27
|
-
And the stderr should contain exactly:
|
28
|
-
"""
|
29
|
-
Please set - and export - the SEMAPHORE_PROJECT_TOKEN env variable
|
30
|
-
Alternatively, set semaphore.projecttoken in your local git config
|
31
|
-
|
32
|
-
"""
|
@@ -1,121 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Steps that interact with ENV (via `aruba.environment`)
|
3
|
-
#
|
4
|
-
|
5
|
-
Before do
|
6
|
-
set_environment_variable('SEMAPHORE_AUTH_TOKEN', nil)
|
7
|
-
set_environment_variable('SEMAPHORE_PROJECT_TOKEN', nil)
|
8
|
-
end
|
9
|
-
|
10
|
-
After do
|
11
|
-
restore_env
|
12
|
-
end
|
13
|
-
|
14
|
-
Given /^the "([A-Z_]+)" env variable is set(?: to "([^"]*)")?$/ do |key, value|
|
15
|
-
set_environment_variable(key, value || 'blegga')
|
16
|
-
end
|
17
|
-
|
18
|
-
Given /^the "([A-Z_]+)" env variable is not set$/ do |key|
|
19
|
-
set_environment_variable(key, nil)
|
20
|
-
end
|
21
|
-
|
22
|
-
Given /^a runtime environment with config:$/ do |config_table|
|
23
|
-
config_table.rows_hash.each do |key, value|
|
24
|
-
set_environment_variable(key, value)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
#
|
29
|
-
# Steps that interact with git
|
30
|
-
#
|
31
|
-
|
32
|
-
Given /^a git repo in directory "([^"]*)"$/ do |project_name|
|
33
|
-
@pwd = File.join(expand_path('.'), project_name)
|
34
|
-
@repo = Grit::Repo.init(@pwd)
|
35
|
-
end
|
36
|
-
|
37
|
-
Given /^a git repo in directory "([^"]*)" with config:$/ do |project_name, config_table|
|
38
|
-
step %(a git repo in directory "#{project_name}")
|
39
|
-
config_table.rows_hash.each do |key, value|
|
40
|
-
@repo.config[key] = value
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
Given /^"([^"]*)" git config is (not set|set) for git repo "([^"]*)"$/ do |key, is_or_isnt_set, project_name|
|
45
|
-
step %(a git repo in directory "#{project_name}")
|
46
|
-
@repo.config[key] = 'blegga' unless is_or_isnt_set == "not set"
|
47
|
-
end
|
48
|
-
|
49
|
-
#
|
50
|
-
# Steps that interact with Dir.pwd
|
51
|
-
#
|
52
|
-
|
53
|
-
When /^I run `([^`]*)` in a git working dir$/ do |cmd|
|
54
|
-
working_dir = "foo/bar/qux_blegga"
|
55
|
-
step %(a git repo in directory "#{working_dir}")
|
56
|
-
step %(I run `#{cmd}` in "#{working_dir}" directory)
|
57
|
-
end
|
58
|
-
|
59
|
-
When /^I run `([^`]*)` in "([^"]*)" directory$/ do |cmd, working_dir|
|
60
|
-
step %(a directory named "#{working_dir}")
|
61
|
-
cd working_dir
|
62
|
-
step %(I run `#{cmd}`)
|
63
|
-
@dirs = ['tmp', 'aruba'] # reset Aruba::API.current_dir
|
64
|
-
end
|
65
|
-
|
66
|
-
#
|
67
|
-
# Methodane/Aruba "extensions"/"customizations"
|
68
|
-
#
|
69
|
-
|
70
|
-
When /^I get the version of "([^"]*)"$/ do |app_name|
|
71
|
-
@app_name = app_name
|
72
|
-
step %(I run `#{app_name} --version`)
|
73
|
-
end
|
74
|
-
|
75
|
-
Then /^the output should include the version$/ do
|
76
|
-
step %(the output should match /v\\d+\\.\\d+\\.\\d+/)
|
77
|
-
end
|
78
|
-
|
79
|
-
Then /^the output should include the app name$/ do
|
80
|
-
step %(the output should match /#{Regexp.escape(@app_name)}/)
|
81
|
-
end
|
82
|
-
|
83
|
-
Then /^the output should include a copyright notice$/ do
|
84
|
-
step %(the output should match /Copyright \\(c\\) [\\d]{4}-[\\d]{4} [[\\w]+]+/)
|
85
|
-
end
|
86
|
-
|
87
|
-
#
|
88
|
-
# Steps that check config expectations
|
89
|
-
#
|
90
|
-
|
91
|
-
# Then /^the application uses "([^"]+)" as the git auth token$/ do |auth_token|
|
92
|
-
# (@app || Git::Semaphore::App.new(@repo, aruba.environment)).git_auth_token.should eq auth_token
|
93
|
-
# end
|
94
|
-
|
95
|
-
# Then /^the application uses "([^"]+)" as the git project token$/ do |project_token|
|
96
|
-
# (@app || Git::Semaphore::App.new(@repo, aruba.environment)).git_project_token.should eq project_token
|
97
|
-
# end
|
98
|
-
|
99
|
-
# Then /^the application uses "([^"]+)" as the env auth token$/ do |auth_token|
|
100
|
-
# (@app || Git::Semaphore::App.new(@repo, aruba.environment)).env_auth_token.should eq auth_token
|
101
|
-
# end
|
102
|
-
|
103
|
-
# Then /^the application uses "([^"]+)" as the env project token$/ do |project_token|
|
104
|
-
# (@app || Git::Semaphore::App.new(@repo, aruba.environment)).env_project_token.should eq project_token
|
105
|
-
# end
|
106
|
-
|
107
|
-
Then /^the application doesn't have an auth token$/ do
|
108
|
-
(@app || Git::Semaphore::App.new(@pwd, aruba.environment)).auth_token.should be_empty
|
109
|
-
end
|
110
|
-
|
111
|
-
Then /^the application doesn't have a project token$/ do
|
112
|
-
(@app || Git::Semaphore::App.new(@pwd, aruba.environment)).project_token.should be_empty
|
113
|
-
end
|
114
|
-
|
115
|
-
Then /^the application uses "([^"]+)" as the auth token$/ do |auth_token|
|
116
|
-
(@app || Git::Semaphore::App.new(@pwd, aruba.environment)).auth_token.should eq auth_token
|
117
|
-
end
|
118
|
-
|
119
|
-
Then /^the application uses "([^"]+)" as the project token$/ do |project_token|
|
120
|
-
(@app || Git::Semaphore::App.new(@pwd, aruba.environment)).project_token.should eq project_token
|
121
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
Given /^I am an authenticated user on semaphoreci\.com$/ do
|
2
|
-
@auth_token = SEMAPHORE_TEST_TOKEN
|
3
|
-
@project = '649e584dc507ca4b73e1374d3125ef0b567a949c'
|
4
|
-
@branch = '89'
|
5
|
-
end
|
6
|
-
|
7
|
-
Given /^get the list of all my projects via their API$/ do
|
8
|
-
@response = Git::Semaphore::Api.get_response Git::Semaphore::Api.projects_uri(@auth_token)
|
9
|
-
end
|
10
|
-
|
11
|
-
Given /^get the list of all the branches for one of my projects via their API$/ do
|
12
|
-
@response = Git::Semaphore::Api.get_response Git::Semaphore::Api.branches_uri(@project, @auth_token)
|
13
|
-
end
|
14
|
-
|
15
|
-
Given /^get the build status of one of the branches for one of my projects via their API$/ do
|
16
|
-
@response = Git::Semaphore::Api.get_response Git::Semaphore::Api.status_uri(@project, @branch, @auth_token)
|
17
|
-
end
|
18
|
-
|
19
|
-
Given /^request to rebuild the last revision of one of the branches for one of my projects via their API$/ do
|
20
|
-
@response = Git::Semaphore::Api.get_response Git::Semaphore::Api.last_revision_uri(@project, @branch, @auth_token), :post
|
21
|
-
end
|
22
|
-
|
23
|
-
def last_json
|
24
|
-
@response.body
|
25
|
-
end
|
data/features/support/env.rb
DELETED
data/features/support/vcr.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'vcr'
|
2
|
-
|
3
|
-
VCR.configure do |c|
|
4
|
-
c.hook_into :webmock # or :fakeweb
|
5
|
-
c.cassette_library_dir = 'features/cassettes'
|
6
|
-
c.debug_logger = File.open('vcr_debug.log', 'w')
|
7
|
-
end
|
8
|
-
|
9
|
-
VCR.cucumber_tags do |t|
|
10
|
-
t.tag '@vcr_api_projects'
|
11
|
-
t.tag '@vcr_api_branches'
|
12
|
-
t.tag '@vcr_api_status'
|
13
|
-
t.tag '@vcr_api_rebuild_last_revision'
|
14
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
Feature: It's Where You Can Find Me
|
2
|
-
|
3
|
-
Scenario: print out the working directory
|
4
|
-
|
5
|
-
Given a git repo in directory "foo/bar/qux_blegga"
|
6
|
-
When I run `git-semaphore --working-dir` in "foo/bar/qux_blegga" directory
|
7
|
-
Then the exit status should be 0
|
8
|
-
And the output should contain "foo/bar"
|
9
|
-
|
10
|
-
Scenario: print out the project name
|
11
|
-
|
12
|
-
Given a git repo in directory "foo/bar/qux_blegga"
|
13
|
-
When I run `git-semaphore --project-name` in "foo/bar/qux_blegga" directory
|
14
|
-
Then the exit status should be 0
|
15
|
-
And the output should contain "qux_blegga"
|
16
|
-
|
17
|
-
Scenario: print out the branch name
|
18
|
-
|
19
|
-
Given a git repo in directory "foo/bar/qux_blegga"
|
20
|
-
When I run `git-semaphore --branch-name` in "foo/bar/qux_blegga" directory
|
21
|
-
Then the exit status should be 0
|
22
|
-
And the output should contain "master"
|