mini_cli 0.2.0 → 0.2.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: e651c358c7e330533b64d41a52eb013ba1d006c4
4
- data.tar.gz: 9f1b79c2d66967ea2267e4c576cff909e192e14d
3
+ metadata.gz: f7a4ea81e90dcbba4f6dc56ec6fd7951483009d7
4
+ data.tar.gz: c7870a9b8255d0247b29ae8fb158193891025362
5
5
  SHA512:
6
- metadata.gz: bfe8459a20e8fd1677e7ac098cce1a39deacdec15269542800b9ea47e98e2b460b7f5fbeec6fd006499e5f61184d85c09a8d9a66790cd4b7b50b2f90c6acfce3
7
- data.tar.gz: 7c49eedc7cc59d31e2ad384037db53025c39b6176d4521cc6729cdc895dc9ad395679d19b6cf4e8ca93f12169d29cf8497c16fb74e56418c03bfe301778a550b
6
+ metadata.gz: 62f6adc87996a0dd8aee972d1806165cef651f754268ba69d09c25e774bdafedec4801a59d6c23c704ebdf2b57a1d17986530fe8d33d4bff53434b2bb7100ed1
7
+ data.tar.gz: 5197e541818536e1dcb88cea2a3a25a6bb602d9ac03ae61d807db94763a238c7c67cde64066ef570d63af8c992023f86d0ca3f7f39df422d8e5efa2379e67f39
data/Gemfile.lock CHANGED
@@ -1,36 +1,42 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mini_cli (0.1.3)
4
+ mini_cli (0.2.1)
5
5
  puma (> 2.10, < 4.0.0)
6
6
  rerun (~> 0.10)
7
+ rubocop
7
8
  thor (~> 0.19)
8
9
 
9
10
  GEM
10
11
  remote: https://rubygems.org/
11
12
  specs:
13
+ ast (2.3.0)
12
14
  coderay (1.1.0)
13
15
  diff-lcs (1.2.5)
14
16
  ffi (1.9.10)
15
17
  gem-release (0.7.3)
16
18
  json (1.8.1)
17
- listen (3.0.5)
18
- rb-fsevent (>= 0.9.3)
19
- rb-inotify (>= 0.9)
19
+ listen (3.0.8)
20
+ rb-fsevent (~> 0.9, >= 0.9.4)
21
+ rb-inotify (~> 0.9, >= 0.9.7)
20
22
  method_source (0.8.2)
21
23
  mini_check (0.2.0)
22
24
  json
25
+ parser (2.3.1.2)
26
+ ast (~> 2.2)
27
+ powerpack (0.1.1)
23
28
  pry (0.10.1)
24
29
  coderay (~> 1.1.0)
25
30
  method_source (~> 0.8.1)
26
31
  slop (~> 3.4)
27
- puma (3.1.0)
32
+ puma (3.4.0)
28
33
  rack (1.5.2)
29
34
  rack-test (0.6.2)
30
35
  rack (>= 1.0)
36
+ rainbow (2.1.0)
31
37
  rake (10.4.2)
32
38
  rb-fsevent (0.9.7)
33
- rb-inotify (0.9.5)
39
+ rb-inotify (0.9.7)
34
40
  ffi (>= 0.5.0)
35
41
  rerun (0.11.0)
36
42
  listen (~> 3.0)
@@ -46,8 +52,16 @@ GEM
46
52
  rspec-mocks (3.1.3)
47
53
  rspec-support (~> 3.1.0)
48
54
  rspec-support (3.1.2)
55
+ rubocop (0.41.1)
56
+ parser (>= 2.3.1.1, < 3.0)
57
+ powerpack (~> 0.1)
58
+ rainbow (>= 1.99.1, < 3.0)
59
+ ruby-progressbar (~> 1.7)
60
+ unicode-display_width (~> 1.0, >= 1.0.1)
61
+ ruby-progressbar (1.8.1)
49
62
  slop (3.6.0)
50
63
  thor (0.19.1)
64
+ unicode-display_width (1.1.0)
51
65
 
52
66
  PLATFORMS
53
67
  ruby
@@ -63,7 +63,7 @@ module MiniCli
63
63
  desc 'rubocop', 'Runs rubocop'
64
64
  define_method :rubocop do |*args|
65
65
  require 'rubocop'
66
- exit(RuboCop::CLI.new.run)
66
+ exit(RuboCop::CLI.new.run args)
67
67
  end
68
68
  end
69
69
  end
@@ -1,3 +1,3 @@
1
1
  module MiniCli
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/mini_cli.gemspec CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_runtime_dependency 'thor', '~> 0.19'
24
24
  spec.add_runtime_dependency 'rerun', '~> 0.10'
25
25
  spec.add_runtime_dependency 'puma', '> 2.10', '< 4.0.0'
26
+ spec.add_runtime_dependency 'rubocop'
26
27
 
27
28
  spec.add_development_dependency "bundler", "~> 1.3"
28
29
  spec.add_development_dependency "rake", '~> 10.4'
@@ -2,70 +2,92 @@ require_relative '../spec_helper'
2
2
 
3
3
  describe Base do
4
4
  let(:cli){ Base.new }
5
+ before { allow(cli).to receive(:exit) }
6
+
7
+ def do_run
8
+ cli.invoke_command cli.class.all_commands[args.first], args[1..-1]
9
+ end
5
10
 
6
11
  describe '#test' do
7
- before { allow(cli).to receive(:exit) }
12
+ let(:args) { %w{test} }
8
13
 
9
14
  it 'runs the RSpec suite' do
10
15
  expect(RSpec::Core::Runner).to receive(:run)
11
- cli.test
16
+ do_run
12
17
  end
13
18
 
14
- it 'passes args to RSpec' do
15
- expect(RSpec::Core::Runner).to receive(:run).with(['random','args'])
16
- cli.test('random','args')
19
+ describe 'with args' do
20
+ let(:args) { %w{test random args} }
21
+
22
+ it 'passes args to RSpec' do
23
+ expect(RSpec::Core::Runner).to receive(:run).with(['random','args'])
24
+ do_run
25
+ end
17
26
  end
18
27
 
19
28
  it 'passes ["spec"] if no args are specified' do
20
29
  expect(RSpec::Core::Runner).to receive(:run).with(['spec'])
21
- cli.test
30
+ do_run
22
31
  end
23
32
 
24
33
  it 'exits with the returned status code' do
25
34
  expect(RSpec::Core::Runner).to receive(:run).and_return 99
26
35
  expect(cli).to receive(:exit).with 99
27
- cli.test
36
+ do_run
28
37
  end
29
38
  end
30
39
 
31
40
  describe '#console' do
41
+ let(:args) { %w{console} }
42
+
32
43
  it 'runs pry' do
33
44
  expect(Pry).to receive(:start)
34
- cli.console
45
+ do_run
35
46
  end
36
47
  end
37
48
 
38
49
  describe '#start' do
39
50
  before(:all){ require 'puma/cli' }
51
+ let(:args) { %w{start} }
40
52
 
41
53
  it 'runs a Puma server' do
42
54
  a_puma = double('a puma')
43
55
  expect(Puma::CLI).to receive(:new).with(['-p', '22000']).and_return a_puma
44
56
  expect(a_puma).to receive(:run)
45
- cli.start
57
+ do_run
46
58
  end
47
59
  end
48
60
 
49
61
  describe '#auto' do
50
62
  before(:all){ require 'rerun' }
63
+ let(:args) { %w{auto sample command} }
51
64
 
52
65
  it 'launches rerun with the given command' do
53
66
  expect(Rerun::Runner).to receive(:keep_running) do |command, options|
54
67
  expect(command).to eq './cli sample command'
55
68
  end
56
- cli.auto 'sample command'
69
+
70
+ do_run
57
71
  end
58
72
  end
59
73
 
60
74
  describe '#rubocop' do
61
75
  before(:all){ require 'rubocop' }
76
+ let(:args) { %w{rubocop some args} }
62
77
 
63
- it 'runs a Puma server' do
78
+ it 'runs rubocop' do
64
79
  a_cop = double('rubocop')
65
80
  expect(RuboCop::CLI).to receive(:new).and_return a_cop
66
81
  expect(a_cop).to receive(:run).and_return 99
67
82
  expect(cli).to receive(:exit).with 99
68
- cli.rubocop
83
+ do_run
84
+ end
85
+
86
+ it 'passes the args' do
87
+ a_cop = double('rubocop')
88
+ expect(RuboCop::CLI).to receive(:new).and_return a_cop
89
+ expect(a_cop).to receive(:run).with(['some', 'args'])
90
+ do_run
69
91
  end
70
92
  end
71
93
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Morales
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-27 00:00:00.000000000 Z
11
+ date: 2016-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -58,6 +58,20 @@ dependencies:
58
58
  - - "<"
59
59
  - !ruby/object:Gem::Version
60
60
  version: 4.0.0
61
+ - !ruby/object:Gem::Dependency
62
+ name: rubocop
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
61
75
  - !ruby/object:Gem::Dependency
62
76
  name: bundler
63
77
  requirement: !ruby/object:Gem::Requirement