aptible-tasks 0.3.0 → 0.3.1

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
2
  SHA1:
3
- metadata.gz: dca1da20e3741895059fa585d643c18c2e723dea
4
- data.tar.gz: a50de5358eca74d0d22f2faf1354f9df98f02ffa
3
+ metadata.gz: 782b492bc0392d17b93b628c4595ec9a13abaea7
4
+ data.tar.gz: bb8fb404236f673d30739285f30e3636060233c6
5
5
  SHA512:
6
- metadata.gz: c4d295a429baa117226a3a76b95e06d2540353b156438a16037dd5b62dd9bfe3577493524c4276c3e9358b250c64a14cb87491a343422683fddc0668918eaf98
7
- data.tar.gz: 3d95cc6e3dd85b67872ba62781a59b3269244ed61fc47c9a2194073cdd70ed315df3e24102031e80c792126dea6a8f340ca38fbd87919e277e1c0b4a30e72d5b
6
+ metadata.gz: 4afa304ff676316ca4f94d07daa2905578503e5b656b56b10662a07f6bf8f37df4851d5beddfcc4429b3e14d02b23ec1b3c9d448b3ba3aa0ffdaeaa38a3aceb7
7
+ data.tar.gz: 546c7f578b0a8366bdb75e88525609dd645e1c92ed4619275b7e61657a76397c1d3bc9ccfec4b64347bc28e16082ad6042ae551602fa60754377485a75e26e27
@@ -4,9 +4,22 @@ module Aptible
4
4
  module Tasks
5
5
  class Rubocop
6
6
  def config_file
7
+ project_config_file ||
7
8
  File.join(File.dirname(__FILE__), '..', '..', '..', '.rubocop.yml')
8
9
  end
9
10
 
11
+ def project_config_file(dir = Dir.pwd)
12
+ previous = File.expand_path('..', dir)
13
+ local_rubocop_yml = File.join(dir, '.rubocop.yml')
14
+ if File.exist?(local_rubocop_yml)
15
+ local_rubocop_yml
16
+ elsif previous == dir
17
+ nil
18
+ else
19
+ project_config_file(previous)
20
+ end
21
+ end
22
+
10
23
  def config
11
24
  ::Rubocop::ConfigLoader.load_file(config_file)
12
25
  end
@@ -1,5 +1,5 @@
1
1
  module Aptible
2
2
  module Tasks
3
- VERSION = '0.3.0'
3
+ VERSION = '0.3.1'
4
4
  end
5
5
  end
@@ -7,10 +7,28 @@ describe Aptible::Tasks::Rubocop do
7
7
 
8
8
  its(:config) { should be_a ::Rubocop::Config }
9
9
 
10
+ describe :project_config_file do
11
+ let!(:rubocop_yml) { File.join(Dir.pwd, '.rubocop.yml') }
12
+
13
+ it 'should return a local .rubocop.yml if present' do
14
+ expect(subject.project_config_file).to eq rubocop_yml
15
+ end
16
+
17
+ it 'should return a .rubocop.yml in a parent directory' do
18
+ FileUtils.cd 'spec'
19
+ expect(subject.project_config_file).to eq rubocop_yml
20
+ end
21
+
22
+ it 'should return nil if no file exists' do
23
+ File.stub(:exist?) { false }
24
+ expect(subject.project_config_file).to be_nil
25
+ end
26
+ end
27
+
10
28
  describe :config do
11
29
  it 'contains sane values' do
12
- subject.config['Documentation']['Enabled'].should be_false
13
- subject.config['AllCops']['Exclude'].should_not be_empty
30
+ expect(subject.config['Documentation']['Enabled']).to be_false
31
+ expect(subject.config['AllCops']['Exclude']).not_to be_empty
14
32
  end
15
33
  end
16
34
  end
@@ -12,7 +12,7 @@ describe 'rake rubocop' do
12
12
  its(:prerequisites) { should be_empty }
13
13
 
14
14
  it 'delegates to ::Rubocop.new.run' do
15
- rubocop.should_receive(:run)
15
+ expect(rubocop).to receive(:run)
16
16
  subject.invoke
17
17
  end
18
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aptible-tasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Macreery
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-02 00:00:00.000000000 Z
11
+ date: 2014-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  version: '0'
117
117
  requirements: []
118
118
  rubyforge_project:
119
- rubygems_version: 2.2.1
119
+ rubygems_version: 2.2.2
120
120
  signing_key:
121
121
  specification_version: 4
122
122
  summary: Shared Rake tasks for Aptible projects.