rspec-pgp_matchers 0.1.1 → 0.1.2

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
  SHA256:
3
- metadata.gz: 1880492b5a4864c566a6fa6004a9646d930d1ad232044384d3e6412b1e796891
4
- data.tar.gz: ae2aadaa6617b9243f1625f2e6b1b990ce00efd9b3da67c1d9a93d12f723092c
3
+ metadata.gz: c1ede8d3cd2fbc6cea19ba3d0c1dbce8cf0b390239869beec38fe4f6da3e607b
4
+ data.tar.gz: 6b090779819012e1697e460e78a41cc85d4eaa1687e24441a136f268ebc29c61
5
5
  SHA512:
6
- metadata.gz: f40aa2b0c66764c28b155e9540d581a89452b31fba2ecde2adf66a98e57ee3f6da210de4bebac78c3a62da8422aa1fc127f110c212045353b0f98abf0a047702
7
- data.tar.gz: 160c8706ecb7c149594faba75351ca6ff7c9c1a0ca1270a0aa17921902469baf30eff5fcb0bf28dc38e7d38a5826ef7c16426d682d25fbc5c1ef911e5520448e
6
+ metadata.gz: f30291f6f0f4eb68a1e3d42e5bdab7208722f4998a0d8e0c17edae16e903fb031864c94005c816aca76b8b52ad6b22b8b240c23708302f94f17220a34517f9be
7
+ data.tar.gz: 9e49089ab7d42085d1ac94d6807a83408010ba4c17665cb70040b12febb41f301f43cdd4d630f1c463450fdf7028bc7663064d2a78ad351c6bb0a052ee92d3db
data/.gitignore CHANGED
@@ -7,6 +7,7 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ /.rubocop-https--*
10
11
 
11
12
  # rspec failure tracking
12
13
  .rspec_status
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "ci/gpg"]
2
+ path = ci/gpg
3
+ url = https://github.com/riboseinc/gpg-build-scripts.git
data/.rubocop.yml CHANGED
@@ -3,10 +3,8 @@
3
3
  # All project-specific additions and overrides should be specified in this file.
4
4
 
5
5
  inherit_from:
6
- # Thoughtbot's style guide from: https://github.com/thoughtbot/guides
7
- - ".rubocop.tb.yml"
8
- # Overrides from Ribose
9
- - ".rubocop.ribose.yml"
6
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
7
+
10
8
  AllCops:
11
9
  DisplayCopNames: false
12
10
  StyleGuideCopsOnly: false
data/.travis.yml CHANGED
@@ -6,6 +6,7 @@ rvm:
6
6
  - "2.3"
7
7
  - "2.4"
8
8
  - "2.5"
9
+ - "2.6"
9
10
  - "ruby-head"
10
11
 
11
12
  env:
@@ -13,7 +14,6 @@ env:
13
14
  - GPG_VERSION="2.2"
14
15
 
15
16
  global:
16
- - DEPS_BUILD_DIR="${TRAVIS_BUILD_DIR}/build"
17
17
  - DEPS_PREFIX="${TRAVIS_BUILD_DIR}/opt"
18
18
  - GPG_PREFIX="${DEPS_PREFIX}/gpg"
19
19
 
@@ -44,15 +44,14 @@ cache:
44
44
 
45
45
  before_install:
46
46
  - mkdir -p ${DEPS_PREFIX}
47
- - pushd ci
47
+ - pushd ci/gpg
48
48
  - >
49
49
  [ -d "${GPG_PREFIX}" ] ||
50
- ./install_gpg_all.sh "${GPG_VERSION}"
51
- --build-dir "${DEPS_BUILD_DIR}/gpg"
50
+ ./install_gpg_all.sh
51
+ --suite-version "${GPG_VERSION}"
52
52
  --configure-opts "${GPG_CONFIGURE_OPTS}"
53
53
  --folding-style travis
54
54
  - popd
55
- - gem install bundler -v "~> 1.16"
56
55
 
57
56
  install:
58
57
  - bundle install --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
data/README.adoc CHANGED
@@ -123,6 +123,13 @@ number in `version.rb`, and then run `bundle exec rake release`, which
123
123
  will create a git tag for the version, push git commits and tags, and
124
124
  push the `.gem` file to https://rubygems.org[rubygems.org].
125
125
 
126
+ === Submodules
127
+
128
+ GnuPG is installed via scripts maintained in a sister repository
129
+ https://github.com/riboseinc/gpg-build-scripts[riboseinc/gpg-build-scripts],
130
+ and included here as a Git submodule. Learn more about submodules from
131
+ https://blog.github.com/2016-02-01-working-with-submodules/[The GitHub Blog].
132
+
126
133
  == Contributing
127
134
 
128
135
  Bug reports and pull requests are welcome on GitHub at
@@ -25,6 +25,8 @@ module RSpec
25
25
  enc_file = make_tempfile_containing(encrypted_string)
26
26
  cmd = gpg_decrypt_command(enc_file)
27
27
  run_command(cmd)
28
+ ensure
29
+ File.unlink(enc_file.path)
28
30
  end
29
31
 
30
32
  def run_verify(cleartext, signature_string)
@@ -32,14 +34,24 @@ module RSpec
32
34
  data_file = make_tempfile_containing(cleartext)
33
35
  cmd = gpg_verify_command(sig_file, data_file)
34
36
  run_command(cmd)
37
+ ensure
38
+ File.unlink(sig_file.path, data_file.path)
35
39
  end
36
40
 
37
41
  private
38
42
 
39
43
  def make_tempfile_containing(file_content)
40
- tempfile = Tempfile.new
41
- tempfile.write(file_content)
42
- tempfile.flush
44
+ # Tempfile.new instantiates Tempfile objects, and handles file
45
+ # deletion in various situations (i.e. object's finalizer), whereas
46
+ # Tempfile.create instantiates File objects, and leaves file deletion
47
+ # up to programmer.
48
+ #
49
+ # Tempfile's surprise file removals were among causes of race
50
+ # conditions, so let's go with the create method.
51
+ file = Tempfile.create("rspec-gpg-runner")
52
+ file.write(file_content)
53
+ file.close
54
+ file
43
55
  end
44
56
 
45
57
  def gpg_decrypt_command(enc_file)
@@ -3,6 +3,6 @@
3
3
 
4
4
  module RSpec
5
5
  module PGPMatchers
6
- VERSION = "0.1.1".freeze
6
+ VERSION = "0.1.2".freeze
7
7
  end
8
8
  end
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  spec.add_runtime_dependency "rspec-expectations", "~> 3.4"
31
31
 
32
- spec.add_development_dependency "bundler", "~> 1.16"
32
+ spec.add_development_dependency "bundler", ">= 1.16"
33
33
  spec.add_development_dependency "gpgme"
34
34
  spec.add_development_dependency "pry", ">= 0.10.3", "< 0.12"
35
35
  spec.add_development_dependency "rake", "~> 12.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-pgp_matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-25 00:00:00.000000000 Z
11
+ date: 2019-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-expectations
@@ -28,14 +28,14 @@ dependencies:
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.16'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.16'
41
41
  - !ruby/object:Gem::Dependency
@@ -109,10 +109,9 @@ extra_rdoc_files: []
109
109
  files:
110
110
  - ".editorconfig"
111
111
  - ".gitignore"
112
+ - ".gitmodules"
112
113
  - ".hound.yml"
113
114
  - ".rspec"
114
- - ".rubocop.ribose.yml"
115
- - ".rubocop.tb.yml"
116
115
  - ".rubocop.yml"
117
116
  - ".travis.yml"
118
117
  - Gemfile
@@ -129,8 +128,6 @@ files:
129
128
  - ci/gemfiles/rspec-3.5.gemfile
130
129
  - ci/gemfiles/rspec-3.6.gemfile
131
130
  - ci/gemfiles/rspec-3.7.gemfile
132
- - ci/install_gpg_all.sh
133
- - ci/install_gpg_component.sh
134
131
  - lib/rspec/pgp_matchers.rb
135
132
  - lib/rspec/pgp_matchers/be_a_pgp_encrypted_message.rb
136
133
  - lib/rspec/pgp_matchers/be_a_valid_pgp_signature_of.rb
data/.rubocop.ribose.yml DELETED
@@ -1,65 +0,0 @@
1
- AllCops:
2
- Include:
3
- - "**/*.rake"
4
- - "**/Gemfile"
5
- - "**/*.gemfile"
6
- - "**/Rakefile"
7
- Exclude:
8
- - "vendor/**/*"
9
- - "db/**/*"
10
- - "tmp/**/*"
11
- DisplayCopNames: false
12
- StyleGuideCopsOnly: false
13
- Rails:
14
- Enabled: true
15
- Metrics/AbcSize:
16
- Description: A calculated magnitude based on number of assignments, branches, and
17
- conditions.
18
- Enabled: true
19
- Max: 15
20
- Metrics/BlockLength:
21
- Exclude:
22
- - "spec/**/*"
23
- Metrics/BlockNesting:
24
- Description: Avoid excessive block nesting
25
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count
26
- Enabled: true
27
- Max: 3
28
- Metrics/ClassLength:
29
- Description: Avoid classes longer than 100 lines of code.
30
- Enabled: false
31
- CountComments: false
32
- Max: 100
33
- Metrics/CyclomaticComplexity:
34
- Description: A complexity metric that is strongly correlated to the number of test
35
- cases needed to validate a method.
36
- Enabled: true
37
- Max: 6
38
- Metrics/LineLength:
39
- Description: Limit lines to 80 characters.
40
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#80-character-limits
41
- Enabled: true
42
- Max: 80
43
- AllowURI: true
44
- URISchemes:
45
- - http
46
- - https
47
- Metrics/MethodLength:
48
- Description: Avoid methods longer than 10 lines of code.
49
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
50
- Enabled: true
51
- CountComments: true
52
- Max: 10
53
- Exclude:
54
- - "spec/**/*"
55
- Metrics/ParameterLists:
56
- Description: Avoid long parameter lists.
57
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
58
- Enabled: true
59
- Max: 5
60
- CountKeywordArgs: true
61
- Metrics/PerceivedComplexity:
62
- Description: A complexity metric geared towards measuring complexity for a human
63
- reader.
64
- Enabled: true
65
- Max: 7
data/.rubocop.tb.yml DELETED
@@ -1,650 +0,0 @@
1
- AllCops:
2
- Exclude:
3
- - db/schema.rb
4
-
5
- Naming/AccessorMethodName:
6
- Description: Check the naming of accessor methods for get_/set_.
7
- Enabled: false
8
-
9
- Style/Alias:
10
- Description: 'Use alias_method instead of alias.'
11
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#alias-method'
12
- Enabled: false
13
-
14
- Style/ArrayJoin:
15
- Description: 'Use Array#join instead of Array#*.'
16
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#array-join'
17
- Enabled: false
18
-
19
- Style/AsciiComments:
20
- Description: 'Use only ascii symbols in comments.'
21
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
22
- Enabled: false
23
-
24
- Naming/AsciiIdentifiers:
25
- Description: 'Use only ascii symbols in identifiers.'
26
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
27
- Enabled: false
28
-
29
- Style/Attr:
30
- Description: 'Checks for uses of Module#attr.'
31
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr'
32
- Enabled: false
33
-
34
- Metrics/BlockNesting:
35
- Description: 'Avoid excessive block nesting'
36
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
37
- Enabled: false
38
-
39
- Style/CaseEquality:
40
- Description: 'Avoid explicit use of the case equality operator(===).'
41
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-case-equality'
42
- Enabled: false
43
-
44
- Style/CharacterLiteral:
45
- Description: 'Checks for uses of character literals.'
46
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-character-literals'
47
- Enabled: false
48
-
49
- Style/ClassAndModuleChildren:
50
- Description: 'Checks style of children classes and modules.'
51
- Enabled: true
52
- EnforcedStyle: nested
53
-
54
- Metrics/ClassLength:
55
- Description: 'Avoid classes longer than 100 lines of code.'
56
- Enabled: false
57
-
58
- Metrics/ModuleLength:
59
- Description: 'Avoid modules longer than 100 lines of code.'
60
- Enabled: false
61
-
62
- Style/ClassVars:
63
- Description: 'Avoid the use of class variables.'
64
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-class-vars'
65
- Enabled: false
66
-
67
- Style/CollectionMethods:
68
- Enabled: true
69
- PreferredMethods:
70
- find: detect
71
- inject: reduce
72
- collect: map
73
- find_all: select
74
-
75
- Style/ColonMethodCall:
76
- Description: 'Do not use :: for method call.'
77
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#double-colons'
78
- Enabled: false
79
-
80
- Style/CommentAnnotation:
81
- Description: >-
82
- Checks formatting of special comments
83
- (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
84
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#annotate-keywords'
85
- Enabled: false
86
-
87
- Metrics/AbcSize:
88
- Description: >-
89
- A calculated magnitude based on number of assignments,
90
- branches, and conditions.
91
- Enabled: false
92
-
93
- Metrics/BlockLength:
94
- CountComments: true # count full line comments?
95
- Max: 25
96
- ExcludedMethods: []
97
- Exclude:
98
- - "spec/**/*"
99
-
100
- Metrics/CyclomaticComplexity:
101
- Description: >-
102
- A complexity metric that is strongly correlated to the number
103
- of test cases needed to validate a method.
104
- Enabled: false
105
-
106
- Rails/Delegate:
107
- Description: 'Prefer delegate method for delegations.'
108
- Enabled: false
109
-
110
- Style/PreferredHashMethods:
111
- Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
112
- StyleGuide: '#hash-key'
113
- Enabled: false
114
-
115
- Style/Documentation:
116
- Description: 'Document classes and non-namespace modules.'
117
- Enabled: false
118
-
119
- Style/DoubleNegation:
120
- Description: 'Checks for uses of double negation (!!).'
121
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-bang-bang'
122
- Enabled: false
123
-
124
- Style/EachWithObject:
125
- Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
126
- Enabled: false
127
-
128
- Style/EmptyLiteral:
129
- Description: 'Prefer literals to Array.new/Hash.new/String.new.'
130
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#literal-array-hash'
131
- Enabled: false
132
-
133
- # Checks whether the source file has a utf-8 encoding comment or not
134
- # AutoCorrectEncodingComment must match the regex
135
- # /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
136
- Style/Encoding:
137
- Enabled: false
138
-
139
- Style/EvenOdd:
140
- Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
141
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
142
- Enabled: false
143
-
144
- Naming/FileName:
145
- Description: 'Use snake_case for source file names.'
146
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
147
- Enabled: false
148
-
149
- Style/FrozenStringLiteralComment:
150
- Description: >-
151
- Add the frozen_string_literal comment to the top of files
152
- to help transition from Ruby 2.3.0 to Ruby 3.0.
153
- Enabled: false
154
-
155
- Style/FlipFlop:
156
- Description: 'Checks for flip flops'
157
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
158
- Enabled: false
159
-
160
- Style/FormatString:
161
- Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
162
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#sprintf'
163
- Enabled: false
164
-
165
- Style/GlobalVars:
166
- Description: 'Do not introduce global variables.'
167
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#instance-vars'
168
- Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
169
- Enabled: false
170
-
171
- Style/GuardClause:
172
- Description: 'Check for conditionals that can be replaced with guard clauses'
173
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
174
- Enabled: false
175
-
176
- Style/IfUnlessModifier:
177
- Description: >-
178
- Favor modifier if/unless usage when you have a
179
- single-line body.
180
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
181
- Enabled: false
182
-
183
- Style/IfWithSemicolon:
184
- Description: 'Do not use if x; .... Use the ternary operator instead.'
185
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs'
186
- Enabled: false
187
-
188
- Style/InlineComment:
189
- Description: 'Avoid inline comments.'
190
- Enabled: false
191
-
192
- Style/Lambda:
193
- Description: 'Use the new lambda literal syntax for single-line blocks.'
194
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#lambda-multi-line'
195
- Enabled: false
196
-
197
- Style/LambdaCall:
198
- Description: 'Use lambda.call(...) instead of lambda.(...).'
199
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc-call'
200
- Enabled: false
201
-
202
- Style/LineEndConcatenation:
203
- Description: >-
204
- Use \ instead of + or << to concatenate two string literals at
205
- line end.
206
- Enabled: false
207
-
208
- Metrics/LineLength:
209
- Description: 'Limit lines to 80 characters.'
210
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
211
- Max: 80
212
-
213
- Metrics/MethodLength:
214
- Description: 'Avoid methods longer than 10 lines of code.'
215
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
216
- Enabled: false
217
-
218
- Style/ModuleFunction:
219
- Description: 'Checks for usage of `extend self` in modules.'
220
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#module-function'
221
- Enabled: false
222
-
223
- Style/MultilineBlockChain:
224
- Description: 'Avoid multi-line chains of blocks.'
225
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
226
- Enabled: false
227
-
228
- Style/NegatedIf:
229
- Description: >-
230
- Favor unless over if for negative conditions
231
- (or control flow or).
232
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives'
233
- Enabled: false
234
-
235
- Style/NegatedWhile:
236
- Description: 'Favor until over while for negative conditions.'
237
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#until-for-negatives'
238
- Enabled: false
239
-
240
- Style/Next:
241
- Description: 'Use `next` to skip iteration instead of a condition at the end.'
242
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
243
- Enabled: false
244
-
245
- Style/NilComparison:
246
- Description: 'Prefer x.nil? to x == nil.'
247
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
248
- Enabled: false
249
-
250
- Style/Not:
251
- Description: 'Use ! instead of not.'
252
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bang-not-not'
253
- Enabled: false
254
-
255
- Style/NumericLiterals:
256
- Description: >-
257
- Add underscores to large numeric literals to improve their
258
- readability.
259
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics'
260
- Enabled: false
261
-
262
- Style/OneLineConditional:
263
- Description: >-
264
- Favor the ternary operator(?:) over
265
- if/then/else/end constructs.
266
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator'
267
- Enabled: false
268
-
269
- Naming/BinaryOperatorParameterName:
270
- Description: 'When defining binary operators, name the argument other.'
271
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg'
272
- Enabled: false
273
-
274
- Metrics/ParameterLists:
275
- Description: 'Avoid parameter lists longer than three or four parameters.'
276
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#too-many-params'
277
- Enabled: false
278
-
279
- Style/PercentLiteralDelimiters:
280
- Description: 'Use `%`-literal delimiters consistently'
281
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-literal-braces'
282
- Enabled: false
283
-
284
- Style/PerlBackrefs:
285
- Description: 'Avoid Perl-style regex back references.'
286
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
287
- Enabled: false
288
-
289
- Naming/PredicateName:
290
- Description: 'Check the names of predicate methods.'
291
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark'
292
- NamePrefixBlacklist:
293
- - is_
294
- Exclude:
295
- - spec/**/*
296
-
297
- Style/Proc:
298
- Description: 'Use proc instead of Proc.new.'
299
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc'
300
- Enabled: false
301
-
302
- Style/RaiseArgs:
303
- Description: 'Checks the arguments passed to raise/fail.'
304
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#exception-class-messages'
305
- Enabled: false
306
-
307
- Style/RegexpLiteral:
308
- Description: 'Use / or %r around regular expressions.'
309
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-r'
310
- Enabled: false
311
-
312
- Style/SelfAssignment:
313
- Description: >-
314
- Checks for places where self-assignment shorthand should have
315
- been used.
316
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
317
- Enabled: false
318
-
319
- Style/SingleLineBlockParams:
320
- Description: 'Enforces the names of some block params.'
321
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#reduce-blocks'
322
- Enabled: false
323
-
324
- Style/SingleLineMethods:
325
- Description: 'Avoid single-line methods.'
326
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-single-line-methods'
327
- Enabled: false
328
-
329
- Style/SignalException:
330
- Description: 'Checks for proper usage of fail and raise.'
331
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#fail-method'
332
- Enabled: false
333
-
334
- Style/SpecialGlobalVars:
335
- Description: 'Avoid Perl-style global variables.'
336
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms'
337
- Enabled: false
338
-
339
- Style/StringLiterals:
340
- Description: 'Checks if uses of quotes match the configured preference.'
341
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-string-literals'
342
- EnforcedStyle: double_quotes
343
- Enabled: true
344
-
345
- Style/TrailingCommaInArguments:
346
- Description: 'Checks for trailing comma in argument lists.'
347
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
348
- EnforcedStyleForMultiline: comma
349
- SupportedStylesForMultiline:
350
- - comma
351
- - consistent_comma
352
- - no_comma
353
- Enabled: true
354
-
355
- Style/TrailingCommaInArrayLiteral:
356
- Description: 'Checks for trailing comma in array literals.'
357
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
358
- EnforcedStyleForMultiline: comma
359
- SupportedStylesForMultiline:
360
- - comma
361
- - consistent_comma
362
- - no_comma
363
- Enabled: true
364
-
365
- Style/TrailingCommaInHashLiteral:
366
- Description: 'Checks for trailing comma in hash literals.'
367
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
368
- EnforcedStyleForMultiline: comma
369
- SupportedStylesForMultiline:
370
- - comma
371
- - consistent_comma
372
- - no_comma
373
- Enabled: true
374
-
375
- Style/TrivialAccessors:
376
- Description: 'Prefer attr_* methods to trivial readers/writers.'
377
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr_family'
378
- Enabled: false
379
-
380
- Style/VariableInterpolation:
381
- Description: >-
382
- Don't interpolate global, instance and class variables
383
- directly in strings.
384
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#curlies-interpolate'
385
- Enabled: false
386
-
387
- Style/WhenThen:
388
- Description: 'Use when x then ... for one-line cases.'
389
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#one-line-cases'
390
- Enabled: false
391
-
392
- Style/WhileUntilModifier:
393
- Description: >-
394
- Favor modifier while/until usage when you have a
395
- single-line body.
396
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier'
397
- Enabled: false
398
-
399
- Style/WordArray:
400
- Description: 'Use %w or %W for arrays of words.'
401
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w'
402
- Enabled: false
403
-
404
- # Layout
405
-
406
- Layout/AlignParameters:
407
- Description: 'Here we check if the parameters on a multi-line method call or definition are aligned.'
408
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-double-indent'
409
- Enabled: false
410
-
411
- Layout/ConditionPosition:
412
- Description: >-
413
- Checks for condition placed in a confusing position relative to
414
- the keyword.
415
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
416
- Enabled: false
417
-
418
- Layout/DotPosition:
419
- Description: 'Checks the position of the dot in multi-line method calls.'
420
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
421
- EnforcedStyle: trailing
422
-
423
- Layout/ExtraSpacing:
424
- Description: 'Do not use unnecessary spacing.'
425
- Enabled: true
426
-
427
- Layout/MultilineOperationIndentation:
428
- Description: >-
429
- Checks indentation of binary operations that span more than
430
- one line.
431
- Enabled: true
432
- EnforcedStyle: indented
433
-
434
- Layout/MultilineMethodCallIndentation:
435
- Description: >-
436
- Checks indentation of method calls with the dot operator
437
- that span more than one line.
438
- Enabled: true
439
- EnforcedStyle: indented
440
-
441
- Layout/InitialIndentation:
442
- Description: >-
443
- Checks the indentation of the first non-blank non-comment line in a file.
444
- Enabled: false
445
-
446
- # Lint
447
-
448
- Lint/AmbiguousOperator:
449
- Description: >-
450
- Checks for ambiguous operators in the first argument of a
451
- method invocation without parentheses.
452
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-as-args'
453
- Enabled: false
454
-
455
- Lint/AmbiguousRegexpLiteral:
456
- Description: >-
457
- Checks for ambiguous regexp literals in the first argument of
458
- a method invocation without parenthesis.
459
- Enabled: false
460
-
461
- Lint/AssignmentInCondition:
462
- Description: "Don't use assignment in conditions."
463
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition'
464
- Enabled: false
465
-
466
- Lint/CircularArgumentReference:
467
- Description: "Don't refer to the keyword argument in the default value."
468
- Enabled: false
469
-
470
- Lint/DeprecatedClassMethods:
471
- Description: 'Check for deprecated class method calls.'
472
- Enabled: false
473
-
474
- Lint/DuplicatedKey:
475
- Description: 'Check for duplicate keys in hash literals.'
476
- Enabled: false
477
-
478
- Lint/EachWithObjectArgument:
479
- Description: 'Check for immutable argument given to each_with_object.'
480
- Enabled: false
481
-
482
- Lint/ElseLayout:
483
- Description: 'Check for odd code arrangement in an else block.'
484
- Enabled: false
485
-
486
- Lint/FormatParameterMismatch:
487
- Description: 'The number of parameters to format/sprint must match the fields.'
488
- Enabled: false
489
-
490
- Lint/HandleExceptions:
491
- Description: "Don't suppress exception."
492
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
493
- Enabled: false
494
-
495
- Lint/LiteralAsCondition:
496
- Description: 'Checks of literals used in conditions.'
497
- Enabled: false
498
-
499
- Lint/LiteralInInterpolation:
500
- Description: 'Checks for literals used in interpolation.'
501
- Enabled: false
502
-
503
- Lint/Loop:
504
- Description: >-
505
- Use Kernel#loop with break rather than begin/end/until or
506
- begin/end/while for post-loop tests.
507
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break'
508
- Enabled: false
509
-
510
- Lint/NestedMethodDefinition:
511
- Description: 'Do not use nested method definitions.'
512
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-methods'
513
- Enabled: false
514
-
515
- Lint/NonLocalExitFromIterator:
516
- Description: 'Do not use return in iterator to cause non-local exit.'
517
- Enabled: false
518
-
519
- Lint/ParenthesesAsGroupedExpression:
520
- Description: >-
521
- Checks for method calls with a space before the opening
522
- parenthesis.
523
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
524
- Enabled: false
525
-
526
- Lint/RequireParentheses:
527
- Description: >-
528
- Use parentheses in the method call to avoid confusion
529
- about precedence.
530
- Enabled: false
531
-
532
- Lint/UnderscorePrefixedVariableName:
533
- Description: 'Do not use prefix `_` for a variable that is used.'
534
- Enabled: false
535
-
536
- Lint/UnneededCopDisableDirective:
537
- Description: >-
538
- Checks for rubocop:disable comments that can be removed.
539
- Note: this cop is not disabled when disabling all cops.
540
- It must be explicitly disabled.
541
- Enabled: false
542
-
543
- Lint/Void:
544
- Description: 'Possible use of operator/literal/variable in void context.'
545
- Enabled: false
546
-
547
- # Performance
548
-
549
- Performance/CaseWhenSplat:
550
- Description: >-
551
- Place `when` conditions that use splat at the end
552
- of the list of `when` branches.
553
- Enabled: false
554
-
555
- Performance/Count:
556
- Description: >-
557
- Use `count` instead of `select...size`, `reject...size`,
558
- `select...count`, `reject...count`, `select...length`,
559
- and `reject...length`.
560
- Enabled: false
561
-
562
- Performance/Detect:
563
- Description: >-
564
- Use `detect` instead of `select.first`, `find_all.first`,
565
- `select.last`, and `find_all.last`.
566
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
567
- Enabled: false
568
-
569
- Performance/FlatMap:
570
- Description: >-
571
- Use `Enumerable#flat_map`
572
- instead of `Enumerable#map...Array#flatten(1)`
573
- or `Enumberable#collect..Array#flatten(1)`
574
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
575
- Enabled: false
576
-
577
- Performance/ReverseEach:
578
- Description: 'Use `reverse_each` instead of `reverse.each`.'
579
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
580
- Enabled: false
581
-
582
- Performance/Sample:
583
- Description: >-
584
- Use `sample` instead of `shuffle.first`,
585
- `shuffle.last`, and `shuffle[Fixnum]`.
586
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
587
- Enabled: false
588
-
589
- Performance/Size:
590
- Description: >-
591
- Use `size` instead of `count` for counting
592
- the number of elements in `Array` and `Hash`.
593
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code'
594
- Enabled: false
595
-
596
- Performance/StringReplacement:
597
- Description: >-
598
- Use `tr` instead of `gsub` when you are replacing the same
599
- number of characters. Use `delete` instead of `gsub` when
600
- you are deleting characters.
601
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
602
- Enabled: false
603
-
604
- # Rails
605
-
606
- Rails/ActionFilter:
607
- Description: 'Enforces consistent use of action filter methods.'
608
- Enabled: false
609
-
610
- Rails/Date:
611
- Description: >-
612
- Checks the correct usage of date aware methods,
613
- such as Date.today, Date.current etc.
614
- Enabled: false
615
-
616
- Rails/FindBy:
617
- Description: 'Prefer find_by over where.first.'
618
- Enabled: false
619
-
620
- Rails/FindEach:
621
- Description: 'Prefer all.find_each over all.find.'
622
- Enabled: false
623
-
624
- Rails/HasAndBelongsToMany:
625
- Description: 'Prefer has_many :through to has_and_belongs_to_many.'
626
- Enabled: false
627
-
628
- Rails/Output:
629
- Description: 'Checks for calls to puts, print, etc.'
630
- Enabled: false
631
-
632
- Rails/ReadWriteAttribute:
633
- Description: >-
634
- Checks for read_attribute(:attr) and
635
- write_attribute(:attr, val).
636
- Enabled: false
637
-
638
- Rails/ScopeArgs:
639
- Description: 'Checks the arguments of ActiveRecord scopes.'
640
- Enabled: false
641
-
642
- Rails/TimeZone:
643
- Description: 'Checks the correct usage of time zone aware methods.'
644
- StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
645
- Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
646
- Enabled: false
647
-
648
- Rails/Validation:
649
- Description: 'Use validates :attribute, hash of validations.'
650
- Enabled: false
@@ -1,137 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Popular combinations of GPG software versions.
4
- #
5
- # For v2.2: https://gist.github.com/vt0r/a2f8c0bcb1400131ff51
6
- # For v2.1: https://gist.github.com/mattrude/3883a3801613b048d45b
7
- #
8
- # USAGE:
9
- # ./install_gpg_all.sh <version> [<options>]
10
- #
11
- # EXAMPLE
12
- # ./install_gpg_all.sh 2.2
13
-
14
- set -e
15
-
16
- readonly __progname=$(basename $0)
17
-
18
- errx() {
19
- echo -e "$__progname: $@" >&2
20
- exit 1
21
- }
22
-
23
- usage() {
24
- echo "usage: $__progname [-t <TEMP_BUILD_DIR>] [-i <GPG_VERSION>] [-d]"
25
- echo ""
26
- echo " Options:"
27
- echo " -d for dry run, not building GPG components."
28
- echo " -i to select the GPG version to install [major.minor], defaults to `latest`."
29
- echo " - `latest`: latest version of GnuPG."
30
- echo " - `x.y`: specific version x.y of GnuPG, e.g. `2.2`."
31
- echo " - `master`: build from GnuPG git master branch."
32
- echo " -h to display this message"
33
- echo ""
34
- echo " Arguments can also be set via environment variables: "
35
- echo " - TEMP_BUILD_DIR"
36
- echo " - GPG_VERSION"
37
- exit 1
38
- }
39
-
40
- prequisites_yum() {
41
- yum install -y bzip2 gcc make sudo
42
- }
43
-
44
- detect_platform() {
45
- # Determine OS platform
46
- DISTRO=$(awk -F= '/^NAME/{print $2}' /etc/os-release | tr -d \")
47
- echo "$DISTRO"
48
- }
49
-
50
- main() {
51
-
52
- while getopts ":t:idh" o; do
53
- case "${o}" in
54
- t)
55
- readonly local TEMP_BUILD_DIR=1
56
- ;;
57
- i)
58
- readonly local GPG_VERSION=${OPTARG}
59
- ;;
60
- d)
61
- readonly local DRYRUN=1
62
- ;;
63
- h)
64
- usage
65
- ;;
66
- *)
67
- usage
68
- ;;
69
- esac
70
- done
71
-
72
- if [ "x$GPG_VERSION" == "x" ]; then
73
- GPG_VERSION="latest"
74
- fi
75
-
76
- [[ ! "$TEMP_BUILD_DIR" ]] && \
77
- TEMP_BUILD_DIR="$(mktemp -d)"
78
-
79
- DISTRO="$(detect_platform)"
80
-
81
- case $DISTRO in
82
- "CentOS Linux")
83
- echo "Installing CentOS yum dependencies"
84
- prequisites_yum
85
- ;;
86
- esac
87
-
88
- case "$GPG_VERSION" in
89
- "2.2")
90
- ./install_gpg_component.sh --component libgpg-error --version 1.31 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
91
- ./install_gpg_component.sh --component libgcrypt --version 1.8.2 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
92
- ./install_gpg_component.sh --component libassuan --version 2.5.1 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
93
- ./install_gpg_component.sh --component libksba --version 1.3.5 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
94
- ./install_gpg_component.sh --component npth --version 1.5 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
95
- ./install_gpg_component.sh --component pinentry --version 1.1.0 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
96
- ./install_gpg_component.sh --component gnupg --version 2.2.7 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
97
- ;;
98
- "2.1")
99
- ./install_gpg_component.sh --component libgpg-error --version 1.27 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
100
- ./install_gpg_component.sh --component libgcrypt --version 1.7.6 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
101
- ./install_gpg_component.sh --component libassuan --version 2.4.3 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
102
- ./install_gpg_component.sh --component libksba --version 1.3.5 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
103
- ./install_gpg_component.sh --component npth --version 1.2 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
104
- ./install_gpg_component.sh --component pinentry --version 0.9.5 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
105
- ./install_gpg_component.sh --component gnupg --version 2.1.20 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
106
- ;;
107
- "latest")
108
- ./install_gpg_component.sh --component libgpg-error --version latest --build-dir "$TEMP_BUILD_DIR" "${@:2}"
109
- ./install_gpg_component.sh --component libgcrypt --version latest --build-dir "$TEMP_BUILD_DIR" "${@:2}"
110
- ./install_gpg_component.sh --component libassuan --version latest --build-dir "$TEMP_BUILD_DIR" "${@:2}"
111
- ./install_gpg_component.sh --component libksba --version latest --build-dir "$TEMP_BUILD_DIR" "${@:2}"
112
- ./install_gpg_component.sh --component npth --version latest --build-dir "$TEMP_BUILD_DIR" "${@:2}"
113
- ./install_gpg_component.sh --component pinentry --version latest --build-dir "$TEMP_BUILD_DIR" "${@:2}"
114
- ./install_gpg_component.sh --component gnupg --version latest --build-dir "$TEMP_BUILD_DIR" "${@:2}"
115
- ;;
116
- "master")
117
- ./install_gpg_component.sh --component libgpg-error --version master --git --build-dir "$TEMP_BUILD_DIR" "${@:2}"
118
- ./install_gpg_component.sh --component libgcrypt --version master --git --build-dir "$TEMP_BUILD_DIR" "${@:2}"
119
- ./install_gpg_component.sh --component libassuan --version master --git --build-dir "$TEMP_BUILD_DIR" "${@:2}"
120
- ./install_gpg_component.sh --component libksba --version master --git --build-dir "$TEMP_BUILD_DIR" "${@:2}"
121
- ./install_gpg_component.sh --component npth --version master --git --build-dir "$TEMP_BUILD_DIR" "${@:2}"
122
- ./install_gpg_component.sh --component pinentry --version master --git --build-dir "$TEMP_BUILD_DIR" "${@:2}"
123
- ./install_gpg_component.sh --component gnupg --version master --git --build-dir "$TEMP_BUILD_DIR" "${@:2}"
124
- ;;
125
- esac
126
-
127
- cat <<DONE
128
- +-------------------+
129
- | INSTALL COMPLETE! |
130
- +-------------------+
131
- DONE
132
-
133
- }
134
-
135
- main "$@"
136
-
137
- exit 0
@@ -1,301 +0,0 @@
1
- #!/usr/bin/env bash
2
- #
3
-
4
- ######################
5
- # ARGUMENTS HANDLING #
6
- ######################
7
-
8
- print_help ()
9
- {
10
- cat <<HELP
11
- USAGE
12
-
13
- install_gpg_component.rb <options>
14
-
15
- EXAMPLES
16
-
17
- # Installing latest version of libgpg-error
18
- install_gpg_component.rb --component libgpg-error --version latest
19
-
20
- # Installing latest version of libgpg-error with sudo
21
- install_gpg_component.rb --component libgpg-error --version latest --sudo
22
-
23
- # Installing latest git revision of libgpg-error
24
- install_gpg_component.rb --component libgpg-error --version master --git
25
-
26
- # Passing options to ./configure script
27
- install_gpg_component.rb --component libgpg-error --version latest --configure-opts "--disable-doc --exec-prefix=/my/bin"
28
-
29
- OPTIONS
30
-
31
- --component COMPONENT
32
- Component to install
33
-
34
- --version VERSION
35
- Component version to install (use "latest" for the latest release),
36
- or git ref (branch, tag, commit hash etc.) when used with "--git"
37
- option (typically "master").
38
-
39
- --[no-]git
40
- Fetch source code from git repository instead of downloading release,
41
- pass branch or tag name to --version argument. By default it is off.
42
-
43
- --[no-]sudo
44
- Whether to do 'sudo make install', or just 'make install'.
45
- Doesn't affect post install steps, which may require sudo. By default
46
- it is off.
47
-
48
- --configure-opts OPTS
49
- Options to be passed to "./configure" script.
50
-
51
- --build-dir DIR
52
- Directory in which the compilation will happen. Content may be
53
- overwritten during build. Directory will be created if non-existent.
54
-
55
- --folding-style STYLE
56
- If set, enables output folding. STYLE defines the folding notation
57
- used. Following STYLE values are recognized:
58
-
59
- "none"
60
- Disable folding. This is default.
61
-
62
- "travis"
63
- Fold output for Travis CI builds. See this example Travis job:
64
- https://api.travis-ci.org/v3/job/15440998/log.txt
65
-
66
- --help, -h
67
- Displays this message
68
-
69
- HELP
70
- }
71
-
72
- set_default_options()
73
- {
74
- _arg_build_dir=
75
- _arg_configure_opts=
76
- _arg_sudo="off"
77
- _arg_git="off"
78
- _arg_color="off"
79
- _arg_folding_style="none"
80
- }
81
-
82
- parse_cli_arguments()
83
- {
84
- while test $# -gt 0
85
- do
86
- case "$1" in
87
- --component)
88
- _arg_component="$2"
89
- shift
90
- shift
91
- ;;
92
- --version)
93
- _arg_version="$2"
94
- shift
95
- shift
96
- ;;
97
- --build-dir)
98
- _arg_build_dir="$2"
99
- shift
100
- shift
101
- ;;
102
- --configure-opts)
103
- _arg_configure_opts="$2"
104
- shift
105
- shift
106
- ;;
107
- --sudo)
108
- _arg_sudo="on"
109
- shift
110
- ;;
111
- --no-sudo)
112
- _arg_sudo="off"
113
- shift
114
- ;;
115
- --git)
116
- _arg_git="on"
117
- shift
118
- ;;
119
- --no-git)
120
- _arg_git="off"
121
- shift
122
- ;;
123
- --folding-style)
124
- _arg_folding_style="$2"
125
- shift
126
- shift
127
- ;;
128
- -h|--help)
129
- print_help
130
- exit 0
131
- ;;
132
- *)
133
- echo "Unrecognized option: $1, exiting."
134
- exit 1
135
- esac
136
- done
137
- }
138
-
139
- ######################
140
- # BUILDING #
141
- ######################
142
-
143
- display_config()
144
- {
145
- cat <<CONFIG
146
- component: "${_arg_component}"
147
- version: "${_arg_version}"
148
- git: "${_arg_git}"
149
- sudo: "${_arg_sudo}"
150
- build_dir: "${_arg_build_dir}"
151
- configure_options: "${_arg_configure_opts}"
152
-
153
- CONFIG
154
- }
155
-
156
- # Consults https://versions.gnupg.org/swdb.lst and assigns the most recent
157
- # version of component ${_arg_component} to ${_arg_version} variable.
158
- determine_latest_version()
159
- {
160
- fold_start "component.${_arg_component}.detect-latest"
161
- local _component_underscored=`echo "${_arg_component}" | tr - _`
162
- _arg_version=`curl "https://versions.gnupg.org/swdb.lst" | grep "_ver" | grep -v "w32" | sort --reverse | grep "${_component_underscored}" | head -n 1 | cut -d " " -f 2`
163
- echo "The latest version of ${_arg_component} is ${_arg_version}."
164
- fold_end "component.${_arg_component}.fetch"
165
- }
166
-
167
- fetch_source()
168
- {
169
- fold_start "component.${_arg_component}.fetch"
170
- if [[ "${_arg_git}" = "on" ]]; then
171
- fetch_from_git
172
- else
173
- fetch_release
174
- fi
175
- fold_end "component.${_arg_component}.fetch"
176
- }
177
-
178
- fetch_release()
179
- {
180
- local _tarball_file_name="${_arg_component}-${_arg_version}.tar.bz2"
181
- local _tarball_url="https://gnupg.org/ftp/gcrypt/${_arg_component}/${_tarball_file_name}"
182
- curl ${_tarball_url} --remote-name --retry 5
183
- tar -xjf ${_tarball_file_name}
184
- rm ${_tarball_file_name}
185
- set_component_build_dir "${_arg_component}-${_arg_version}"
186
- }
187
-
188
- fetch_from_git()
189
- {
190
- local _git_url="git://git.gnupg.org/${_arg_component}"
191
- set_component_build_dir "${_arg_component}-git-${_arg_version}"
192
-
193
- if [ ! -d "${_component_build_dir}" ]; then
194
- git clone ${_git_url} "${_component_build_dir}"
195
- else
196
- pushd "${_component_build_dir}"
197
- git fetch # need to fetch prior checkout, ref may be nonexistent locally
198
- popd
199
- fi
200
-
201
- pushd "${_component_build_dir}"
202
- git checkout ${_arg_version}
203
- git pull # in case of outdated local branch
204
- popd
205
- }
206
-
207
- build_and_install()
208
- {
209
- pushd "${_component_build_dir}"
210
- if [ ! -f configure ]; then
211
- fold_start "component.${_arg_component}.autogen"
212
- ./autogen.sh
213
- fold_end "component.${_arg_component}.autogen"
214
- fi
215
- fold_start "component.${_arg_component}.configure"
216
- ./configure ${_arg_configure_opts}
217
- fold_end "component.${_arg_component}.configure"
218
- fold_start "component.${_arg_component}.build"
219
- make > /dev/null
220
- fold_end "component.${_arg_component}.build"
221
- fold_start "component.${_arg_component}.install"
222
- sudo make install > /dev/null
223
- fold_end "component.${_arg_component}.install"
224
- popd
225
- }
226
-
227
- set_component_build_dir()
228
- {
229
- _component_build_dir=$1
230
- }
231
-
232
- header()
233
- {
234
- echo ""
235
- echo ""
236
- echo "=== $1 ==="
237
- echo ""
238
- echo ""
239
- }
240
-
241
- ######################
242
- # PRETTY OUTPUT #
243
- ######################
244
-
245
- fold_start()
246
- {
247
- case "${_arg_folding_style}" in
248
- travis)
249
- echo "travis_fold:start:$1"
250
- ;;
251
- *)
252
- ;;
253
- esac
254
- }
255
-
256
- fold_end()
257
- {
258
- case "${_arg_folding_style}" in
259
- travis)
260
- echo "travis_fold:end:$1"
261
- ;;
262
- *)
263
- ;;
264
- esac
265
- }
266
-
267
- ######################
268
- # MAIN #
269
- ######################
270
-
271
- set -e # Early exit if any command returns non-zero status code
272
-
273
- set_default_options
274
- parse_cli_arguments "$@"
275
-
276
- fold_start "component.${_arg_component}"
277
-
278
- header "Installing ${_arg_component} / ${_arg_version}"
279
-
280
- display_config
281
-
282
- # set -x # From now, print every command to STDOUT
283
-
284
- if [[ "${_arg_version}" =~ ^latest ]]; then
285
- determine_latest_version
286
- fi
287
-
288
- mkdir -p ${_arg_build_dir}
289
- pushd ${_arg_build_dir}
290
- fetch_source
291
- build_and_install
292
- popd # _arg_build_dir
293
-
294
- if [[ "${_arg_component}" =~ ^gnupg ]]; then
295
- fold_start "component.${_arg_component}.post-install"
296
- sudo tee -a /etc/ld.so.conf.d/gpg2.conf <<<"/usr/local/lib"
297
- sudo ldconfig -v
298
- fold_end "component.${_arg_component}.post-install"
299
- fi
300
-
301
- fold_end "component.${_arg_component}"