guard-annotate 0.9.1 → 0.9.2

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.
@@ -33,7 +33,7 @@ Please read the {Guard usage docs}[https://github.com/guard/guard#readme]
33
33
  # a model file changes
34
34
  #watch( 'app/models/**/*.rb' )
35
35
  end
36
-
36
+
37
37
 
38
38
  == Options
39
39
 
@@ -48,19 +48,25 @@ You can customize the placement of the annotations with (default is 'before'):
48
48
  guard 'annotate', :position => 'before|after' do
49
49
  ...
50
50
  end
51
-
51
+
52
52
  You can choose to also annotate your routes file with (default is false):
53
-
53
+
54
54
  guard 'annotate', :routes => true do
55
55
  ...
56
56
  end
57
-
57
+
58
58
  You can annotate your tests and fixtures files with (default is false):
59
59
 
60
60
  guard 'annotate', :tests => true do
61
61
  ...
62
62
  end
63
63
 
64
+ You can disable run at start with (default is true):
65
+
66
+ guard 'annotate', :run_at_start => false do
67
+ ...
68
+ end
69
+
64
70
  == Development
65
71
 
66
72
  - Source hosed at {GitHub}[https://github.com/cpjolicoeur/guard-annotate]
@@ -4,20 +4,21 @@ require 'guard/guard'
4
4
 
5
5
  module Guard
6
6
  class Annotate < Guard
7
-
7
+
8
8
  autoload :Notifier, 'guard/annotate/notifier'
9
-
9
+
10
10
  def initialize( watchers=[], options={} )
11
11
  super
12
-
12
+
13
13
  options[:notify] = true if options[:notify].nil?
14
14
  options[:position] = 'before' if options[:position].nil?
15
15
  options[:tests] = false if options[:tests].nil?
16
16
  options[:routes] = false if options[:routes].nil?
17
+ options[:run_at_start] = true if options[:run_at_start].nil?
17
18
  end
18
19
 
19
20
  def start
20
- run_annotate
21
+ run_annotate if options[:run_at_start]
21
22
  end
22
23
 
23
24
  def stop
@@ -35,43 +36,37 @@ module Guard
35
36
  def run_on_change( paths=[] )
36
37
  run_annotate
37
38
  end
38
-
39
+
39
40
  private
40
-
41
+
41
42
  def notify?
42
43
  !!options[:notify]
43
44
  end
44
-
45
+
45
46
  def annotation_position
46
47
  options[:position]
47
48
  end
48
-
49
+
49
50
  def annotate_routes?
50
51
  options[:routes]
51
52
  end
52
-
53
+
53
54
  def annotate_tests_flags
54
55
  options[:tests] ? "" : "--exclude tests,fixtures"
55
56
  end
56
-
57
+
57
58
  def run_annotate
58
- UI.info 'Running annotate models', :reset => true
59
+ UI.info 'Running annotate', :reset => true
59
60
  started_at = Time.now
60
61
  @result = system("bundle exec annotate #{annotate_tests_flags} -p #{annotation_position}")
61
62
  Notifier::notify( @result, Time.now - started_at ) if notify?
62
63
 
63
64
  if annotate_routes?
64
- ::Guard.listener.pause
65
-
66
65
  started_at = Time.now
67
- UI.info 'Running annotate routes', :reset => true
68
66
  @result = system("bundle exec annotate -r")
69
67
  Notifier::notify( @result, Time.now - started_at ) if notify?
70
-
71
- ::Guard.listener.clear_changed_files
72
- ::Guard.listener.run
73
68
  end
74
-
69
+
75
70
  @result
76
71
  end
77
72
  end
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module Guard
3
3
  module AnnotateVersion
4
- VERSION = "0.9.1"
4
+ VERSION = "0.9.2"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-annotate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-25 00:00:00.000000000 Z
12
+ date: 2012-01-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard
16
- requirement: &2154836860 !ruby/object:Gem::Requirement
16
+ requirement: &2153258740 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.2.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2154836860
24
+ version_requirements: *2153258740
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: annotate
27
- requirement: &2154836340 !ruby/object:Gem::Requirement
27
+ requirement: &2153258000 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.4.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2154836340
35
+ version_requirements: *2153258000
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &2154835840 !ruby/object:Gem::Requirement
38
+ requirement: &2153251220 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.6.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2154835840
46
+ version_requirements: *2153251220
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: guard-rspec
49
- requirement: &2154835360 !ruby/object:Gem::Requirement
49
+ requirement: &2153250320 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 0.3.1
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2154835360
57
+ version_requirements: *2153250320
58
58
  description: Guard::Annotate automatically runs the annotate gem when needed
59
59
  email:
60
60
  - cpjolicoeur@gmail.com