prospectus 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -0
- data/lib/prospectus/helpers/gitlab_api.rb +34 -0
- data/lib/prospectus/modules/gitlab_tag.rb +34 -0
- data/lib/prospectus/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ac62931ea2ebb0b28856025b7312e5810aca8c1
|
4
|
+
data.tar.gz: e18b59b315bbbbf5fe878704af799a1ba3eaadf1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09f7b22522fe35672de8b61a482ec9460ee56a436f711a266723ae46bf8d2f33e482a4d2ac9acb8765071de01dd2813b5fd9f127fe84f2c6cb2f827ba9b5f916
|
7
|
+
data.tar.gz: 497154e7cd0a1b83e7d1e1001955363578fee01678d128fff35467a19b1123f7ed07bd51bf90dab227a5d00dacc4d8873fb553db19bf97e40eae55ba82c20f82
|
data/README.md
CHANGED
@@ -162,6 +162,17 @@ actual do
|
|
162
162
|
end
|
163
163
|
```
|
164
164
|
|
165
|
+
### gitlab_tag
|
166
|
+
|
167
|
+
Checks a repo on GitLab.com for its latest tag. Supports the regex helper.
|
168
|
+
|
169
|
+
```
|
170
|
+
actual do
|
171
|
+
gitlab_tag
|
172
|
+
repo 'procps-ng/procps'
|
173
|
+
end
|
174
|
+
```
|
175
|
+
|
165
176
|
### grep
|
166
177
|
|
167
178
|
This checks a local file's contents. Supports the Regex helper, and uses the provided regex pattern to match which line of the file to use. If no regex is specified, it will use the full first line of the file.
|
@@ -267,6 +278,10 @@ end
|
|
267
278
|
|
268
279
|
Used by modules to provide authenticated access to the GitHub API. Uses the [octoauth gem](https://github.com/akerl/octoauth)
|
269
280
|
|
281
|
+
### gitlab_api
|
282
|
+
|
283
|
+
Used by modules to provide access to GitLab's API, using [the gitlab gem](https://github.com/NARKOZ/gitlab)
|
284
|
+
|
270
285
|
## Installation
|
271
286
|
|
272
287
|
gem install prospectus
|
@@ -0,0 +1,34 @@
|
|
1
|
+
Prospectus.extra_dep('gitlab_api', 'keylime')
|
2
|
+
Prospectus.extra_dep('gitlab_api', 'gitlab')
|
3
|
+
|
4
|
+
module LogCabin
|
5
|
+
module Modules
|
6
|
+
##
|
7
|
+
# Provide an api method for modules to query GitLab
|
8
|
+
module GitlabApi
|
9
|
+
def gitlab_api
|
10
|
+
@gitlab_api ||= Gitlab.client(
|
11
|
+
endpoint: gitlab_endpoint,
|
12
|
+
private_token: gitlab_token
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
def gitlab_slug(repo)
|
17
|
+
repo.sub('/', '%2F')
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def gitlab_token
|
23
|
+
@gitlab_token ||= Keylime.new(
|
24
|
+
server: gitlab_endpoint,
|
25
|
+
account: 'prospectus'
|
26
|
+
).get!('GitLab API token (https://gitlab.com/profile/account)').password
|
27
|
+
end
|
28
|
+
|
29
|
+
def gitlab_endpoint
|
30
|
+
@gitlab_endpoint ||= 'https://gitlab.com/api/v3'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'open-uri'
|
3
|
+
|
4
|
+
Prospectus.extra_dep('gitlab_tag', 'version_sorter')
|
5
|
+
|
6
|
+
module LogCabin
|
7
|
+
module Modules
|
8
|
+
##
|
9
|
+
# Pull state from a Gitlab tag
|
10
|
+
module GitlabTag
|
11
|
+
include Prospectus.helpers.find(:regex)
|
12
|
+
include Prospectus.helpers.find(:gitlab_api)
|
13
|
+
|
14
|
+
def load!
|
15
|
+
fail('No repo specified') unless @repo
|
16
|
+
@state.value = regex_helper(tag)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def tag
|
22
|
+
VersionSorter.rsort(tags).first
|
23
|
+
end
|
24
|
+
|
25
|
+
def tags
|
26
|
+
@tags ||= gitlab_api.tags(gitlab_slug(@repo), per_page: 1).map(&:name)
|
27
|
+
end
|
28
|
+
|
29
|
+
def repo(value)
|
30
|
+
@repo = value
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/prospectus/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prospectus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Les Aker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mercenary
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- lib/prospectus.rb
|
129
129
|
- lib/prospectus/helpers/chdir.rb
|
130
130
|
- lib/prospectus/helpers/github_api.rb
|
131
|
+
- lib/prospectus/helpers/gitlab_api.rb
|
131
132
|
- lib/prospectus/helpers/regex.rb
|
132
133
|
- lib/prospectus/item.rb
|
133
134
|
- lib/prospectus/list.rb
|
@@ -137,6 +138,7 @@ files:
|
|
137
138
|
- lib/prospectus/modules/github_hash.rb
|
138
139
|
- lib/prospectus/modules/github_release.rb
|
139
140
|
- lib/prospectus/modules/github_tag.rb
|
141
|
+
- lib/prospectus/modules/gitlab_tag.rb
|
140
142
|
- lib/prospectus/modules/grep.rb
|
141
143
|
- lib/prospectus/modules/homebrew_cask.rb
|
142
144
|
- lib/prospectus/modules/homebrew_formula.rb
|