guard-annotate 1.0.0 → 1.1.0
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.
- data/README.rdoc +19 -1
- data/lib/guard/annotate.rb +38 -8
- data/lib/guard/annotate/version.rb +1 -1
- metadata +50 -25
data/README.rdoc
CHANGED
@@ -69,7 +69,25 @@ You can disable run at start with (default is true):
|
|
69
69
|
|
70
70
|
You can annotate indexes on your models with (default is false):
|
71
71
|
|
72
|
-
guard 'annotate', :show_indexes => true
|
72
|
+
guard 'annotate', :show_indexes => true do
|
73
|
+
...
|
74
|
+
end
|
75
|
+
|
76
|
+
You can add simple indexes to the column information (default is false):
|
77
|
+
|
78
|
+
guard 'annotate', :simple_indexes => true do
|
79
|
+
...
|
80
|
+
end
|
81
|
+
|
82
|
+
You can show migration version number in the annotation (default is false):
|
83
|
+
|
84
|
+
guard 'annotate', :show_migration => true do
|
85
|
+
...
|
86
|
+
end
|
87
|
+
|
88
|
+
You can annotate in three different formats: :bare, :rdoc and :markdown (default is :bare):
|
89
|
+
|
90
|
+
guard 'annotate', :format => :rdoc do
|
73
91
|
...
|
74
92
|
end
|
75
93
|
|
data/lib/guard/annotate.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'guard'
|
3
3
|
require 'guard/guard'
|
4
|
+
require 'guard/version'
|
4
5
|
|
5
6
|
module Guard
|
6
7
|
class Annotate < Guard
|
7
8
|
|
8
9
|
autoload :Notifier, 'guard/annotate/notifier'
|
9
10
|
|
10
|
-
def initialize(
|
11
|
+
def initialize(watchers=[], options={})
|
11
12
|
super
|
12
13
|
|
13
14
|
options[:notify] = true if options[:notify].nil?
|
@@ -16,6 +17,9 @@ module Guard
|
|
16
17
|
options[:routes] = false if options[:routes].nil?
|
17
18
|
options[:run_at_start] = true if options[:run_at_start].nil?
|
18
19
|
options[:show_indexes] = false if options[:show_indexes].nil?
|
20
|
+
options[:simple_indexes] = false if options[:simple_indexes].nil?
|
21
|
+
options[:show_migration] = false if options[:show_migration].nil?
|
22
|
+
options[:format] = nil if options[:format].nil? or not [:bare, :markdown, :rdoc].include? options[:format].to_sym
|
19
23
|
end
|
20
24
|
|
21
25
|
def start
|
@@ -34,10 +38,10 @@ module Guard
|
|
34
38
|
true
|
35
39
|
end
|
36
40
|
|
37
|
-
def run_on_changes(
|
41
|
+
def run_on_changes(paths=[])
|
38
42
|
run_annotate
|
39
43
|
end
|
40
|
-
alias :run_on_change :run_on_changes
|
44
|
+
alias :run_on_change :run_on_changes if VERSION < '1.1.0'
|
41
45
|
|
42
46
|
private
|
43
47
|
|
@@ -54,25 +58,51 @@ module Guard
|
|
54
58
|
end
|
55
59
|
|
56
60
|
def annotate_tests_flags
|
57
|
-
options[:tests] ?
|
61
|
+
options[:tests] ? '' : '--exclude tests,fixtures'
|
58
62
|
end
|
59
63
|
|
60
64
|
def show_indexes?
|
61
65
|
options[:show_indexes]
|
62
66
|
end
|
63
67
|
|
68
|
+
def annotate_format
|
69
|
+
options[:format]
|
70
|
+
end
|
71
|
+
|
72
|
+
def annotate_format?
|
73
|
+
not options[:format].nil?
|
74
|
+
end
|
75
|
+
|
76
|
+
def simple_indexes?
|
77
|
+
options[:simple_indexes]
|
78
|
+
end
|
79
|
+
|
80
|
+
def show_migration?
|
81
|
+
options[:show_migration]
|
82
|
+
end
|
83
|
+
|
64
84
|
def run_annotate
|
65
85
|
UI.info 'Running annotate', :reset => true
|
66
86
|
started_at = Time.now
|
87
|
+
annotate_models_options, annotate_options = '', ''
|
88
|
+
|
67
89
|
annotate_models_command = "bundle exec annotate #{annotate_tests_flags} -p #{annotation_position}"
|
68
|
-
|
90
|
+
annotate_models_options += ' --show-indexes' if show_indexes?
|
91
|
+
annotate_models_options += ' --simple-indexes' if simple_indexes?
|
92
|
+
annotate_models_options += ' --show-migration' if show_migration?
|
93
|
+
annotate_options += " --format=#{annotate_format}" if annotate_format?
|
94
|
+
|
95
|
+
annotate_models_command += annotate_models_options + annotate_options
|
69
96
|
@result = system(annotate_models_command)
|
70
|
-
Notifier::notify(
|
97
|
+
Notifier::notify(@result, Time.now - started_at) if notify?
|
71
98
|
|
72
99
|
if annotate_routes?
|
73
100
|
started_at = Time.now
|
74
|
-
|
75
|
-
|
101
|
+
annotate_routes_command = "bundle exec annotate -r -p #{annotation_position}"
|
102
|
+
|
103
|
+
annotate_routes_command += annotate_options
|
104
|
+
@result = system(annotate_routes_command)
|
105
|
+
Notifier::notify(@result, Time.now - started_at) if notify?
|
76
106
|
end
|
77
107
|
|
78
108
|
@result
|
metadata
CHANGED
@@ -1,71 +1,96 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-annotate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
5
4
|
prerelease:
|
5
|
+
version: 1.1.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Craig P Jolicoeur
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-04-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
|
16
|
-
requirement: &70324019035600 !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 0.2.2
|
20
|
+
none: false
|
21
|
+
name: guard
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
requirement: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ! '>='
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 0.2.2
|
28
29
|
none: false
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
version_requirements: !ruby/object:Gem::Requirement
|
29
32
|
requirements:
|
30
33
|
- - ! '>='
|
31
34
|
- !ruby/object:Gem::Version
|
32
35
|
version: 2.4.0
|
36
|
+
none: false
|
37
|
+
name: annotate
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
40
|
+
requirement: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 2.4.0
|
39
45
|
none: false
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
48
|
requirements:
|
41
49
|
- - ~>
|
42
50
|
- !ruby/object:Gem::Version
|
43
51
|
version: 2.9.0
|
52
|
+
none: false
|
53
|
+
name: rspec
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 2.9.0
|
50
61
|
none: false
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
64
|
requirements:
|
52
65
|
- - ~>
|
53
66
|
- !ruby/object:Gem::Version
|
54
67
|
version: 0.6.0
|
68
|
+
none: false
|
69
|
+
name: guard-rspec
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.6.0
|
61
77
|
none: false
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
62
80
|
requirements:
|
63
81
|
- - ~>
|
64
82
|
- !ruby/object:Gem::Version
|
65
83
|
version: 0.9.2.2
|
84
|
+
none: false
|
85
|
+
name: rake
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
|
88
|
+
requirement: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ~>
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 0.9.2.2
|
93
|
+
none: false
|
69
94
|
description: Guard::Annotate automatically runs the annotate gem when needed
|
70
95
|
email:
|
71
96
|
- cpjolicoeur@gmail.com
|
@@ -89,20 +114,20 @@ rdoc_options:
|
|
89
114
|
require_paths:
|
90
115
|
- lib
|
91
116
|
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
-
none: false
|
93
117
|
requirements:
|
94
118
|
- - ! '>='
|
95
119
|
- !ruby/object:Gem::Version
|
96
120
|
version: '0'
|
97
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
121
|
none: false
|
122
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
123
|
requirements:
|
100
124
|
- - ! '>='
|
101
125
|
- !ruby/object:Gem::Version
|
102
126
|
version: '0'
|
127
|
+
none: false
|
103
128
|
requirements: []
|
104
129
|
rubyforge_project: guard-annotate
|
105
|
-
rubygems_version: 1.8.
|
130
|
+
rubygems_version: 1.8.23
|
106
131
|
signing_key:
|
107
132
|
specification_version: 3
|
108
133
|
summary: Guard gem for annotate
|