prospectus 0.0.13 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09e3eb70e15d9d758dfb44b958b5bc5a0c965abe
4
- data.tar.gz: 46af1179d96eaddefcae2f4873efa3925a96d200
3
+ metadata.gz: 80d2f6a11c582414c1d7051f1e8ddd58a0d38115
4
+ data.tar.gz: 8b63a427fb3a9e397587b84c7822377986591454
5
5
  SHA512:
6
- metadata.gz: 05ce7e4674f3337ac8aa392b33ee60e7d5c36bed6d9a1489d291c2a3b20d143a41b38c7c17aa4f0b78d7880f463ad057c82c63439b0fb86cbc54aa87b53f6f37
7
- data.tar.gz: 59ce1dc03534fbb9efe9d4618004a4f22ca3a2f6e9ff3359f97df1388a6cd67eb5d6efd72428b8bf23819c7e4c8322bc0af8e2ad9fcb9f66644205b95c1dbcdc
6
+ metadata.gz: f88e0dff9b17f94c793ae90c7596f460d7ec0d715a716f468b6f2e8d23ff50a8fba8382bb1554937099b7b538281d040f6b374b92d53e85ff68d081e4a3f6669
7
+ data.tar.gz: ea53724956a1632855b5a999e1aa4b48b2c30cb711e1f97b570745cd6bc4f3365e4013cba2234b5b38893288cb913f579b611e700afe8f5733136b26975ad09f
data/README.md CHANGED
@@ -112,7 +112,7 @@ end
112
112
 
113
113
  ### github_tag
114
114
 
115
- This checks the latest GitHub tag for a repo. Supports the Regex helper and uses the GitHub API helper for API access.
115
+ This checks the latest GitHub tag for a repo. Supports the Regex and Filter helpers and uses the GitHub API helper for API access.
116
116
 
117
117
  ```
118
118
  expected do
@@ -263,6 +263,21 @@ actual do
263
263
  end
264
264
  ```
265
265
 
266
+ ### filter
267
+
268
+ Allows filtering of available items. Useful for modules that must parse a list where you only care about some of the entries (like upstream repos that tag multiple packages in the same repo).
269
+
270
+ The provided argument is the regex pattern to filter the list with.
271
+
272
+ ```
273
+ # This filters out github tags that don't match the format 1.2.3
274
+ expected do
275
+ github_tag
276
+ repo 'foo/bar'
277
+ filter /^[\d.]+$/
278
+ end
279
+ ```
280
+
266
281
  ### chdir
267
282
 
268
283
  Used to chdir to a different directory before loading the state.
@@ -0,0 +1,20 @@
1
+ module LogCabin
2
+ module Modules
3
+ ##
4
+ # Use regex to filter out from a list of matches
5
+ module Filter
6
+ def filter_helper(list)
7
+ return list unless @filter_regex
8
+ new_list = list.select { |x| x =~ @filter_regex }
9
+ return new_list unless new_list.empty?
10
+ raise("No matches found in list: #{@filter_regex} / #{list}")
11
+ end
12
+
13
+ private
14
+
15
+ def filter(regex)
16
+ @filter_regex = regex
17
+ end
18
+ end
19
+ end
20
+ end
@@ -20,12 +20,18 @@ module LogCabin
20
20
  private
21
21
 
22
22
  def gitlab_token
23
+ @gitlab_token ||= token_from_file
23
24
  @gitlab_token ||= Keylime.new(
24
25
  server: gitlab_endpoint,
25
26
  account: 'prospectus'
26
27
  ).get!("GitLab API token (#{gitlab_endpoint}/profile/account)").password
27
28
  end
28
29
 
30
+ def token_from_file
31
+ return unless File.exist? File.expand_path('~/.gitlab_api')
32
+ File.read('~/.gitlab_api').strip
33
+ end
34
+
29
35
  def gitlab_endpoint
30
36
  @gitlab_endpoint ||= 'https://gitlab.com'
31
37
  end
@@ -8,6 +8,7 @@ module LogCabin
8
8
  module GithubTag
9
9
  include Prospectus.helpers.find(:regex)
10
10
  include Prospectus.helpers.find(:github_api)
11
+ include Prospectus.helpers.find(:filter)
11
12
 
12
13
  def load!
13
14
  raise('No repo specified') unless @repo
@@ -17,7 +18,8 @@ module LogCabin
17
18
  private
18
19
 
19
20
  def tag
20
- @tag ||= github_api.tags(@repo).first.name
21
+ return @tag if @tag
22
+ @tags = filter_helper(github_api.tags(@repo).map { |x| x[:name] }).first
21
23
  end
22
24
  end
23
25
  end
@@ -2,5 +2,5 @@
2
2
  ##
3
3
  # Declare package version
4
4
  module Prospectus
5
- VERSION = '0.0.13'.freeze
5
+ VERSION = '0.0.15'.freeze
6
6
  end
data/prospectus.gemspec CHANGED
@@ -20,9 +20,9 @@ Gem::Specification.new do |s|
20
20
  s.add_dependency 'mercenary', '~> 0.3.4'
21
21
  s.add_dependency 'logcabin', '~> 0.0.1'
22
22
 
23
- s.add_development_dependency 'rubocop', '~> 0.37.0'
24
- s.add_development_dependency 'rake', '~> 10.5.0'
23
+ s.add_development_dependency 'rubocop', '~> 0.41.1'
24
+ s.add_development_dependency 'rake', '~> 11.2.0'
25
25
  s.add_development_dependency 'codecov', '~> 0.1.1'
26
- s.add_development_dependency 'rspec', '~> 3.4.0'
26
+ s.add_development_dependency 'rspec', '~> 3.5.0'
27
27
  s.add_development_dependency 'fuubar', '~> 2.0.0'
28
28
  end
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.13
4
+ version: 0.0.15
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-02-19 00:00:00.000000000 Z
11
+ date: 2016-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mercenary
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.37.0
47
+ version: 0.41.1
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.37.0
54
+ version: 0.41.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 10.5.0
61
+ version: 11.2.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 10.5.0
68
+ version: 11.2.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: codecov
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 3.4.0
89
+ version: 3.5.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 3.4.0
96
+ version: 3.5.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: fuubar
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -127,6 +127,7 @@ files:
127
127
  - circle.yml
128
128
  - lib/prospectus.rb
129
129
  - lib/prospectus/helpers/chdir.rb
130
+ - lib/prospectus/helpers/filter.rb
130
131
  - lib/prospectus/helpers/github_api.rb
131
132
  - lib/prospectus/helpers/gitlab_api.rb
132
133
  - lib/prospectus/helpers/regex.rb