git-semaphore 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.irbrc +13 -0
  4. data/.ruby-version +1 -0
  5. data/Gemfile +4 -0
  6. data/Guardfile +15 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +82 -0
  9. data/Rakefile +20 -0
  10. data/bin/git-semaphore +114 -0
  11. data/features/cassettes/cucumber_tags/api_branch_status.json +20 -0
  12. data/features/cassettes/cucumber_tags/api_project_branches.json +14 -0
  13. data/features/cassettes/cucumber_tags/api_projects.json +46 -0
  14. data/features/cassettes/cucumber_tags/vcr_api_branches.yml +70 -0
  15. data/features/cassettes/cucumber_tags/vcr_api_projects.yml +102 -0
  16. data/features/cassettes/cucumber_tags/vcr_api_status.yml +76 -0
  17. data/features/coming_soon.feature +13 -0
  18. data/features/env_config.feature +11 -0
  19. data/features/git_config.feature +11 -0
  20. data/features/help_and_version.feature +31 -0
  21. data/features/semaphore_app_api.feature +22 -0
  22. data/features/semaphore_app_config.feature +37 -0
  23. data/features/semaphore_auth_token.feature +32 -0
  24. data/features/semaphore_project_token.feature +32 -0
  25. data/features/step_definitions/git-semaphore_steps.rb +121 -0
  26. data/features/step_definitions/vcr_semaphore_steps.rb +21 -0
  27. data/features/support/env.rb +8 -0
  28. data/features/support/semaphoreapp.rb +2 -0
  29. data/features/support/vcr.rb +13 -0
  30. data/features/working_directory.feature +22 -0
  31. data/git-semaphore.gemspec +40 -0
  32. data/lib/git-semaphore/api.rb +55 -0
  33. data/lib/git-semaphore/app.rb +118 -0
  34. data/lib/git-semaphore/banner.rb +13 -0
  35. data/lib/git-semaphore/copyright.rb +6 -0
  36. data/lib/git-semaphore/version.rb +5 -0
  37. data/lib/git-semaphore.rb +17 -0
  38. data/spec_helper.rb +6 -0
  39. metadata +367 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 96cb8bd647469f3361ca842d073b4dc93b711284
4
+ data.tar.gz: a40fe3f7b5f92a2c4759270923e15ef53057b615
5
+ SHA512:
6
+ metadata.gz: 8988951bfb2e431ff45f35d65dd22a258c7ea073d248d2016f7fd8770318c25b85e0ae8a0b04b17aad8abb13a14d8ecd77b613276381ba4f179a0199307efeea
7
+ data.tar.gz: 9961a3de5ffa20ed97f73712a1ce994a484311478d93e8c3ab910658509519d72fc63188d0f1e7570f9bb632f714ca2dc826efa355d871f2a607beda1eaa4991
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.sublime-*
19
+ vcr_debug.log
data/.irbrc ADDED
@@ -0,0 +1,13 @@
1
+ # vim:syntax=ruby
2
+
3
+ $:.unshift Dir.pwd
4
+ $:.unshift File.join(Dir.pwd, 'lib')
5
+
6
+ require 'git-semaphore'
7
+
8
+ require 'rubygems'
9
+
10
+ require 'bundler'
11
+ Bundler.require
12
+
13
+ # That's all, Folks!
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.0.0-p247
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in git-semaphore.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,15 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'rspec', :cli => "--format RSpec::Pride --tty --fail-fast" do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+ end
9
+
10
+ guard 'cucumber', :cli => '--tags ~@wip --format Cucumber::Pride::Formatter' do
11
+ watch(%r{^features/.+\.feature$})
12
+ watch(%r{^(bin|lib)/.+$}) { 'features' }
13
+ watch(%r{^features/support/.+$}) { 'features' }
14
+ watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
15
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Peter Vandenberk
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,82 @@
1
+ # Git::Semaphore
2
+
3
+ ![SEMAPHORE BADGE](https://semaphoreapp.com/api/v1/projects/03b2dffc7112138851166c86adb456484426a712/7753/badge.png)
4
+
5
+ git integration with [semaphoreapp.com][semaphoreapp.com]
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'git-semaphore'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install git-semaphore
20
+
21
+ ## Authentication
22
+
23
+ Log into [semaphoreapp.com][semaphoreapp.com] and find your API `authentication token` in the `API` tab of one of your projects' `settings` page.
24
+
25
+ Next, choose one of the following mechanisms to make your API `authentication token` available to `Git::Semaphore`...
26
+
27
+ ### via an environment variable
28
+
29
+ $ export SEMAPHORE_AUTH_TOKEN="Yds3w6o26FLfJTnVK2y9"
30
+
31
+ ### via `local` git config _(in a git working dir)_
32
+
33
+ $ git config --local --replace-all semaphore.authtoken "Yds3w6o26FLfJTnVK2y9"
34
+
35
+ ### via `global` git config
36
+
37
+ $ git config --global --replace-all semaphore.authtoken "Yds3w6o26FLfJTnVK2y9"
38
+
39
+ ## Usage
40
+
41
+ All of the below examples need to be run from within a git directory.
42
+
43
+ ### listing of user’s projects
44
+
45
+ $ git semaphore --projects
46
+
47
+ ### listing of project’s branches
48
+
49
+ $ git semaphore --branches
50
+
51
+ _(the project name is derived from the current git directory)_
52
+
53
+ ### status of a project’s branch
54
+
55
+ $ git semaphore --status
56
+
57
+ _(the project and branch name are derived from the current git directory and the current git head)_
58
+
59
+ ### formatting the raw `git semaphore` JSON output
60
+
61
+ After installing the quite brilliant [jazor gem][jazor] (`gem install jazor`), the `jazor` utility can be used to format the raw JSON output generated by the various `git semaphore` commands, as follows:
62
+
63
+ $ git semaphore --projects | jazor -c
64
+ $ git semaphore --branches | jazor -c
65
+ $ git semaphore --status | jazor -c
66
+
67
+ ## Development
68
+
69
+ $ gem build git-semaphore.gemspec
70
+ $ # this will generate a 'git-semaphore-x.y.z.gem' file
71
+ $ gem install git-semaphore-x.y.z.gem
72
+
73
+ ## Contributing
74
+
75
+ 1. Fork it
76
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
77
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
78
+ 4. Push to the branch (`git push origin my-new-feature`)
79
+ 5. Create new Pull Request
80
+
81
+ [semaphoreapp.com]: https://semaphoreapp.com/
82
+ [jazor]: https://github.com/mconigliaro/jazor
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ task :default => :cucumber
4
+
5
+ task :gemspec do
6
+ @gemspec ||= eval(File.read(Dir["*.gemspec"].first))
7
+ end
8
+
9
+ desc "Validate the gemspec"
10
+ task :validate => :gemspec do
11
+ @gemspec.validate
12
+ end
13
+
14
+ require 'cucumber'
15
+ require 'cucumber/rake/task'
16
+
17
+ Cucumber::Rake::Task.new(:features) do |t|
18
+ t.cucumber_opts = "features --format pretty --tags ~@wip"
19
+ end
20
+ task :cucumber => :features
data/bin/git-semaphore ADDED
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+
5
+ begin
6
+ require 'git-semaphore'
7
+ rescue LoadError
8
+ require 'rubygems'
9
+ require 'git-semaphore'
10
+ end
11
+
12
+ options = Trollop::options do
13
+
14
+ version Git::Semaphore::COPYRIGHT
15
+ banner Git::Semaphore::BANNER
16
+
17
+ opt :projects, 'List all semaphore.app projects', :short => nil, :default => false
18
+ opt :branches, 'List all semaphore.app branches for current project', :short => nil, :default => false
19
+ opt :status, 'List the semaphore.app status for the given branch', :short => nil, :default => false
20
+ opt :'commit-status', 'Check commit status', :default => false
21
+
22
+ opt :'working-dir', 'Print working dir', :short => 'w', :default => false
23
+ opt :'project-name', 'Print project name', :short => 'p', :default => false
24
+ opt :'branch-name', 'Print branch name', :short => 'b', :default => false
25
+
26
+ opt :'check-auth', 'Check auth token', :short => 'x', :default => false
27
+ opt :'check-project', 'Check project hash id', :short => 'y', :default => false
28
+ opt :'check-branch', 'Check branch id', :short => 'z', :default => false
29
+
30
+ opt :'git-config', 'Print git settings', :short => 'g', :default => false
31
+ opt :'env-config', 'Print environment settings', :short => 'e', :default => false
32
+
33
+ end
34
+
35
+ app = Git::Semaphore::App.new(Dir.pwd, ENV)
36
+
37
+ if !app.validate
38
+ r = app.git_repo rescue false
39
+ unless r
40
+ STDERR.puts "Error: \"#{Dir.pwd}\" is not a git working directory... exiting!"
41
+ exit 255
42
+ end
43
+ end
44
+
45
+ if options[:'commit-status']
46
+ puts app.commit_status
47
+ exit 0
48
+ end
49
+
50
+ if options[:projects]
51
+ puts app.projects
52
+ exit 0
53
+ end
54
+
55
+ if options[:branches]
56
+ puts app.branches
57
+ exit 0
58
+ end
59
+
60
+ if options[:status]
61
+ puts app.status
62
+ exit 0
63
+ end
64
+
65
+ if options[:'working-dir']
66
+ puts app.working_dir
67
+ exit 0
68
+ end
69
+
70
+ if options[:'project-name']
71
+ puts app.project_name
72
+ exit 0
73
+ end
74
+
75
+ if options[:'branch-name']
76
+ puts app.branch_name
77
+ exit 0
78
+ end
79
+
80
+ if options[:'check-auth']
81
+ unless app.auth_token
82
+ STDERR.puts 'Please set - and export - the SEMAPHORE_AUTH_TOKEN env variable'
83
+ STDERR.puts 'Alternatively, set semaphore.authtoken in your local git config'
84
+ exit -1
85
+ else
86
+ exit 0
87
+ end
88
+ end
89
+
90
+ if options[:'check-project']
91
+ unless app.project_token
92
+ STDERR.puts 'Please set - and export - the SEMAPHORE_PROJECT_TOKEN env variable'
93
+ STDERR.puts 'Alternatively, set semaphore.projecttoken in your local git config'
94
+ exit -1
95
+ else
96
+ exit 0
97
+ end
98
+ end
99
+
100
+ if options[:'env-config']
101
+ puts "export SEMAPHORE_AUTH_TOKEN=\"#{app.env_auth_token}\""
102
+ puts "export SEMAPHORE_PROJECT_TOKEN=\"#{app.env_project_token}\""
103
+ exit 0
104
+ end
105
+
106
+ if options[:'git-config']
107
+ puts "git config --local --replace-all semaphore.authtoken \"#{app.git_auth_token}\""
108
+ puts "git config --local --replace-all semaphore.projecttoken \"#{app.git_project_token}\""
109
+ exit 0
110
+ end
111
+
112
+ fail "Coming soon!"
113
+
114
+ # That's all, Folks!
@@ -0,0 +1,20 @@
1
+ {
2
+ "branch_name": "gem_updates",
3
+ "branch_url": "https://semaphoreapp.com/projects/44/branches/50",
4
+ "branch_status_url": "http://semaphoreapp.com/api/v1/projects/649e584dc507ca4b73e1374d3125ef0b567a949c/89/status?auth_token=Yds3w6o26FLfJTnVK2y9",
5
+ "branch_history_url": "http://semaphoreapp.com/api/v1/projects/649e584dc507ca4b73e1374d3125ef0b567a949c/89?auth_token=Yds3w6o26FLfJTnVK2y9",
6
+ "project_name": "base-app",
7
+ "build_url": "https://semaphoreapp.com/projects/44/branches/50/builds/15",
8
+ "build_number": 15,
9
+ "result": "passed",
10
+ "started_at": "2012-07-09T15:23:53Z",
11
+ "finished_at": "2012-07-09T15:30:16Z",
12
+ "commit": {
13
+ "id": "dc395381e650f3bac18457909880829fc20e34ba",
14
+ "url": "https://github.com/renderedtext/base-app/commit/dc395381e650f3bac18457909880829fc20e34ba",
15
+ "author_name": "Vladimir Saric",
16
+ "author_email": "vladimir@renderedtext.com",
17
+ "message": "Update 'shoulda' gem.",
18
+ "timestamp": "2012-07-04T18:14:08Z"
19
+ }
20
+ }
@@ -0,0 +1,14 @@
1
+ [
2
+ {
3
+ "id": 1324,
4
+ "name": "new-build-page"
5
+ },
6
+ {
7
+ "id": 1120,
8
+ "name": "development"
9
+ },
10
+ {
11
+ "id": 987,
12
+ "name": "branches_api"
13
+ }
14
+ ]
@@ -0,0 +1,46 @@
1
+ [
2
+ {
3
+ "id": 61,
4
+ "hash_id": "3f1004b8343faabda63d441734526c854380ab89",
5
+ "name": "testapp-sphinx",
6
+ "owner": "renderedtext",
7
+ "created_at": "2012-09-04T11:53:22Z",
8
+ "updated_at": "2012-09-04T12:01:17Z",
9
+ "branches": [
10
+ {
11
+ "branch_name": "master",
12
+ "branch_url": "http://10.0.1.76:3000/projects/61/branches/85",
13
+ "branch_status_url": "http://semaphoreapp.com/api/v1/projects/3f1004b8343faabda63d441734526c854380ab89/85/status?auth_token=Yds3w6o26FLfJTnVK2y9",
14
+ "branch_history_url": "http://semaphoreapp.com/api/v1/projects/3f1004b8343faabda63d441734526c854380ab89/85?auth_token=Yds3w6o26FLfJTnVK2y9",
15
+ "project_name": "testapp-sphinx",
16
+ "build_url": "http://10.0.1.76:3000/projects/61/branches/85/builds/1",
17
+ "build_number": 1,
18
+ "result": "passed",
19
+ "started_at": "2012-09-04T11:55:07Z",
20
+ "finished_at": "2012-09-04T12:01:16Z"
21
+ }
22
+ ]
23
+ },
24
+ {
25
+ "id": 63,
26
+ "hash_id": "649e584dc507ca4b73e1374d3125ef0b567a949c",
27
+ "name": "testapp-mongodb",
28
+ "owner": "renderedtext",
29
+ "created_at": "2012-09-14T10:53:38Z",
30
+ "updated_at": "2012-09-14T11:16:51Z",
31
+ "branches": [
32
+ {
33
+ "branch_name": "mongoid3",
34
+ "branch_url": "http://10.0.1.76:3000/projects/63/branches/89",
35
+ "branch_status_url": "http://semaphoreapp.com/api/v1/projects/3f1004b8343faabda63d441734526c854380ab89/85/status?auth_token=Yds3w6o26FLfJTnVK2y9",
36
+ "branch_history_url": "http://semaphoreapp.com/api/v1/projects/3f1004b8343faabda63d441734526c854380ab89/85?auth_token=Yds3w6o26FLfJTnVK2y9",
37
+ "project_name": "testapp-mongodb",
38
+ "build_url": "http://10.0.1.76:3000/projects/63/branches/89/builds/3",
39
+ "build_number": 3,
40
+ "result": "passed",
41
+ "started_at": "2012-09-14T11:11:39Z",
42
+ "finished_at": "2012-09-14T11:16:51Z"
43
+ }
44
+ ]
45
+ }
46
+ ]
@@ -0,0 +1,70 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://semaphoreapp.com/api/v1/projects/649e584dc507ca4b73e1374d3125ef0b567a949c/branches?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
+ - ! '"645f463f79de43c58d74c6f9bb8b85fb"'
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ Set-Cookie:
40
+ - _base-app_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJWZiZGIzMmM5MzFmNmNiNDc2MGI0YWFmZWQ4MDQ1MDkxBjsAVEkiGXdhcmRlbi51c2VyLnVzZXIua2V5BjsAVFsISSIJVXNlcgY7AEZbBmkCCANJIiIkMmEkMTAkN3VSVzl5MkpUMHVrdVA5TWVncEpYdQY7AFQ%3D--76ec7f994c872cd2f7537a2f788e9ded073986e3;
41
+ path=/; secure; HttpOnly
42
+ X-Request-Id:
43
+ - 7f52a676f2f8f64cbcbfc9a39a85c48e
44
+ X-Runtime:
45
+ - '0.092267'
46
+ Date:
47
+ - Sat, 20 Oct 2012 11:58:28 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": 1324,
57
+ "name": "new-build-page"
58
+ },
59
+ {
60
+ "id": 1120,
61
+ "name": "development"
62
+ },
63
+ {
64
+ "id": 987,
65
+ "name": "branches_api"
66
+ }
67
+ ]'
68
+ http_version:
69
+ recorded_at: Sat, 20 Oct 2012 11:58:31 GMT
70
+ recorded_with: VCR 2.2.5
@@ -0,0 +1,102 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://semaphoreapp.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://semaphoreapp.com/api/v1/projects/3f1004b8343faabda63d441734526c854380ab89/85/status?auth_token=Yds3w6o26FLfJTnVK2y9",
67
+ "branch_history_url": "http://semaphoreapp.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://semaphoreapp.com/api/v1/projects/3f1004b8343faabda63d441734526c854380ab89/85/status?auth_token=Yds3w6o26FLfJTnVK2y9",
89
+ "branch_history_url": "http://semaphoreapp.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
@@ -0,0 +1,76 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://semaphoreapp.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://semaphoreapp.com/projects/44/branches/50",
57
+ "branch_status_url": "http://semaphoreapp.com/api/v1/projects/649e584dc507ca4b73e1374d3125ef0b567a949c/89/status?auth_token=Yds3w6o26FLfJTnVK2y9",
58
+ "branch_history_url": "http://semaphoreapp.com/api/v1/projects/649e584dc507ca4b73e1374d3125ef0b567a949c/89?auth_token=Yds3w6o26FLfJTnVK2y9",
59
+ "project_name": "base-app",
60
+ "build_url": "https://semaphoreapp.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
@@ -0,0 +1,13 @@
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\)/
@@ -0,0 +1,11 @@
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"/