guard-inch 0.0.2 → 0.1.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
  SHA1:
3
- metadata.gz: 585657fc4e80818d0a013483312f7f14cc1ef817
4
- data.tar.gz: 469650b0104ed2df48ce92b39e2b106ca5e7c0aa
3
+ metadata.gz: c7d0c2af97d4c06943943aa99362760a689cb9c3
4
+ data.tar.gz: 00cfbf450fdf28ea20a494f85627ebc4a0370718
5
5
  SHA512:
6
- metadata.gz: babbf00c3eec92473b63da7c5fc2256d0f37328b7216fa7c089b7acaf7fa04254169de497e694fe0f968053fe98cd710499e090d5c5a337fc4779e9bdd5bc995
7
- data.tar.gz: b4591cb86231280d94399429998e6554f322311ccc00785e6a2890bda393befc4eae687a56fda299bdcf526f9791d01df89a636320512919f167b0206e76e4e7
6
+ metadata.gz: 086c614e9cd7a3a1f7895a76b0c6b70240c7baf3ccdb6a1e4b8acb7cc31a9a41d89f8e3fcbe22e5b4ae38462ec0f682e04ad97514171ab432ce22d5158d6d33e
7
+ data.tar.gz: b9d2535b9feb7ff52185c32d8239fe46cefcde435e4a489866c73bee6ce53a502b922341cef962ce4920626982f36781fb83a3fc730cf009921b0bfe4d4cc1da
data/README.md CHANGED
@@ -30,6 +30,24 @@ or
30
30
 
31
31
  and the tool will rerun `inch` on the files you are working with as you change them.
32
32
 
33
+ ## Options
34
+
35
+ Other options can be set in the Guardfile
36
+
37
+ guard :inch, pedantic: true, all_on_start: true, all_type: :stats do
38
+ watch(/.+\.rb/)
39
+ end
40
+
41
+ The above example shows use of several different options:
42
+
43
+ - pedantic: determines whether or not to use the pedantic flag for changed file runs
44
+ - all_on_start: determines whether or not to do a `run all` on startup
45
+ - all_type: specifies which run type should be used for `run all` with options mapping to those provided by inch
46
+
47
+ - :stats
48
+ - :list
49
+ - :suggest
50
+
33
51
  ## Contributing
34
52
 
35
53
  1. Fork it ( http://github.com/chills42/guard-inch/fork )
data/lib/guard/inch.rb CHANGED
@@ -6,10 +6,42 @@ module Guard
6
6
  class Inch < Plugin
7
7
  def initialize(options = {})
8
8
  super
9
+ @options = options
10
+ @all_on_start
11
+ @all_type = options[:all_type] || :none
9
12
  end
10
13
 
14
+ def start
15
+ message = 'Guard::Inch is running'
16
+ message << ' in pedantic mode' if options[:pedantic]
17
+ ::Guard::UI.info message
18
+ run_all if options[:all_on_start]
19
+ end
20
+
21
+ def run_all
22
+ return unless options[:all_type]
23
+ args = case options[:all_type]
24
+ when :stats
25
+ 'stats'
26
+ when :list
27
+ 'list'
28
+ when :suggest
29
+ 'suggest'
30
+ end
31
+ args << ' .'
32
+ run_inch args
33
+ end
11
34
  def run_on_changes(paths)
12
- puts `inch #{paths.join(' ')}`
35
+ flags = ''
36
+ flags << '--pedantic ' if options[:pedantic]
37
+ run_inch "#{flags} #{paths.join(' ')}"
38
+ end
39
+
40
+ private
41
+
42
+ # run the inch tool with the specified argument string
43
+ def run_inch(arg_string)
44
+ puts `inch #{arg_string}`
13
45
  end
14
46
  end
15
47
  end
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module InchVersion
3
- VERSION = "0.0.2"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-inch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig Hills
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-30 00:00:00.000000000 Z
11
+ date: 2014-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler