fasterer 0.5.1 → 0.6.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 510f476efb3c57b632222e209d478422d735fc5f
4
- data.tar.gz: a5ff22f0124e7d086c2ba7fd1f582d6da920f790
2
+ SHA256:
3
+ metadata.gz: f8497be57df6a101c8259f8909a2977b68727e0595de1c2b09bec0492b80d806
4
+ data.tar.gz: 7364812466aa12114dbada36fc6cb3865e4497478d60d8df0a4c4aad58f50d5d
5
5
  SHA512:
6
- metadata.gz: 640c39ea78eb3ffddb788f78a62eac73266625cba0e0445c08849298c64d2060a603af94eec14608c885f07bb46489435a50ff103b1216b7735a403be758fbc7
7
- data.tar.gz: b18f8ff9b5446321cd4899a87d6b9b22ae1ae06ba93d37c24f2bf719eb1e9b98e8d3a495c6583e430a088ba8771f804977ee3168a6e37ad9ad2459f17eb2dc26
6
+ metadata.gz: f8d177745b079e9b2608a698757165b595c0b9d25b4af28387194d8ecd308014487e19f228358fdcfdedfcfa3638846f23606b7b60c2bd9071a7f9a9b4946a50
7
+ data.tar.gz: a51a0dcc58688bb1bb2673543f9b2961381d9345e19f6e3c3fc0691eeea2c199792afeb6157303a45140962b4a9f034fd095c9bfc5fcd823725ba3611c1a7e80
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.0
4
+
5
+ - Enable placing the `.fasterer.yml` file not just in the current dir, but in any parent directory as well.
6
+
3
7
  ## 0.5.1
4
8
 
5
9
  - Upgrade to ruby_parser 3.13.0 that fully supports Ruby 2.6
data/README.md CHANGED
@@ -44,7 +44,8 @@ spec/cache/mem_cache_store_spec.rb:161 Use tr instead of gsub when grepping plai
44
44
  ```
45
45
  ## Configuration
46
46
 
47
- Configuration is done through the **.fasterer.yml** file placed in the root of your project.
47
+ Configuration is done through the **.fasterer.yml** file. This can placed in the root of your
48
+ project, or any ancestor folder.
48
49
 
49
50
  Options:
50
51
 
@@ -1,4 +1,5 @@
1
1
  require 'yaml'
2
+ require 'pathname'
2
3
 
3
4
  module Fasterer
4
5
  class Config
@@ -18,14 +19,22 @@ module Fasterer
18
19
 
19
20
  def file
20
21
  @file ||= begin
21
- return nil_file unless File.exist?(FILE_NAME)
22
+ return nil_file if file_location.nil?
22
23
  # Yaml.load_file returns false if the content is blank
23
- loaded = YAML.load_file(FILE_NAME) || nil_file
24
+ loaded = YAML.load_file(file_location) || nil_file
24
25
  # if the loaded file misses any of the two keys.
25
26
  loaded.merge!(nil_file) { |_k, v1, v2| v1 || v2 }
26
27
  end
27
28
  end
28
29
 
30
+ def file_location
31
+ @file_location ||=
32
+ Pathname(Dir.pwd)
33
+ .enum_for(:ascend)
34
+ .map { |dir| File.join(dir.to_s, FILE_NAME) }
35
+ .find { |f| File.exist?(f) }
36
+ end
37
+
29
38
  def nil_file
30
39
  { SPEEDUPS_KEY => {}, EXCLUDE_PATHS_KEY => [] }
31
40
  end
@@ -1,3 +1,3 @@
1
1
  module Fasterer
2
- VERSION = '0.5.1'
2
+ VERSION = '0.6.0'
3
3
  end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+ require 'pathname'
3
+
4
+ describe Fasterer::Config do
5
+ let(:root) { Pathname.new("#{File.dirname(__FILE__)}/../../..").cleanpath }
6
+ let(:expected_location) { "#{root}/.fasterer.yml" }
7
+
8
+ describe '#file_location' do
9
+ it 'returns a file that is in the current dir (eg the project root)' do
10
+ expect(described_class.new.file_location).to eq(expected_location)
11
+ end
12
+
13
+ it 'returns a file in an ancestor dir' do
14
+ Dir.chdir("#{root}/spec/lib") do
15
+ expect(described_class.new.file_location).to eq(expected_location)
16
+ end
17
+ end
18
+
19
+ it 'returns nil when there is no ancestor file' do
20
+ Dir.tmpdir do
21
+ expect(described_class.new.file_location).to be nil
22
+ end
23
+ end
24
+ end
25
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fasterer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damir Svrtan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-14 00:00:00.000000000 Z
11
+ date: 2019-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -168,6 +168,7 @@ files:
168
168
  - spec/lib/fasterer/analyzer/98_misc_spec.rb
169
169
  - spec/lib/fasterer/analyzer/99_exceptional_files_spec.rb
170
170
  - spec/lib/fasterer/cli_spec.rb
171
+ - spec/lib/fasterer/config_spec.rb
171
172
  - spec/lib/fasterer/file_traverser_spec.rb
172
173
  - spec/lib/fasterer/method_call_spec.rb
173
174
  - spec/lib/fasterer/method_definition_spec.rb
@@ -246,8 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
246
247
  - !ruby/object:Gem::Version
247
248
  version: '0'
248
249
  requirements: []
249
- rubyforge_project:
250
- rubygems_version: 2.5.1
250
+ rubygems_version: 3.0.1
251
251
  signing_key:
252
252
  specification_version: 4
253
253
  summary: Run Ruby more than fast. Fasterer
@@ -274,6 +274,7 @@ test_files:
274
274
  - spec/lib/fasterer/analyzer/98_misc_spec.rb
275
275
  - spec/lib/fasterer/analyzer/99_exceptional_files_spec.rb
276
276
  - spec/lib/fasterer/cli_spec.rb
277
+ - spec/lib/fasterer/config_spec.rb
277
278
  - spec/lib/fasterer/file_traverser_spec.rb
278
279
  - spec/lib/fasterer/method_call_spec.rb
279
280
  - spec/lib/fasterer/method_definition_spec.rb