hotdog 1.20190725.0 → 1.20191028.0

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: '0699880ef57158626ee7638e7cc6266a878006b482254017d13788ce08cf310e'
4
- data.tar.gz: a4ac76092f199b6f375c5331ebee107b61f76659a03d101d40c8647989599223
3
+ metadata.gz: cc7f01237e5e718c19c91da270e2797c93f9a856a7523b606f191308db2e5dd6
4
+ data.tar.gz: f090618091d02d4a9b5b584b7abf7f0fbc2d3f2b6db022904cf4abd4af95c4c1
5
5
  SHA512:
6
- metadata.gz: 71d16dc1aabe0256baa77e107392b97a8e54a10f95859ef50067c7feb3c6004b24bc21cc4b33b87f54718123422d6fcf4c8d413f3b203e794adf566736a64491
7
- data.tar.gz: 47d88afa02e2558b7de9b16446a18c0d64d80870fe1bb3f8daa20c5914d485c0dcc13352b2e0512e002d1e58fe0c62bfe783e776f0408c1c663b4e05df49ecd9
6
+ metadata.gz: 8defb7bfc76397da0ec2f1fb508f8f55d2fec772a0ca58d66aff8b7abf15fdedde2851c0ac545a7a910ebb98eab36aec273ce187b366090b772103c671590865
7
+ data.tar.gz: b65b3a4e73f35768605ff26f9af42b17a095f8343a351261c0fce7df017a76bbad862c4ed7e829c43985d02fd762e3551219275161a5ae0cfce50df6a477e7a8
data/.travis.yml CHANGED
@@ -1,9 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.10
4
- - 2.2.6
5
- - 2.3.3
6
- - 2.4.0
3
+ - 2.4.6
4
+ - 2.5.5
5
+ - 2.6.3
7
6
  script:
8
7
  - rspec spec
9
8
  sudo: false
@@ -49,7 +49,7 @@ module Hotdog
49
49
  confdir: find_confdir(File.expand_path(".")),
50
50
  debug: false,
51
51
  expiry: 3600,
52
- fixed_string: false,
52
+ use_fallback: false,
53
53
  force: false,
54
54
  format: "text",
55
55
  headers: false,
@@ -80,16 +80,21 @@ module Hotdog
80
80
  attr_reader :source_provider
81
81
 
82
82
  def main(argv=[])
83
- config = File.join(options[:confdir], "config.yml")
84
- if File.file?(config)
85
- begin
86
- loaded = YAML.load(ERB.new(File.read(config)).result)
87
- rescue => error
88
- STDERR.puts("hotdog: failed to load configuration file at #{config.inspect}: #{error}")
89
- exit(1)
90
- end
91
- if Hash === loaded
92
- @options = @options.merge(Hash[loaded.map { |key, value| [Symbol === key ? key : key.to_s.to_sym, value] }])
83
+ [
84
+ File.join(options[:confdir], "config.yaml"),
85
+ File.join(options[:confdir], "config.yml"),
86
+ ].each do |config|
87
+ if File.file?(config)
88
+ begin
89
+ loaded = YAML.load(ERB.new(File.read(config)).result)
90
+ rescue => error
91
+ STDERR.puts("hotdog: failed to load configuration file at #{config.inspect}: #{error}")
92
+ exit(1)
93
+ end
94
+ if Hash === loaded
95
+ @options = @options.merge(Hash[loaded.map { |key, value| [Symbol === key ? key : key.to_s.to_sym, value] }])
96
+ end
97
+ break
93
98
  end
94
99
  end
95
100
  args = @optparse.order(argv)
@@ -217,8 +222,11 @@ module Hotdog
217
222
  @optparse.on("-d", "--[no-]debug", "Enable debug mode") do |v|
218
223
  options[:debug] = v
219
224
  end
220
- @optparse.on("--fixed-string", "Interpret pattern as fixed string") do |v|
221
- options[:fixed_string] = v
225
+ @optparse.on("--[no-]fixed-string", "Never fallback to alternative expression in case of result is empty. Inversed meaning as '--use-fallback'") do |v|
226
+ options[:use_fallback] = !v
227
+ end
228
+ @optparse.on("--[no-]use-fallback", "Fallback to alternative expressions in case of result is empty. Inversed meaning as '--fixed-string'") do |v|
229
+ options[:use_fallback] = v
222
230
  end
223
231
  @optparse.on("-f", "--[no-]force", "Enable force mode") do |v|
224
232
  options[:force] = v
@@ -28,8 +28,13 @@ module Hotdog
28
28
  execute_db(@db, q, args)
29
29
  end
30
30
 
31
+ def fallback?()
32
+ @options[:use_fallback]
33
+ end
34
+
31
35
  def fixed_string?()
32
- @options[:fixed_string]
36
+ # deprecated - superseded by `fallback?`
37
+ not @options[:use_fallback]
33
38
  end
34
39
 
35
40
  def reload(options={})
@@ -694,7 +694,7 @@ module Hotdog
694
694
  if options[:did_fallback]
695
695
  []
696
696
  else
697
- if not environment.fixed_string? and @options[:fallback]
697
+ if environment.use_fallback? and @options[:fallback]
698
698
  # avoid optimizing @options[:fallback] to prevent infinite recursion
699
699
  @options[:fallback].evaluate(environment, options.merge(did_fallback: true))
700
700
  else
@@ -1,3 +1,3 @@
1
1
  module Hotdog
2
- VERSION = "1.20190725.0"
2
+ VERSION = "1.20191028.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hotdog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.20190725.0
4
+ version: 1.20191028.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yamashita Yuu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-25 00:00:00.000000000 Z
11
+ date: 2019-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler