roper 1.0.0 → 1.1.0.rc1
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 +4 -4
- data/.travis.yml +4 -1
- data/README.md +58 -18
- data/exe/roper +8 -4
- data/front-image-attribution.md +2 -0
- data/lib/roper/cli.rb +9 -9
- data/lib/roper/hub.rb +16 -6
- data/lib/roper/version.rb +1 -1
- metadata +5 -5
- data/README.rdoc +0 -91
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ea211c5f6b2b1316f62193201dc8b10ade9ce06
|
4
|
+
data.tar.gz: 2a09346a0ee0f965d5f9ff255080205adc7a2f7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fb4bd06eff6100304952e3777e1d6f05e3b4980101332d1ad63edb187b33bfd66f61831312bad854f8ff96cf7382e5c9dcfb2e594d73d63e0fa863aa71935af
|
7
|
+
data.tar.gz: e5a4b47edf23667b2fe318800a8df836caaef93aa4ff745d2b38e50842eaca02cc564d46e53242b539ba06d625c92c890ec3be6c10f8199ed5ae4537d282bb70
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -2,13 +2,15 @@
|
|
2
2
|
|
3
3
|
<p align="center"><img src="Figure-eight_knot.svg"></p>
|
4
4
|
|
5
|
-
Roper is a
|
6
|
-
|
7
|
-
that traefik has been configured to run via the docker backend and that the
|
8
|
-
dockerized web application uses a docker-compose.yml file that knows how to
|
9
|
-
communicate with traefik.
|
5
|
+
Roper is a CLI tool used to help stage a Dockerized web app. It's name is
|
6
|
+
a play on it's two main commands (`lasso` and `release`).
|
10
7
|
|
11
|
-
|
8
|
+
There are some assumptions made about the environment that roper runs in. The
|
9
|
+
main one is that Traefik has been configured to run via the docker back-end and
|
10
|
+
that the Dockerized web application uses a `docker-compose.ym` file that knows
|
11
|
+
how to communicate with Traefik.
|
12
|
+
|
13
|
+
Another assumption made is that the repository for the web applications roper is
|
12
14
|
concerned with lives at GitHub: At this point I have no intention of supporting
|
13
15
|
another git repository service.
|
14
16
|
|
@@ -22,30 +24,45 @@ Once Roper is configured it knows how to:
|
|
22
24
|
status.
|
23
25
|
* When a PR is merged or closed the resources can be released/recovered.
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
Roper also defines the following environment variables which are made available
|
28
|
+
during the `docker-compose up` phase and can therefore be referenced in your
|
29
|
+
`docker-compose.yml` file
|
30
|
+
|
31
|
+
| variable | description |
|
32
|
+
| -------- | ------------|
|
33
|
+
| ROPER_REPO_OWNER | The GitHub repository owner |
|
34
|
+
| ROPER_REPO_NAME | The GitHub repository name |
|
35
|
+
| ROPER_REPO_BRANCH | The GitHub repository branch |
|
36
|
+
|
37
|
+
Currently, Roper only defines a CLI interface so there is no way for GitHub
|
38
|
+
to communicate with it directly via a web-hook or whatnot. It's assumed that it
|
39
|
+
will be used in conjunction with a service like Jenkins CI to handle the web-hook
|
40
|
+
part of the communication and trigger a roper staging on a desired GitHub event
|
29
41
|
(PR creation, update to PR, merge of PR).
|
30
42
|
|
31
43
|
Eventually it would be nice for Roper to include a web service interface that
|
32
|
-
GitHub can post
|
33
|
-
considering there are already good options for handling the
|
34
|
-
(i.e.
|
44
|
+
GitHub can post directly to. But then again, that might just be scope creep
|
45
|
+
considering there are already good options for handling the web-hook concern
|
46
|
+
(i.e. Jenkins)
|
35
47
|
|
36
48
|
## Installation
|
37
49
|
|
38
50
|
Add this line to your application's Gemfile:
|
39
51
|
|
40
|
-
```
|
52
|
+
```
|
53
|
+
ruby gem 'roper'
|
54
|
+
```
|
41
55
|
|
42
56
|
And then execute:
|
43
57
|
|
44
|
-
|
45
|
-
|
58
|
+
```
|
59
|
+
bundle
|
60
|
+
```
|
46
61
|
Or install it yourself as:
|
47
62
|
|
48
|
-
|
63
|
+
```
|
64
|
+
gem install roper
|
65
|
+
```
|
49
66
|
|
50
67
|
## Usage
|
51
68
|
|
@@ -57,8 +74,30 @@ OR:
|
|
57
74
|
|
58
75
|
You can use the individual components of the library as you wish.
|
59
76
|
|
77
|
+
## Configuration
|
78
|
+
`roper` is configure ready. Use `roper initconfig`. This command will create
|
79
|
+
a `.roper.rc` configuration file in your home directory. The file is in yaml
|
80
|
+
format and you can provide default arguments for any roper command.
|
81
|
+
|
82
|
+
The following `roper.rc` configuration file example provides a default value
|
83
|
+
for the repository:
|
84
|
+
|
85
|
+
```
|
86
|
+
---
|
87
|
+
:version: false
|
88
|
+
:help: false
|
89
|
+
commands:
|
90
|
+
:lasso:
|
91
|
+
:r: "tulibraries/tul_cob"
|
92
|
+
:release:
|
93
|
+
:r: "tulibraries/tul_cob"
|
94
|
+
```
|
95
|
+
|
96
|
+
|
60
97
|
## Github Authentication
|
61
|
-
Currenlty Roper uses netrc for github authentication. I'm hoping to slap an
|
98
|
+
Currenlty Roper uses netrc for github authentication. I'm hoping to slap an
|
99
|
+
interface to create this at setup but for now you will need to add a ~/.netrc
|
100
|
+
file with an entry for `api.github.com` manually.
|
62
101
|
|
63
102
|
## Development
|
64
103
|
|
@@ -72,6 +111,7 @@ release a new version, update the version number in `version.rb`, and then run
|
|
72
111
|
git commits and tags, and push the `.gem` file to
|
73
112
|
[rubygems.org](https://rubygems.org).
|
74
113
|
|
114
|
+
|
75
115
|
## Contributing
|
76
116
|
|
77
117
|
Bug reports and pull requests are welcome on GitHub at
|
data/exe/roper
CHANGED
@@ -5,10 +5,14 @@ require "roper"
|
|
5
5
|
|
6
6
|
include GLI::App
|
7
7
|
|
8
|
+
config_file ".roper.rc"
|
9
|
+
|
8
10
|
program_desc "Roper is a CLI tool used to help stage a dockerized web app."
|
9
11
|
|
10
12
|
version Roper::VERSION
|
11
13
|
|
14
|
+
flag [:nh, "no-hub", "disable-hub"], desc: "Do not interact with GitHub", default_value: false
|
15
|
+
|
12
16
|
subcommand_option_handling :normal
|
13
17
|
arguments :strict
|
14
18
|
sort_help :manually
|
@@ -19,8 +23,8 @@ command :lasso do |c|
|
|
19
23
|
c.flag :r, :repo
|
20
24
|
|
21
25
|
c.desc "The branch name"
|
22
|
-
c.flag :b, :branch
|
23
26
|
c.default_value "master"
|
27
|
+
c.flag :b, :branch
|
24
28
|
|
25
29
|
c.desc "The sha reference that we will post to"
|
26
30
|
c.flag :s, :sha
|
@@ -38,7 +42,7 @@ command :lasso do |c|
|
|
38
42
|
c.action do |global_options, options, args|
|
39
43
|
repo = options[:repo]
|
40
44
|
branch = options[:branch]
|
41
|
-
Roper::CLI.lasso(repo, branch, options)
|
45
|
+
Roper::CLI.lasso(repo, branch, global_options.merge(options))
|
42
46
|
puts "lasso command ran"
|
43
47
|
end
|
44
48
|
end
|
@@ -49,13 +53,13 @@ command :release do |c|
|
|
49
53
|
c.flag :r, :repo
|
50
54
|
|
51
55
|
c.desc "The branch name"
|
52
|
-
c.flag :b, :branch
|
53
56
|
c.default_value "master"
|
57
|
+
c.flag :b, :branch
|
54
58
|
|
55
59
|
c.action do |global_options, options, args|
|
56
60
|
repo = options[:repo]
|
57
61
|
branch = options[:branch]
|
58
|
-
Roper::CLI.release(repo, branch, options)
|
62
|
+
Roper::CLI.release(repo, branch, global_options.merge(options))
|
59
63
|
puts "release command ran"
|
60
64
|
end
|
61
65
|
end
|
data/lib/roper/cli.rb
CHANGED
@@ -10,15 +10,15 @@ module Roper
|
|
10
10
|
# library. It composes Hub, Repo and Driver to define the main entry
|
11
11
|
# methods, lasso and release.
|
12
12
|
class CLI
|
13
|
-
# @param [String] repo A GitHub
|
14
|
-
# @param [String] branch
|
15
|
-
# @param [Hash] options A customizable set of options
|
13
|
+
# @param [String] repo A GitHub repository in the form <user>/<name>
|
14
|
+
# @param [String] branch The name of a branch in the repository
|
16
15
|
#
|
17
|
-
# @
|
18
|
-
# @option
|
19
|
-
# @option
|
20
|
-
# @option
|
21
|
-
# @option
|
16
|
+
# @param [Hash] options A customizable set of options
|
17
|
+
# @option options [String] :context A context to differentiate this status from others (default: "roper")
|
18
|
+
# @option options [String] :status_url A link to more details about this status
|
19
|
+
# @option options [String] :sha ref The sha for a commit
|
20
|
+
# @option options [String] :protocol https or http
|
21
|
+
# @option options [String] :domain Domain for Traefik server
|
22
22
|
def initialize(repo, branch, options = {})
|
23
23
|
@repo = repo
|
24
24
|
@branch = branch
|
@@ -46,7 +46,7 @@ module Roper
|
|
46
46
|
# Update the GitHub PR with a pending status, then pull in the repository
|
47
47
|
# and build it by running docker-compose up on it
|
48
48
|
def lasso
|
49
|
-
@hub ||= Roper::Hub.
|
49
|
+
@hub ||= Roper::Hub.create(@repo, ref, @options)
|
50
50
|
@hub.create_status("pending", status_pending.merge(status_url))
|
51
51
|
begin
|
52
52
|
@git.mount || @git.update
|
data/lib/roper/hub.rb
CHANGED
@@ -22,15 +22,25 @@ module Roper
|
|
22
22
|
# @see https://octokit.github.io/octokit.rb/Octokit/Client/Statuses.html
|
23
23
|
#
|
24
24
|
# @param state [String] The state: pending, success, failure
|
25
|
-
# @param options [Hash] A customizable set of options
|
26
|
-
#
|
27
|
-
# @option :context [String] A context to differentiate this status from others (default: "roper")
|
28
|
-
# @option :target_url [String] A link to more details about this status
|
29
|
-
# @option :description [String] A short human-readable description of this status
|
30
25
|
#
|
31
|
-
# @
|
26
|
+
# @param options [Hash] A customizable set of options
|
27
|
+
# @option options [String] :target_url A link to the built site
|
28
|
+
# @option options [String] :description A short human-readable description of this status
|
32
29
|
def create_status(state, options = {})
|
33
30
|
@client.create_status(@repo, @ref, state, options.merge(context: "roper"))
|
34
31
|
end
|
32
|
+
|
33
|
+
def self.create(repo, ref, options = {})
|
34
|
+
if options["disable-hub"]
|
35
|
+
DumbHub.new(repo, ref)
|
36
|
+
else
|
37
|
+
self.new(repo, ref)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class DumbHub < Hub
|
43
|
+
def create_status(state, options = {})
|
44
|
+
end
|
35
45
|
end
|
36
46
|
end
|
data/lib/roper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.1.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Kinzer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docker-compose
|
@@ -283,11 +283,11 @@ files:
|
|
283
283
|
- Guardfile
|
284
284
|
- LICENSE.txt
|
285
285
|
- README.md
|
286
|
-
- README.rdoc
|
287
286
|
- Rakefile
|
288
287
|
- bin/console
|
289
288
|
- bin/setup
|
290
289
|
- exe/roper
|
290
|
+
- front-image-attribution.md
|
291
291
|
- lib/roper.rb
|
292
292
|
- lib/roper/cli.rb
|
293
293
|
- lib/roper/driver.rb
|
@@ -310,9 +310,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
310
310
|
version: '0'
|
311
311
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
312
312
|
requirements:
|
313
|
-
- - "
|
313
|
+
- - ">"
|
314
314
|
- !ruby/object:Gem::Version
|
315
|
-
version:
|
315
|
+
version: 1.3.1
|
316
316
|
requirements: []
|
317
317
|
rubyforge_project:
|
318
318
|
rubygems_version: 2.6.14
|
data/README.rdoc
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
= Roper {<img src="https://travis-ci.org/tulibraries/roper.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/tulibraries/roper] {<img src="https://coveralls.io/repos/github/tulibraries/roper/badge.svg?branch=master" alt="Coverage Status" />}[https://coveralls.io/github/tulibraries/roper?branch=master] {<img src="https://img.shields.io/badge/docs-rubydoc-blue.svg" alt="Docs" />}[http://www.rubydoc.info/github/tulibraries/roper/master]
|
2
|
-
|
3
|
-
rdoc-image:Figure-eight_knot.svg
|
4
|
-
|
5
|
-
Roper is a cli tool used to help stage a dockerized web app. There are some
|
6
|
-
assumptions made about the environment that roper runs in. The main one is
|
7
|
-
that traefik has been configured to run via the docker backend and that the
|
8
|
-
dockerized web application uses a docker-compose.yml file that knows how to
|
9
|
-
communicate with traefik.
|
10
|
-
|
11
|
-
Another assuption made is that the repository for the web applications roper is
|
12
|
-
concerned with lives at GitHub: At this point I have no intention of supporting
|
13
|
-
another git repository service.
|
14
|
-
|
15
|
-
Once Roper is configured it knows how to:
|
16
|
-
* Post to a GitHub branch PR with an in progress status for the
|
17
|
-
stage site setup.
|
18
|
-
* Pull in a repo locally.
|
19
|
-
* Checkout a specific branch.
|
20
|
-
* Start docker-compose session
|
21
|
-
* Post back to GitHub branch PR with link for QA site or failure
|
22
|
-
status.
|
23
|
-
* When a PR is merged or closed the resources can be released/recovered.
|
24
|
-
|
25
|
-
Currently, Roper only defines a cli interface so there is no way for GitHub to
|
26
|
-
communicate with it direclty via a webhook or whatnot. It's assumed that it
|
27
|
-
will be used in conjuction with a service like jenkins ci to handle the webook
|
28
|
-
part of the communication and trigger a roper staging on a desired Github event
|
29
|
-
(PR creation, update to PR, merge of PR).
|
30
|
-
|
31
|
-
Eventually it would be nice for Roper to include a web service interface that
|
32
|
-
GitHub can post direclty to. But then again, that might just be scope creep
|
33
|
-
considering there are already good options for handling the webhook concern
|
34
|
-
(i.e. jenkins)
|
35
|
-
|
36
|
-
== Installation
|
37
|
-
|
38
|
-
Add this line to your application's Gemfile:
|
39
|
-
|
40
|
-
ruby gem 'roper'
|
41
|
-
|
42
|
-
And then execute:
|
43
|
-
|
44
|
-
$ bundle
|
45
|
-
|
46
|
-
Or install it yourself as:
|
47
|
-
|
48
|
-
$ gem install roper
|
49
|
-
|
50
|
-
== Usage
|
51
|
-
|
52
|
-
roper lasso --repo=<user>/<repo> [--branch=<branch>] [--status_url=<url>]
|
53
|
-
|
54
|
-
roper release --repo=<user>/<repo>
|
55
|
-
|
56
|
-
OR:
|
57
|
-
|
58
|
-
You can use the individual components of the library as you wish.
|
59
|
-
|
60
|
-
== Github Authentication
|
61
|
-
Currenlty Roper uses netrc for github authentication. I'm hoping to slap an interface to create this at setup but for now you will need to add a ~/.netrc file with an entry for <tt>api.github.com</tt> manually.
|
62
|
-
|
63
|
-
== Development
|
64
|
-
|
65
|
-
After checking out the repo, run <tt>bin/setup</tt> to install dependencies. Then, run
|
66
|
-
<tt>rake spec</tt> to run the tests. You can also run <tt>bin/console</tt> for an interactive
|
67
|
-
prompt that will allow you to experiment.
|
68
|
-
|
69
|
-
To install this gem onto your local machine, run <tt>bundle exec rake install</tt>. To
|
70
|
-
release a new version, update the version number in <tt>version.rb</tt>, and then run
|
71
|
-
<tt>bundle exec rake release</tt>, which will create a git tag for the version, push
|
72
|
-
git commits and tags, and push the <tt>.gem</tt> file to
|
73
|
-
{rubygems.org}[https://rubygems.org].
|
74
|
-
|
75
|
-
== Contributing
|
76
|
-
|
77
|
-
Bug reports and pull requests are welcome on GitHub at
|
78
|
-
https://github.com/tulibraries/roper. This project is intended to be a safe,
|
79
|
-
welcoming space for collaboration, and contributors are expected to adhere to
|
80
|
-
the {Contributor Covenant}[http://contributor-covenant.org] code of conduct.
|
81
|
-
|
82
|
-
== License
|
83
|
-
|
84
|
-
The gem is available as open source under the terms of the {MIT
|
85
|
-
License}[http://opensource.org/licenses/MIT].
|
86
|
-
|
87
|
-
== Code of Conduct
|
88
|
-
|
89
|
-
Everyone interacting in the Roper project’s codebases, issue trackers, chat
|
90
|
-
rooms and mailing lists is expected to follow the {code of
|
91
|
-
conduct}[https://github.com/tulibraries/roper/blob/master/CODE_OF_CONDUCT.md].
|