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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +9 -19
  3. data/.pryrc +6 -0
  4. data/.ruby-version +1 -1
  5. data/CODE_OF_CONDUCT.md +49 -0
  6. data/LICENSE.txt +17 -18
  7. data/README.md +166 -40
  8. data/Rakefile +8 -9
  9. data/bin/console +14 -0
  10. data/bin/setup +10 -0
  11. data/exe/git-semaphore +79 -0
  12. data/git-semaphore.gemspec +15 -19
  13. data/lib/git/semaphore/api.rb +133 -0
  14. data/lib/git/semaphore/api_cache.rb +59 -0
  15. data/lib/git/semaphore/api_enrich.rb +40 -0
  16. data/lib/git/semaphore/app.rb +121 -0
  17. data/lib/{git-semaphore → git/semaphore}/banner.rb +0 -0
  18. data/lib/{git-semaphore → git/semaphore}/copyright.rb +1 -1
  19. data/lib/{git-semaphore → git/semaphore}/version.rb +1 -1
  20. data/lib/git/semaphore.rb +77 -0
  21. metadata +55 -181
  22. data/.bundle/config +0 -3
  23. data/.irbrc +0 -13
  24. data/bin/git-semaphore +0 -115
  25. data/features/cassettes/cucumber_tags/api_branch_status.json +0 -20
  26. data/features/cassettes/cucumber_tags/api_project_branches.json +0 -14
  27. data/features/cassettes/cucumber_tags/api_projects.json +0 -46
  28. data/features/cassettes/cucumber_tags/vcr_api_branches.yml +0 -70
  29. data/features/cassettes/cucumber_tags/vcr_api_projects.yml +0 -102
  30. data/features/cassettes/cucumber_tags/vcr_api_rebuild_last_revision.yml +0 -55
  31. data/features/cassettes/cucumber_tags/vcr_api_status.yml +0 -76
  32. data/features/coming_soon.feature +0 -13
  33. data/features/env_config.feature +0 -11
  34. data/features/git_config.feature +0 -11
  35. data/features/help_and_version.feature +0 -33
  36. data/features/semaphore_app_api.feature +0 -29
  37. data/features/semaphore_app_config.feature +0 -37
  38. data/features/semaphore_auth_token.feature +0 -32
  39. data/features/semaphore_project_token.feature +0 -32
  40. data/features/step_definitions/git-semaphore_steps.rb +0 -121
  41. data/features/step_definitions/patch_methadone_steps.rb +0 -5
  42. data/features/step_definitions/vcr_semaphore_steps.rb +0 -25
  43. data/features/support/env.rb +0 -7
  44. data/features/support/semaphoreapp.rb +0 -2
  45. data/features/support/vcr.rb +0 -14
  46. data/features/working_directory.feature +0 -22
  47. data/lib/git-semaphore/api.rb +0 -60
  48. data/lib/git-semaphore/app.rb +0 -123
  49. data/lib/git-semaphore.rb +0 -15
  50. data/spec_helper.rb +0 -6
  51. data/vendor/bundle/.gitignore +0 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b86473a790890b9ce221b9f1a41143a6b11c63ee
4
- data.tar.gz: cf5a879705922db3a175eb1294df94fda33cde54
3
+ metadata.gz: 796fce310598b663f7a73fa5f98d68602de41bf6
4
+ data.tar.gz: 25ace2adb5a1a3f245ab1a02c9f86553917d0550
5
5
  SHA512:
6
- metadata.gz: 72be87873ee8f9ac9dc50780560bf04a086c2238f7aa73eb1ff8b83971a9e13f18ca2b466f813bdc00e15c14e062b76f01f41c95f18834d74f36d660bb590161
7
- data.tar.gz: 1e9f18f4dd33f89ca2c895ea274ebee95f826b0706c1e968dfcaa3a0cc8e171510ad311f15a6e75dadbaffea31a0672af62a9ebefbc1910771008705175e96ff
6
+ metadata.gz: 24e942d6b710d328183c42d89937ca5e80c2c51ed5dc2d3e5f5cea4780bd3b1b2ad890c3bfb43d01a55dbcbcb2b7b4bba889e1adb7473562662d4ad00bc488b0
7
+ data.tar.gz: 168659a4950ecdba848365456bea3052ca393734cf72e942affdf81e859fbdfb139067a303e21b5ee44124f1143030b450e69df4a338f0996ce54739ede739f4
data/.gitignore CHANGED
@@ -1,19 +1,9 @@
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
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.pryrc ADDED
@@ -0,0 +1,6 @@
1
+ # this loads all of "git semaphore"
2
+ load "exe/git-semaphore" unless Kernel.const_defined? 'Git::Semaphore'
3
+
4
+ # utility function to set pry context
5
+ # to an instance of <Git::Semaphore::App>
6
+ def app() pry Git::Semaphore::App.new(Git::Semaphore.auth_token, Git::Semaphore.git_repo, ENV) ; end
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.0.0-p598
1
+ 2.3.1
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at peter.vandenberk@simplybusiness.co.uk. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/LICENSE.txt CHANGED
@@ -1,22 +1,21 @@
1
- Copyright (c) 2012 Peter Vandenberk
1
+ The MIT License (MIT)
2
2
 
3
- MIT License
3
+ Copyright (c) 2012-2016 Peter Vandenberk
4
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:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
12
11
 
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
15
14
 
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.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,84 +1,210 @@
1
1
  # Git::Semaphore
2
2
 
3
- [![Build Status](https://semaphoreci.com/api/v1/projects/03b2dffc7112138851166c86adb456484426a712/7753/badge.png)](https://semaphoreci.com/pvdb/git-semaphore)
3
+ [![Build Status](https://semaphoreci.com/api/v1/pvdb/git-semaphore/branches/master/badge.svg)](https://semaphoreci.com/pvdb/git-semaphore)
4
4
 
5
5
  [![Travis CI](https://travis-ci.org/pvdb/git-semaphore.svg?branch=v0.0.6)](https://travis-ci.org/pvdb/git-semaphore)
6
6
 
7
- git integration with [semaphoreci.com][] (via their API)
7
+ Integrate git repositories with their corresponding project on [semaphoreci.com][] _(via the semaphore API)_
8
+
9
+ ## Features
10
+
11
+ * highly opiniated
12
+ * integrated with `git`
13
+ * caching of API results
14
+ * pagination of API calls
15
+ * enrichment of API data
16
+ * extensive API feature support
17
+ * support for multiple Semaphore accounts
18
+
19
+ ## Semaphore API support
20
+
21
+ The following sections of the [Semaphore API][] are fully or partially supported by `git semaphore`:
22
+
23
+ | API section | | summary |
24
+ |--------------------|----|---------|
25
+ | [authentication][] | ✅ | API authentication |
26
+ | [projects][] | ✅ | listing projects |
27
+ | [branches and builds][] | ✅ | querying branches and managing builds |
28
+ | [servers and deploys][] | ❌ | querying servers and managing deploys |
29
+ | [webhooks][] | ❌ | listing and managing webhooks |
30
+
31
+ [authentication]: https://semaphoreci.com/docs/api_authentication.html
32
+ [projects]: https://semaphoreci.com/docs/projects-api.html
33
+ [branches and builds]: https://semaphoreci.com/docs/branches-and-builds-api.html
34
+ [servers and deploys]: https://semaphoreci.com/docs/servers-and-deploys-api.html
35
+ [webhooks]: https://semaphoreci.com/docs/webhooks-api.html
36
+
37
+ The following [Semaphore API][] features are supported by `git semaphore`:
38
+
39
+ | API feature | | command |summary |
40
+ |------------------|----|---------|--------|
41
+ | [authentication][] | ✅ | | provide user authentication via an authentication token |
42
+ | [projects][] | ✅ | `git semaphore --projects` | list all projects and their current status |
43
+ | [project branches][] | ✅ | `git semaphore --branches` | list all branches for the current project |
44
+ | [branch status][] | ✅ | `git semaphore --status` | list the build status for the current branch |
45
+ | [branch history][] | ✅ | `git semaphore --history` | list the build history for the current branch |
46
+ | [build information][] | ❌ | | detailed information for a given build number |
47
+ | [build log][] | ❌ | | execution logs for a given build number _(per thread and command)_ |
48
+ | [rebuild][] | ✅ | `git semaphore --rebuild` | rebuild last revision for the current branch |
49
+ | [launch build][] | ❌ | | launch a build for the given commit SHA |
50
+ | [stop][] | ❌ | | stop an in-progress build |
51
+ | [deploy][] | ❌ | | run a deploy from a given build |
52
+
53
+ [project branches]: https://semaphoreci.com/docs/branches-and-builds-api.html#project_branches
54
+ [branch status]: https://semaphoreci.com/docs/branches-and-builds-api.html#branch_status
55
+ [branch history]: https://semaphoreci.com/docs/branches-and-builds-api.html#branch_history
56
+ [build information]: https://semaphoreci.com/docs/branches-and-builds-api.html#build_information
57
+ [build log]: https://semaphoreci.com/docs/branches-and-builds-api.html#build_log
58
+ [rebuild]: https://semaphoreci.com/docs/branches-and-builds-api.html#rebuild
59
+ [launch build]: https://semaphoreci.com/docs/branches-and-builds-api.html#launch_build
60
+ [stop]: https://semaphoreci.com/docs/branches-and-builds-api.html#stop
61
+ [deploy]: https://semaphoreci.com/docs/branches-and-builds-api.html#deploy
8
62
 
9
63
  ## Installation
10
64
 
11
- Add this line to your application's Gemfile:
65
+ Install the gem:
12
66
 
13
- gem 'git-semaphore'
67
+ gem install git-semaphore
14
68
 
15
- And then execute:
69
+ And execute it as a `git` subcommand:
16
70
 
17
- $ bundle
71
+ git semaphore <options>
18
72
 
19
- Or install it yourself as:
73
+ To get an overview of the available options, use:
20
74
 
21
- $ gem install git-semaphore
75
+ git-semaphore --help
22
76
 
23
- ## Authentication
77
+ ## API authentication
24
78
 
25
- Log into [semaphoreci.com][] and find your API `authentication token` in the `API` tab of one of your projects' `settings` page.
79
+ Log into [semaphoreci.com][] and find **your authentication token** at the bottom of your [account settings][] page... this is also explained in [the Semaphore API documentation][authentication].
26
80
 
27
- Next, choose one of the following mechanisms to make your API `authentication token` available to `Git::Semaphore`...
81
+ Next, choose one of the following mechanisms to make your API authentication token available to `git semaphore`...
82
+
83
+ ### via *local* git config _(in a git working dir)_
84
+
85
+ git config --local --replace-all semaphore.authtoken "Yds3w6o26FLfJTnVK2y9"
86
+
87
+ ### via *global* git config
88
+
89
+ git config --global --replace-all semaphore.authtoken "Yds3w6o26FLfJTnVK2y9"
28
90
 
29
91
  ### via an environment variable
30
92
 
31
- $ export SEMAPHORE_AUTH_TOKEN="Yds3w6o26FLfJTnVK2y9"
93
+ export SEMAPHORE_AUTH_TOKEN="Yds3w6o26FLfJTnVK2y9"
94
+
95
+ This is also the order in which tokens are searched for - and hence their precedence - meaning that if you have different Semaphore accounts for different projects _(e.g. work and personal projects)_ then you can configure your respective git repos with the authentication token of the corresponding Semaphore account.
96
+
97
+ ## API result caching
98
+
99
+ For performance reasons _(especially for Semaphore API calls that are paginated)_, to enable offline use of the Semaphore API data, as well as to support interactive use of the data in e.g. `irb` or `pry` sessions, `git semaphore` transparently caches the results of all API calls in the `${HOME}/.git/semaphore/` directory.
100
+
101
+ This means that running `git semaphore` commands may return stale data, in cases where things have changed on `semaphoreci.com` since the last time `git semaphore` was run.
102
+
103
+ To delete the cache - and force a refresh of the Semaphore data on the next API call - use the `git semaphore --clean` command... this will empty out the entire `${HOME}/.git/semaphore` cache directory.
104
+
105
+ ## Integration with `git`
106
+
107
+ When used inside a git repository, `git semaphore` uses [convention over configuration][coc] to figure out the relevant settings it needs in order to make valid Semaphore API requests:
108
+
109
+ | setting | inside git repo | pseudo-code | override |
110
+ |--------------|--------------------|---------------------------------|---------------------------------|
111
+ | project name | derived from pwd | `File.basename(Dir.pwd)` | `ENV['SEMAPHORE_PROJECT_NAME']` |
112
+ | branch name | current git branch | `git symbolic-ref --short HEAD` | `ENV['SEMAPHORE_BRANCH_NAME']` |
113
+ | commit SHA | current git head | `git rev-parse HEAD` | `ENV['SEMAPHORE_COMMIT_SHA']` |
114
+
115
+ However, each of these defaults can be overridden by setting the corresponding environment variable, as documented in the above table. The same `ENV`-based override mechanism can be leveraged to use `git semaphore` outside of a git repository.
116
+
117
+ The `git semaphore --settings` command can be used to print out the values for these various settings:
118
+
119
+ $ git semaphore --settings | jq '.'
120
+ {
121
+ "semaphore_auth_token": "Yds3w6o26FLfJTnVK2y9",
122
+ "semaphore_project_name": "git-semaphore",
123
+ "semaphore_branch_name": "master",
124
+ "semaphore_commit_sha": "4b59c3e41ca4592dfb01f77f2163154f3d3532fe"
125
+ }
126
+ $ _
127
+
128
+ ## Available commands
32
129
 
33
- ### via `local` git config _(in a git working dir)_
130
+ > ⚠️ all of the below examples need to be run from within a git repository ⚠️
34
131
 
35
- $ git config --local --replace-all semaphore.authtoken "Yds3w6o26FLfJTnVK2y9"
132
+ ### list the Semaphore settings
36
133
 
37
- ### via `global` git config
134
+ git semaphore --settings
38
135
 
39
- $ git config --global --replace-all semaphore.authtoken "Yds3w6o26FLfJTnVK2y9"
136
+ _(lists things like project name, branch name, commit SHA, etc.)_
40
137
 
41
- ## Usage
138
+ ### open the Semaphore page for the project's current branch
42
139
 
43
- All of the below examples need to be run from within a git directory.
140
+ git semaphore --browse
44
141
 
45
- ### listing of user's projects
142
+ _(the project and branch names are derived from the current git repository and the current git head)_
46
143
 
47
- $ git semaphore --projects
144
+ ### delete the local Semapore API cache
48
145
 
49
- ### listing of project's branches
146
+ git semaphore --clean
50
147
 
51
- $ git semaphore --branches
148
+ _(this ensures the Semaphore data is refreshed for the subsequent API calls)_
149
+
150
+ ### list all Semaphore projects
151
+
152
+ git semaphore --projects
153
+
154
+ _(for the Semaphore user account corresponding to the authentication token)_
155
+
156
+ ### list all of the project's branches
157
+
158
+ git semaphore --branches
52
159
 
53
160
  _(the project name is derived from the current git directory)_
54
161
 
55
- ### status of a project's branch
162
+ ### build status of the project's current branch
163
+
164
+ git semaphore --status
165
+
166
+ _(the project and branch names are derived from the current git repository and the current git head)_
167
+
168
+ ### build history of a project's branch
56
169
 
57
- $ git semaphore --status
170
+ git semaphore --history
58
171
 
59
- _(the project and branch name are derived from the current git directory and the current git head)_
172
+ _(the project and branch names are derived from the current git repository and the current git head)_
60
173
 
61
- ### formatting the raw `git semaphore` JSON output
174
+ ## Formatting the raw `git semaphore` JSON output
62
175
 
63
- 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:
176
+ After installing [the indispensable jq utility][jq] (`brew install jq`), the raw JSON output generated by the various `git semaphore` commands can be formatted and queried as follows:
64
177
 
65
- $ git semaphore --projects | jazor -c
66
- $ git semaphore --branches | jazor -c
67
- $ git semaphore --status | jazor -c
178
+ # pretty-print the git semaphore settings
179
+ git semaphore --settings | jq '.'
180
+
181
+ # list the full name of all Semaphore projects
182
+ git semaphore --projects | jq -r '.[] | .full_name'
183
+
184
+ # get the status of the last build for the current branch
185
+ git semaphore --status | jq -r '.result'
186
+
187
+ # list the build duration (in minutes) for all "passed" builds of the current branch
188
+ git semaphore --history | jq -r '.builds | .[] | select(.result == "passed") | (.build_number|tostring) + "\t" + (.duration.minutes|tostring)'
189
+
190
+ [semaphoreci.com]: https://semaphoreci.com/
191
+ [account settings]: https://semaphoreci.com/users/edit
192
+ [Semaphore API]: https://semaphoreci.com/docs/api.html
193
+
194
+ [jq]: https://stedolan.github.io/jq/
195
+ [coc]: https://en.wikipedia.org/wiki/Convention_over_configuration
68
196
 
69
197
  ## Development
70
198
 
71
- $ gem build git-semaphore.gemspec
72
- $ # this will generate a 'git-semaphore-x.y.z.gem' file
73
- $ gem install git-semaphore-x.y.z.gem
199
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
200
+
201
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
74
202
 
75
203
  ## Contributing
76
204
 
77
- 1. Fork it
78
- 2. Create your feature branch (`git checkout -b my-new-feature`)
79
- 3. Commit your changes (`git commit -am 'Add some feature'`)
80
- 4. Push to the branch (`git push origin my-new-feature`)
81
- 5. Create new Pull Request
205
+ Bug reports and pull requests are welcome on GitHub at https://github.com/pvdb/git-semaphore. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
206
+
207
+ ## License
208
+
209
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
82
210
 
83
- [semaphoreci.com]: https://semaphoreci.com/
84
- [jazor]: https://github.com/mconigliaro/jazor
data/Rakefile CHANGED
@@ -1,6 +1,13 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rake/testtask"
2
3
 
3
- task :default => :cucumber
4
+ task :default => :test
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList['test/**/*_test.rb']
10
+ end
4
11
 
5
12
  task :gemspec do
6
13
  @gemspec ||= eval(File.read(Dir["*.gemspec"].first))
@@ -10,11 +17,3 @@ desc "Validate the gemspec"
10
17
  task :validate => :gemspec do
11
18
  @gemspec.validate
12
19
  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/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "git/semaphore"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ require "pry"
11
+ Pry.start
12
+
13
+ # require "irb"
14
+ # IRB.start
data/bin/setup ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ rbenv install -s
7
+ gem install bundler
8
+ bundle install
9
+
10
+ # That's all Folks!
data/exe/git-semaphore ADDED
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
4
+
5
+ require 'git/semaphore'
6
+
7
+ if __FILE__ == $0
8
+
9
+ require 'slop'
10
+
11
+ options = Slop.parse(help: true) do
12
+
13
+ on :version, 'Print the version' do
14
+ puts Git::Semaphore::COPYRIGHT
15
+ exit(0)
16
+ end
17
+
18
+ banner Git::Semaphore::BANNER
19
+
20
+ on :settings, 'Display the relevants settings'
21
+ on :browse, 'Open the project on https://semaphoreci.com/'
22
+
23
+ on :clean, 'Deletes the cached API query results'
24
+
25
+ on :projects, 'List all projects and their current status'
26
+ on :branches, 'List all branches for the current project'
27
+ on :status, 'List the build status for the current branch'
28
+ on :history, 'List the build history for the current branch'
29
+ on :rebuild, 'Rebuild last revision for the current branch'
30
+
31
+ end
32
+
33
+ app = Git::Semaphore::App.new(Git::Semaphore.auth_token, Git::Semaphore.git_repo, ENV)
34
+
35
+ if options.settings?
36
+ puts app.to_json
37
+ exit 0
38
+ end
39
+
40
+ if options.browse?
41
+ `open #{app.branch_url}`
42
+ exit 0
43
+ end
44
+
45
+ if options.clean?
46
+ Git::Semaphore.empty_cache_dir
47
+ exit 0
48
+ end
49
+
50
+ if options.projects?
51
+ puts app.projects.to_json
52
+ exit 0
53
+ end
54
+
55
+ if options.branches?
56
+ puts app.branches.to_json
57
+ exit 0
58
+ end
59
+
60
+ if options.status?
61
+ puts app.status.to_json
62
+ exit 0
63
+ end
64
+
65
+ if options.history?
66
+ puts app.history.to_json
67
+ exit 0
68
+ end
69
+
70
+ if options.rebuild?
71
+ puts app.rebuild
72
+ exit 0
73
+ end
74
+
75
+ fail "Coming soon!"
76
+
77
+ end
78
+
79
+ # That's all Folks!
@@ -1,35 +1,31 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'git-semaphore/version'
4
+ require 'git/semaphore/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "git-semaphore"
8
8
  spec.version = Git::Semaphore::VERSION
9
9
  spec.authors = ["Peter Vandenberk"]
10
10
  spec.email = ["pvandenberk@mac.com"]
11
- spec.summary = ["git integration with https://semaphoreci.com"]
12
- spec.description = ["git integration with https://semaphoreci.com"]
11
+
12
+ spec.summary = %q{git integration with semaphoreci.com}
13
+ spec.description = %q{command-line integration with semaphoreci.com for git repositories}
13
14
  spec.homepage = "https://github.com/pvdb/git-semaphore"
14
15
  spec.license = "MIT"
15
16
 
16
- spec.files = `git ls-files`.split($/)
17
- spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
20
  spec.require_paths = ["lib"]
20
21
 
21
- spec.add_dependency('grit')
22
- spec.add_dependency('trollop')
22
+ spec.add_dependency "slop", "~> 3.0"
23
+ spec.add_dependency "grit", "~> 2.0"
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.12"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "minitest", "~> 5.0"
23
28
 
24
- spec.add_development_dependency('pry')
25
- spec.add_development_dependency('rake')
26
- spec.add_development_dependency('bundler')
27
- spec.add_development_dependency('cucumber')
28
- spec.add_development_dependency('rspec')
29
- spec.add_development_dependency('aruba')
30
- spec.add_development_dependency('methadone')
31
- spec.add_development_dependency('vcr')
32
- spec.add_development_dependency('webmock')
33
- spec.add_development_dependency('jazor')
34
- spec.add_development_dependency('json_spec')
29
+ spec.add_development_dependency "pry"
30
+ spec.add_development_dependency "pry-rescue"
35
31
  end