phare 0.6 → 0.7

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: 15b3ee8b4694a9fa9c68c084483509a79b514186
4
- data.tar.gz: 96bc1409085eb987dc81f520cbc47e44381dfc2b
3
+ metadata.gz: 07cb8717d161d567751d2fc326c271fa8d865fe6
4
+ data.tar.gz: 934dfb629245a3d31d292959f402c65be527cb46
5
5
  SHA512:
6
- metadata.gz: 16c1bf55cf413dfaabce005af9eec64770dfe3eb7640f2f02f7650b60d9dbbfacb3954384f75eec7e77b534bc64207235ad2fefd9fa86cbb3eefdac27bc16e46
7
- data.tar.gz: fb2e07dff0f5bd49d282039497ac74cf8c9eafb2f41947bea26af8c75585a01eb0998c523caf176f7f31ba58f7a54438c4f58bdb1687ec6fd015e384c575edff
6
+ metadata.gz: 458a51f11e60f39e557cd10e84a2e9d5bf54546cd5584da14d576cb455b3a7d9bd06bd94ea45ef80dc5a3ab1451e79c981ed9f41d50b80dafa22c914f22e83d1
7
+ data.tar.gz: 327fadabf0c2e504c8130ca8f253635582f888bc4523528d222e6165dc6566bc1ef2f029bb9bdc55da3b5f0b8c3c9ba9fc7f681363a7fd80e6ade86e53e0b10c
data/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  ## Installation
14
14
 
15
- Add these lines to your application’s Gemfile as development dependancies:
15
+ Add these lines to your application’s `Gemfile` as development dependencies:
16
16
 
17
17
  ```ruby
18
18
  group :development do
@@ -23,11 +23,47 @@ group :development do
23
23
  end
24
24
  ```
25
25
 
26
+ ```shell
27
+ $ bundle install
28
+ ```
26
29
 
27
- If you wish to check for JavaScript code style using JSHint and JSCS, you must install them too:
30
+ If you wish to check for JavaScript code style using JSHint and JSCS, you must
31
+ specify them in your `package.json` file:
32
+
33
+ ```json
34
+ {
35
+ "name": "foo",
36
+ "version": "0.0.1",
37
+ "devDependencies": {
38
+ "jshint": "latest",
39
+ "jscs": "latest"
40
+ }
41
+ }
42
+ ```
28
43
 
29
- ```bash
30
- $ npm install -g jshint jscs
44
+ ```shell
45
+ $ npm install
46
+ ```
47
+
48
+ ### Shims
49
+
50
+ Phare uses top-level commands in its checks (eg. `$ rubocop` and not `$ bundle exec rubocop`).
51
+ You’ll need to run these commands in order to use the shims provided by either
52
+ Bundler or NPM.
53
+
54
+ #### Bundler
55
+
56
+ ```shell
57
+ $ bundle install
58
+ $ bundle binstub rubocop scss-lint
59
+ $ export PATH="./bin:$PATH"
60
+ ```
61
+
62
+ #### npm
63
+
64
+ ```shell
65
+ $ npm install
66
+ $ export PATH="./node_modules/.bin:$PATH"
31
67
  ```
32
68
 
33
69
  ## Usage
@@ -40,13 +76,23 @@ $ phare
40
76
 
41
77
  ### Version control hook
42
78
 
43
- One of the best ways to use Phare is by hooking it to your version control commit process. For example, with `git`:
79
+ One of the best ways to use Phare is by hooking it to your version control
80
+ commit process. For example, with `git`:
44
81
 
45
82
  ```bash
46
83
  $ bundle binstubs phare
47
84
  $ ln -s "`pwd`/bin/phare" .git/hooks/pre-commit
48
85
  ```
49
86
 
87
+ That way, every time `git commit` is ran, `phare` will be executed and the
88
+ commit will be aborted if there are some errors. However, you can skip this
89
+ check altogether by specifying `SKIP_PHARE=1` before your command.
90
+
91
+ ```bash
92
+ $ git commit -m 'Add stuff'
93
+ $ SKIP_PHARE=1 git commit -m 'Add stuff and I don’t care about Phare'
94
+ ```
95
+
50
96
  ### Options
51
97
 
52
98
  #### Command-line
data/lib/phare/check.rb CHANGED
@@ -32,7 +32,10 @@ module Phare
32
32
  end
33
33
 
34
34
  if @options[:diff]
35
- should_run &&= @tree.changed?
35
+ # NOTE: If the tree hasn't changed or if there is no files
36
+ # to check (e.g. they are all in the exclude list),
37
+ # we skip the check.
38
+ should_run &&= @tree.changed? && files_to_check.any?
36
39
  end
37
40
 
38
41
  should_run
@@ -40,6 +43,14 @@ module Phare
40
43
 
41
44
  protected
42
45
 
46
+ def excluded_files
47
+ @excluded_files ||= [Dir.glob(excluded_list || [])].flatten
48
+ end
49
+
50
+ def files_to_check
51
+ @files_to_check ||= @tree.changes - excluded_files
52
+ end
53
+
43
54
  def print_success_message
44
55
  Phare.puts('Everything looks good from here!')
45
56
  end
@@ -1,4 +1,7 @@
1
1
  # encoding: utf-8
2
+
3
+ require 'json'
4
+
2
5
  module Phare
3
6
  class Check
4
7
  class JSCS < Check
@@ -15,7 +18,7 @@ module Phare
15
18
 
16
19
  def command
17
20
  if @tree.changed?
18
- "jscs #{@tree.changes.join(' ')}"
21
+ "jscs #{files_to_check.join(' ')}"
19
22
  else
20
23
  "jscs #{@path}"
21
24
  end
@@ -23,6 +26,14 @@ module Phare
23
26
 
24
27
  protected
25
28
 
29
+ def excluded_list
30
+ configuration_file['excludeFiles']
31
+ end
32
+
33
+ def configuration_file
34
+ @configuration_file ||= File.exist?('.jscs.json') ? JSON.parse(File.read('.jscs.json')) : {}
35
+ end
36
+
26
37
  def binary_exists?
27
38
  !Phare.system_output('which jscs').empty?
28
39
  end
@@ -16,7 +16,7 @@ module Phare
16
16
 
17
17
  def command
18
18
  if @tree.changed?
19
- "jshint --config #{@config} --extra-ext #{@extensions.join(',')} #{@tree.changes.join(' ')}"
19
+ "jshint --config #{@config} --extra-ext #{@extensions.join(',')} #{files_to_check.join(' ')}"
20
20
  else
21
21
  "jshint --config #{@config} --extra-ext #{@extensions.join(',')} #{@glob}"
22
22
  end
@@ -24,6 +24,14 @@ module Phare
24
24
 
25
25
  protected
26
26
 
27
+ def excluded_list
28
+ configuration_file.split("\n") if configuration_file
29
+ end
30
+
31
+ def configuration_file
32
+ @configuration_file ||= File.exist?('.jshintignore') ? File.open('.jshintignore') : false
33
+ end
34
+
27
35
  def binary_exists?
28
36
  !Phare.system_output('which jshint').empty?
29
37
  end
@@ -12,7 +12,7 @@ module Phare
12
12
 
13
13
  def command
14
14
  if @tree.changed?
15
- "rubocop #{@tree.changes.join(' ')}"
15
+ "rubocop #{files_to_check.join(' ')}"
16
16
  else
17
17
  'rubocop'
18
18
  end
@@ -20,6 +20,14 @@ module Phare
20
20
 
21
21
  protected
22
22
 
23
+ def excluded_list
24
+ configuration_file['AllCops']['Exclude'] if configuration_file['AllCops'] && configuration_file['AllCops']['Exclude']
25
+ end
26
+
27
+ def configuration_file
28
+ @configuration_file ||= File.exist?('.rubocop.yml') ? YAML::load(File.open('.rubocop.yml')) : {}
29
+ end
30
+
23
31
  def binary_exists?
24
32
  !Phare.system_output('which rubocop').empty?
25
33
  end
@@ -14,7 +14,7 @@ module Phare
14
14
 
15
15
  def command
16
16
  if @tree.changed?
17
- "scss-lint #{@tree.changes.join(' ')}"
17
+ "scss-lint #{files_to_check.join(' ')}"
18
18
  else
19
19
  "scss-lint #{@path}"
20
20
  end
@@ -22,6 +22,14 @@ module Phare
22
22
 
23
23
  protected
24
24
 
25
+ def excluded_list
26
+ configuration_file['exclude']
27
+ end
28
+
29
+ def configuration_file
30
+ @configuration_file ||= File.exist?('.scss-lint.yml') ? YAML::load(File.open('.scss-lint.yml')) : {}
31
+ end
32
+
25
33
  def binary_exists?
26
34
  !Phare.system_output('which scss-lint').empty?
27
35
  end
@@ -25,7 +25,7 @@ module Phare
25
25
  if @options[:only].any?
26
26
  checks &= @options[:only]
27
27
  elsif @options[:skip]
28
- checks -= @options[:skip]
28
+ checks - @options[:skip]
29
29
  else
30
30
  checks
31
31
  end
data/lib/phare/cli.rb CHANGED
@@ -11,17 +11,14 @@ module Phare
11
11
  end
12
12
 
13
13
  def run
14
- if @env['SKIP_CODE_CHECK']
14
+ if @options[:version]
15
+ Phare.puts Phare::VERSION
16
+ exit 0
17
+ elsif @env['SKIP_CODE_CHECK'] || @env['SKIP_PHARE']
15
18
  Phare.banner 'Skipping code style checking… Really? Well alright then…'
16
19
  exit 0
17
20
  else
18
- if @suite.tap(&:run).status == 0
19
- Phare.banner 'Everything looks good, keep on committing!'
20
- exit 0
21
- else
22
- Phare.banner 'Something’s wrong with your code style. Please fix it before committing.'
23
- exit 1
24
- end
21
+ exit run_suite
25
22
  end
26
23
  end
27
24
 
@@ -43,12 +40,17 @@ module Phare
43
40
  options
44
41
  end
45
42
 
43
+ # rubocop:disable Metrics/AbcSize
46
44
  def parsed_options_from_arguments(argv)
47
45
  options_to_merge = {}
48
46
 
49
47
  OptionParser.new do |opts|
50
48
  opts.banner = 'Usage: phare [options]'
51
49
 
50
+ opts.on('--version', 'Display Phare’s version') do
51
+ options_to_merge[:version] = true
52
+ end
53
+
52
54
  opts.on('--directory', 'The directory in which to run the checks (default is the current directory') do |directory|
53
55
  options_to_merge[:directory] = directory
54
56
  end
@@ -64,11 +66,11 @@ module Phare
64
66
  opts.on('--diff', 'Only run checks on modified files') do
65
67
  options_to_merge[:diff] = true
66
68
  end
67
-
68
69
  end.parse! argv
69
70
 
70
71
  options_to_merge
71
72
  end
73
+ # rubocop:enable Metrics/AbcSize
72
74
 
73
75
  def parsed_options_from_yaml(file)
74
76
  options_to_merge = {}
@@ -85,5 +87,15 @@ module Phare
85
87
 
86
88
  options_to_merge
87
89
  end
90
+
91
+ def run_suite
92
+ if @suite.tap(&:run).status == 0
93
+ Phare.banner 'Everything looks good, keep on committing!'
94
+ 0
95
+ else
96
+ Phare.banner 'Something’s wrong with your code style. Please fix it before committing.'
97
+ 1
98
+ end
99
+ end
88
100
  end
89
101
  end
data/lib/phare/git.rb CHANGED
@@ -13,7 +13,7 @@ module Phare
13
13
  @changes ||= Phare.system_output('git status -s').split("\n").each_with_object([]) do |diff, memo|
14
14
  filename = diff.split(' ').last
15
15
 
16
- if diff =~ /^[^D]{2}/ && @extensions.include?(File.extname(filename))
16
+ if diff =~ /^[A|M].*/ && @extensions.include?(File.extname(filename))
17
17
  memo << filename
18
18
  else
19
19
  next
data/lib/phare/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Phare
2
- VERSION = '0.6'
2
+ VERSION = '0.7'
3
3
  end
data/phare.gemspec CHANGED
@@ -21,5 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency 'bundler', '~> 1.3'
22
22
  spec.add_development_dependency 'rake'
23
23
  spec.add_development_dependency 'rspec', '~> 3.0.0.rc1'
24
- spec.add_development_dependency 'rubocop', '0.22'
24
+ spec.add_development_dependency 'rubocop', '0.27'
25
25
  end
@@ -5,6 +5,7 @@ describe Phare::Check::JSCS do
5
5
 
6
6
  describe :should_run? do
7
7
  let(:check) { described_class.new('.') }
8
+
8
9
  before do
9
10
  expect(Phare).to receive(:system_output).with('which jscs').and_return(which_output)
10
11
  allow(File).to receive(:exist?).with(check.config).and_return(config_exists?)
@@ -15,7 +16,20 @@ describe Phare::Check::JSCS do
15
16
  let(:which_output) { 'jscs' }
16
17
  let(:config_exists?) { true }
17
18
  let(:path_exists?) { true }
19
+
18
20
  it { expect(check).to be_able_to_run }
21
+
22
+ context 'with only excluded files and the --diff option' do
23
+ let(:check) { described_class.new('.', diff: true) }
24
+ let(:files) { ['foo.js'] }
25
+
26
+ before do
27
+ expect(check).to receive(:excluded_files).and_return(files).once
28
+ expect(check.tree).to receive(:changes).and_return(files).at_least(:once)
29
+ end
30
+
31
+ it { expect(check.should_run?).to be_falsey }
32
+ end
19
33
  end
20
34
 
21
35
  context 'with unfound jscs command' do
@@ -24,7 +38,6 @@ describe Phare::Check::JSCS do
24
38
  let(:path_exists?) { false }
25
39
  it { expect(check).to_not be_able_to_run }
26
40
  end
27
-
28
41
  end
29
42
 
30
43
  describe :run do
@@ -54,13 +67,30 @@ describe Phare::Check::JSCS do
54
67
 
55
68
  context 'with --diff option' do
56
69
  let(:check) { described_class.new('.', diff: true) }
57
- let(:files) { ['foo.js', 'bar.js'] }
58
- let(:command) { "jscs #{files.join(' ')}" }
70
+ let(:files) { ['app/foo.js', 'bar.js'] }
59
71
  let(:jscs_exit_status) { 1337 }
60
72
 
61
- before { expect(check.tree).to receive(:changes).and_return(files).at_least(:once) }
73
+ context 'without exclusions' do
74
+ let(:command) { "jscs #{files.join(' ')}" }
62
75
 
63
- it { expect { run! }.to change { check.status }.to(jscs_exit_status) }
76
+ before do
77
+ expect(check.tree).to receive(:changes).and_return(files).at_least(:once)
78
+ expect(check).to receive(:excluded_files).and_return([]).once
79
+ end
80
+
81
+ it { expect { run! }.to change { check.status }.to(jscs_exit_status) }
82
+ end
83
+
84
+ context 'with exclusions' do
85
+ let(:command) { 'jscs bar.js' }
86
+
87
+ before do
88
+ expect(check).to receive(:excluded_files).and_return(['app/foo.js']).once
89
+ expect(check.tree).to receive(:changes).and_return(files).at_least(:once)
90
+ end
91
+
92
+ it { expect { run! }.to change { check.status }.to(jscs_exit_status) }
93
+ end
64
94
  end
65
95
  end
66
96
 
@@ -16,6 +16,18 @@ describe Phare::Check::JSHint do
16
16
  let(:config_exists?) { true }
17
17
  let(:path_exists?) { true }
18
18
  it { expect(check).to be_able_to_run }
19
+
20
+ context 'with only excluded files and the --diff option' do
21
+ let(:check) { described_class.new('.', diff: true) }
22
+ let(:files) { ['foo.js'] }
23
+
24
+ before do
25
+ expect(check).to receive(:excluded_files).and_return(files).once
26
+ expect(check.tree).to receive(:changes).and_return(files).at_least(:once)
27
+ end
28
+
29
+ it { expect(check.should_run?).to be_falsey }
30
+ end
19
31
  end
20
32
 
21
33
  context 'with unfound jshint command' do
@@ -32,8 +44,12 @@ describe Phare::Check::JSHint do
32
44
 
33
45
  context 'with available JSHint' do
34
46
  let(:command) { check.command }
47
+ let(:directory) { '.' }
48
+ let(:expanded_path) { '.jshintrc' }
35
49
 
36
50
  before do
51
+ expect(File).to receive(:expand_path).with("#{directory}app/assets/javascripts", anything).once.and_call_original
52
+ expect(File).to receive(:expand_path).with("#{directory}.jshintrc", anything).once.and_return(expanded_path)
37
53
  expect(check).to receive(:should_run?).and_return(true)
38
54
  expect(Phare).to receive(:system).with(command)
39
55
  expect(Phare).to receive(:last_exit_status).and_return(jshint_exit_status)
@@ -51,6 +67,34 @@ describe Phare::Check::JSHint do
51
67
  before { expect(Phare).to receive(:puts).with("Something went wrong. Program exited with #{jshint_exit_status}.") }
52
68
  it { expect { run! }.to change { check.status }.to(jshint_exit_status) }
53
69
  end
70
+
71
+ context 'with --diff option' do
72
+ let(:check) { described_class.new(directory, diff: true) }
73
+ let(:files) { ['app/foo.js', 'bar.js'] }
74
+ let(:jshint_exit_status) { 1337 }
75
+
76
+ context 'without exclusions' do
77
+ let(:command) { "jshint --config #{expanded_path} --extra-ext .js,.es6 #{files.join(' ')}" }
78
+
79
+ before do
80
+ expect(check.tree).to receive(:changes).and_return(files).at_least(:once)
81
+ expect(check).to receive(:excluded_files).and_return([]).once
82
+ end
83
+
84
+ it { expect { run! }.to change { check.status }.to(jshint_exit_status) }
85
+ end
86
+
87
+ context 'with exclusions' do
88
+ let(:command) { "jshint --config #{expanded_path} --extra-ext .js,.es6 bar.js" }
89
+
90
+ before do
91
+ expect(check).to receive(:excluded_files).and_return(['app/foo.js']).once
92
+ expect(check.tree).to receive(:changes).and_return(files).at_least(:once)
93
+ end
94
+
95
+ it { expect { run! }.to change { check.status }.to(jshint_exit_status) }
96
+ end
97
+ end
54
98
  end
55
99
 
56
100
  context 'with unavailable JSHint' do
@@ -10,6 +10,18 @@ describe Phare::Check::Rubocop do
10
10
  context 'with found rubocop command' do
11
11
  let(:which_output) { 'rubocop' }
12
12
  it { expect(check).to be_able_to_run }
13
+
14
+ context 'with only excluded files and the --diff option' do
15
+ let(:check) { described_class.new('.', diff: true) }
16
+ let(:files) { ['foo.rb'] }
17
+
18
+ before do
19
+ expect(check).to receive(:excluded_files).and_return(files).once
20
+ expect(check.tree).to receive(:changes).and_return(files).at_least(:once)
21
+ end
22
+
23
+ it { expect(check.should_run?).to be_falsey }
24
+ end
13
25
  end
14
26
 
15
27
  context 'with unfound rubocop command' do
@@ -46,12 +58,29 @@ describe Phare::Check::Rubocop do
46
58
  context 'with --diff option' do
47
59
  let(:check) { described_class.new('.', diff: true) }
48
60
  let(:files) { ['foo.rb', 'bar.rb'] }
49
- let(:command) { "rubocop #{files.join(' ')}" }
50
61
  let(:rubocop_exit_status) { 1337 }
51
62
 
52
- before { expect(check.tree).to receive(:changes).and_return(files).at_least(:once) }
63
+ context 'without exclusions' do
64
+ let(:command) { "rubocop #{files.join(' ')}" }
53
65
 
54
- it { expect { run! }.to change { check.status }.to(rubocop_exit_status) }
66
+ before do
67
+ expect(check.tree).to receive(:changes).and_return(files).at_least(:once)
68
+ expect(check).to receive(:excluded_files).and_return([]).once
69
+ end
70
+
71
+ it { expect { run! }.to change { check.status }.to(rubocop_exit_status) }
72
+ end
73
+
74
+ context 'with exclusions' do
75
+ let(:command) { 'rubocop bar.rb' }
76
+
77
+ before do
78
+ expect(check).to receive(:excluded_files).and_return(['foo.rb']).once
79
+ expect(check.tree).to receive(:changes).and_return(files).at_least(:once)
80
+ end
81
+
82
+ it { expect { run! }.to change { check.status }.to(rubocop_exit_status) }
83
+ end
55
84
  end
56
85
  end
57
86
 
@@ -14,6 +14,18 @@ describe Phare::Check::ScssLint do
14
14
  let(:which_output) { 'scss-lint' }
15
15
  let(:path_exists?) { true }
16
16
  it { expect(check).to be_able_to_run }
17
+
18
+ context 'with only excluded files and the --diff option' do
19
+ let(:check) { described_class.new('.', diff: true) }
20
+ let(:files) { ['foo.scss'] }
21
+
22
+ before do
23
+ expect(check).to receive(:excluded_files).and_return(files).once
24
+ expect(check.tree).to receive(:changes).and_return(files).at_least(:once)
25
+ end
26
+
27
+ it { expect(check.should_run?).to be_falsey }
28
+ end
17
29
  end
18
30
 
19
31
  context 'with unfound scss-lint command' do
@@ -51,13 +63,30 @@ describe Phare::Check::ScssLint do
51
63
 
52
64
  context 'with --diff option' do
53
65
  let(:check) { described_class.new('.', diff: true) }
54
- let(:files) { ['foo.css', 'bar.css.scss'] }
55
- let(:command) { "scss-lint #{files.join(' ')}" }
66
+ let(:files) { ['foo.rb', 'bar.rb'] }
56
67
  let(:scsslint_exit_status) { 1337 }
57
68
 
58
- before { expect(check.tree).to receive(:changes).and_return(files).at_least(:once) }
69
+ context 'without exclusions' do
70
+ let(:command) { "scss-lint #{files.join(' ')}" }
59
71
 
60
- it { expect { run! }.to change { check.status }.to(scsslint_exit_status) }
72
+ before do
73
+ expect(check.tree).to receive(:changes).and_return(files).at_least(:once)
74
+ expect(check).to receive(:excluded_files).and_return([]).once
75
+ end
76
+
77
+ it { expect { run! }.to change { check.status }.to(scsslint_exit_status) }
78
+ end
79
+
80
+ context 'with exclusions' do
81
+ let(:command) { 'scss-lint bar.rb' }
82
+
83
+ before do
84
+ expect(check).to receive(:excluded_files).and_return(['foo.rb']).once
85
+ expect(check.tree).to receive(:changes).and_return(files).at_least(:once)
86
+ end
87
+
88
+ it { expect { run! }.to change { check.status }.to(scsslint_exit_status) }
89
+ end
61
90
  end
62
91
  end
63
92
 
@@ -9,11 +9,26 @@ describe Phare::CLI do
9
9
  let(:env) { {} }
10
10
 
11
11
  describe :run do
12
- context 'with code check skipping' do
12
+ context 'with version flag' do
13
+ let(:cli) { described_class.new(env, ['--version']) }
14
+
15
+ before do
16
+ expect(Phare).to receive(:puts).with Phare::VERSION
17
+ end
18
+
19
+ it { expect { run! }.to exit_with_code(0) }
20
+ end
21
+
22
+ context 'with legacy code check skipping' do
13
23
  let(:env) { { 'SKIP_CODE_CHECK' => '1' } }
14
24
  it { expect { run! }.to exit_with_code(0) }
15
25
  end
16
26
 
27
+ context 'with code check skipping' do
28
+ let(:env) { { 'SKIP_PHARE' => '1' } }
29
+ it { expect { run! }.to exit_with_code(0) }
30
+ end
31
+
17
32
  context 'without code check skipping' do
18
33
  let(:env) { {} }
19
34
 
@@ -12,7 +12,7 @@ describe Phare::Git do
12
12
  before { expect(git).to receive(:changes).and_return(changes) }
13
13
 
14
14
  context 'with changes' do
15
- let(:changes) { ['foo.rb'] }
15
+ let(:changes) { %w(foo.rb) }
16
16
 
17
17
  it { expect(git.changed?).to eq(true) }
18
18
  end
@@ -37,31 +37,31 @@ describe Phare::Git do
37
37
  context 'with empty tree' do
38
38
  let(:tree) { '' }
39
39
 
40
- it { expect(git.changes).to eq([]) }
40
+ it { expect(git.changes).to be_empty }
41
41
  end
42
42
 
43
43
  context 'with untracked file' do
44
44
  let(:tree) { '?? foo.rb' }
45
45
 
46
- it { expect(git.changes).to eq(['foo.rb']) }
46
+ it { expect(git.changes).to be_empty }
47
47
  end
48
48
 
49
49
  context 'with added file' do
50
50
  let(:tree) { "A foo.rb\nAM bar.rb" }
51
51
 
52
- it { expect(git.changes).to eq(['foo.rb', 'bar.rb']) }
52
+ it { expect(git.changes).to match_array(%w(foo.rb bar.rb)) }
53
53
  end
54
54
 
55
55
  context 'with modified file' do
56
- let(:tree) { "M foo.rb\nDM bar.rb" }
56
+ let(:tree) { "M foo.rb\nDM bar.rb\n M foobar.rb" }
57
57
 
58
- it { expect(git.changes).to eq(['foo.rb']) }
58
+ it { expect(git.changes).to match_array(%w(foo.rb)) }
59
59
  end
60
60
 
61
61
  context 'with deleted file' do
62
- let(:tree) { " D foo.rb\nMD bar.rb" }
62
+ let(:tree) { " D foo.rb\nMD bar.rb\n D foobar.rb" }
63
63
 
64
- it { expect(git.changes).to eq([]) }
64
+ it { expect(git.changes).to match_array(%w(bar.rb)) }
65
65
  end
66
66
  end
67
67
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phare
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.6'
4
+ version: '0.7'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rémi Prévost
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-03 00:00:00.000000000 Z
11
+ date: 2015-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: '0.22'
61
+ version: '0.27'
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: '0.22'
68
+ version: '0.27'
69
69
  description: Phare looks into your files and check for (Ruby, JavaScript and SCSS)
70
70
  coding style errors.
71
71
  email:
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  version: '0'
124
124
  requirements: []
125
125
  rubyforge_project:
126
- rubygems_version: 2.2.2
126
+ rubygems_version: 2.4.5
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: Phare looks into your files and check for (Ruby, JavaScript and SCSS) coding