guard-rubybeautify 0.90.0 → 0.90.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 +4 -4
- data/README.md +11 -0
- data/WHATSNEW.md +2 -0
- data/lib/guard/rubybeautify/version.rb +1 -1
- data/lib/guard/rubybeautify.rb +23 -20
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d62ceacb441d0b41d7794856247b838694448a0
|
4
|
+
data.tar.gz: 6d482e3b5abb2e1b423a3e74d3cf45ddd3c9d7c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2886e2ace088d8c678e32c4ba3702ff22e8b888484c000ce055f8131d8ab3284eaec01d7e79b1739c83c156a2b477c90450afa6656a2c0d175e064f3a2a34e57
|
7
|
+
data.tar.gz: d9a5ca41bb48deb3d1989f6ab43ab01c9519770688bda95d49a1703d742b15a8358da2c4ace72263bd2b74b0ef27dfefdc94a21cb93c2c49b22188ef3dbfda70
|
data/README.md
CHANGED
@@ -36,6 +36,17 @@ or call
|
|
36
36
|
|
37
37
|
to have a section added automatically.
|
38
38
|
|
39
|
+
### Options
|
40
|
+
|
41
|
+
This guard also comes with three options built in:
|
42
|
+
* count: 1 # The count of indent chars.
|
43
|
+
* style: :tabs # the type, tab or spaces.
|
44
|
+
* grace_period: 5 # amount of time to not trigger further beautifies (stops loops).
|
45
|
+
|
46
|
+
`grace_period` is the only one that is unique to this gem. It's the period of time to *not* monitor for changes. Since the gem will trigger an overwrite, this can trigger specs and doc generation. Which then trigger more beautifies, that trigger more of the other guards.
|
47
|
+
|
48
|
+
To avoid this, set this to a period longer then a single modification runs. Since this has no global mode, you don't need to worry about what happens when you press `enter`. It will only impact open files that are saved.
|
49
|
+
|
39
50
|
## Development
|
40
51
|
|
41
52
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/WHATSNEW.md
ADDED
data/lib/guard/rubybeautify.rb
CHANGED
@@ -2,27 +2,30 @@ require "guard/rubybeautify/version"
|
|
2
2
|
require 'guard/compat/plugin'
|
3
3
|
|
4
4
|
module Guard
|
5
|
-
|
6
|
-
|
5
|
+
class Rubybeautify < Plugin
|
6
|
+
attr_accessor :count, :style, :grace_period
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
@
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
def initialize(options = {})
|
9
|
+
super
|
10
|
+
@last_run = 0
|
11
|
+
@options = {
|
12
|
+
grace_period: 5,
|
13
|
+
count: 1,
|
14
|
+
style: :tabs
|
15
|
+
}.merge(options)
|
16
|
+
end
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
def run_on_modifications(paths)
|
19
|
+
if @last_run + options[:grace_period] < Time.now.to_i
|
20
|
+
paths.each do |file|
|
21
|
+
Compat::UI.info "Ruby beautify executed against: #{Guard::Compat::UI.color file, :green}"
|
22
|
+
`ruby-beautify #{file} --overwrite`
|
23
|
+
end
|
24
|
+
# make sure to set a real last run if we did a beautify.
|
25
|
+
@last_run = Time.now.to_i
|
23
26
|
else
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
27
|
+
Compat::UI.debug "Ruby beautify skipped on #{paths.join}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
28
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-rubybeautify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.90.
|
4
|
+
version: 0.90.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ernie Brodeur
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard-compat
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- Gemfile
|
81
81
|
- README.md
|
82
82
|
- Rakefile
|
83
|
+
- WHATSNEW.md
|
83
84
|
- bin/console
|
84
85
|
- bin/setup
|
85
86
|
- guard-rubybeautify.gemspec
|