guard-annotate 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,9 +28,12 @@ Please read the {Guard usage docs}[https://github.com/guard/guard#readme]
28
28
  === Standard Ruby on Rails project
29
29
 
30
30
  guard 'annotate' do
31
- watch('app/models/**.rb')
31
+ watch( 'db/schema.rb' )
32
+ # Uncomment the following line if you also want to run annotate anytime
33
+ # a model file changes
34
+ #watch( 'app/models/**/*.rb' )
32
35
  end
33
-
36
+
34
37
 
35
38
  == Options
36
39
 
@@ -45,6 +48,18 @@ You can customize the placement of the annotations with (default is 'before'):
45
48
  guard 'annotate', :position => 'before|after' do
46
49
  ...
47
50
  end
51
+
52
+ You can choose to also annotate your routes file with (default is false):
53
+
54
+ guard 'annotate', :routes => true do
55
+ ...
56
+ end
57
+
58
+ You can annotate your tests and fixtures files with (default is false):
59
+
60
+ guard 'annotate', :tests => true do
61
+ ...
62
+ end
48
63
 
49
64
  == Development
50
65
 
@@ -12,6 +12,8 @@ module Guard
12
12
 
13
13
  options[:notify] = true if options[:notify].nil?
14
14
  options[:position] = 'before' if options[:position].nil?
15
+ options[:tests] = false if options[:tests].nil?
16
+ options[:routes] = false if options[:routes].nil?
15
17
  end
16
18
 
17
19
  def start
@@ -44,11 +46,26 @@ module Guard
44
46
  options[:position]
45
47
  end
46
48
 
49
+ def annotate_routes?
50
+ options[:routes]
51
+ end
52
+
53
+ def annotate_tests_flags
54
+ options[:tests] ? "" : "--exclude tests,fixtures"
55
+ end
56
+
47
57
  def run_annotate
48
58
  UI.info 'Running annotate', :reset => true
49
59
  started_at = Time.now
50
- @result = system("annotate --exclude tests,fixtures -p #{annotation_position}")
60
+ @result = system("annotate #{annotate_tests_flags} -p #{annotation_position}")
51
61
  Notifier::notify( @result, Time.now - started_at ) if notify?
62
+
63
+ if annotate_routes?
64
+ started_at = Time.now
65
+ @result = system("annotate -r")
66
+ Notifier::notify( @result, Time.now - started_at ) if notify?
67
+ end
68
+
52
69
  @result
53
70
  end
54
71
  end
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module Guard
3
3
  module AnnotateVersion
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
6
6
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: guard-annotate
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.0
5
+ version: 0.3.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Craig P Jolicoeur
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-20 00:00:00 -04:00
13
+ date: 2011-06-09 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency