annotate 2.7.4 → 3.1.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.
@@ -4,21 +4,17 @@
4
4
  # Append annotations to Rake tasks for ActiveRecord, so annotate automatically gets
5
5
  # run after doing db:migrate.
6
6
 
7
- namespace :db do
8
- [:migrate, :rollback].each do |cmd|
9
- task cmd do
10
- Rake::Task['set_annotation_options'].invoke
7
+ %w(db:migrate db:migrate:up db:migrate:down db:migrate:reset db:migrate:redo db:rollback).each do |task|
8
+ Rake::Task[task].enhance do
9
+ Rake::Task[Rake.application.top_level_tasks.last].enhance do
10
+ annotation_options_task = if Rake::Task.task_defined?('app:set_annotation_options')
11
+ 'app:set_annotation_options'
12
+ else
13
+ 'set_annotation_options'
14
+ end
15
+ Rake::Task[annotation_options_task].invoke
11
16
  Annotate::Migration.update_annotations
12
17
  end
13
-
14
- namespace cmd do
15
- [:change, :up, :down, :reset, :redo].each do |t|
16
- task t do
17
- Rake::Task['set_annotation_options'].invoke
18
- Annotate::Migration.update_annotations
19
- end
20
- end
21
- end
22
18
  end
23
19
  end
24
20
 
@@ -27,11 +23,11 @@ module Annotate
27
23
  @@working = false
28
24
 
29
25
  def self.update_annotations
30
- unless @@working || Annotate.skip_on_migration?
26
+ unless @@working || Annotate::Helpers.skip_on_migration?
31
27
  @@working = true
32
28
 
33
- self.update_models if Annotate.include_models?
34
- self.update_routes if Annotate.include_routes?
29
+ self.update_models if Annotate::Helpers.include_models?
30
+ self.update_routes if Annotate::Helpers.include_routes?
35
31
  end
36
32
  end
37
33
 
@@ -46,6 +42,8 @@ module Annotate
46
42
  def self.update_routes
47
43
  if Rake::Task.task_defined?("annotate_routes")
48
44
  Rake::Task["annotate_routes"].invoke
45
+ elsif Rake::Task.task_defined?("app:annotate_routes")
46
+ Rake::Task["app:annotate_routes"].invoke
49
47
  end
50
48
  end
51
49
  end
@@ -4,12 +4,12 @@ task :annotate_routes => :environment do
4
4
  require "#{annotate_lib}/annotate/annotate_routes"
5
5
 
6
6
  options={}
7
- ENV['position'] = options[:position] = Annotate.fallback(ENV['position'], 'before')
8
- options[:position_in_routes] = Annotate.fallback(ENV['position_in_routes'], ENV['position'])
9
- options[:ignore_routes] = Annotate.fallback(ENV['ignore_routes'], nil)
7
+ ENV['position'] = options[:position] = Annotate::Helpers.fallback(ENV['position'], 'before')
8
+ options[:position_in_routes] = Annotate::Helpers.fallback(ENV['position_in_routes'], ENV['position'])
9
+ options[:ignore_routes] = Annotate::Helpers.fallback(ENV['ignore_routes'], nil)
10
10
  options[:require] = ENV['require'] ? ENV['require'].split(',') : []
11
- options[:wrapper_open] = Annotate.fallback(ENV['wrapper_open'], ENV['wrapper'])
12
- options[:wrapper_close] = Annotate.fallback(ENV['wrapper_close'], ENV['wrapper'])
11
+ options[:wrapper_open] = Annotate::Helpers.fallback(ENV['wrapper_open'], ENV['wrapper'])
12
+ options[:wrapper_close] = Annotate::Helpers.fallback(ENV['wrapper_close'], ENV['wrapper'])
13
13
  AnnotateRoutes.do_annotations(options)
14
14
  end
15
15
 
data/potato.md ADDED
@@ -0,0 +1,41 @@
1
+ Colons can be used to align columns.
2
+
3
+ | Tables | Are | Cool |
4
+ | ------------- |:-------------:| -----:|
5
+ | col 3 is | right-aligned | $1600 |
6
+ | col 2 is | centered | $12 |
7
+ | zebra stripes | are neat | $1 |
8
+
9
+ There must be at least 3 dashes separating each header cell.
10
+ The outer pipes (|) are optional, and you don't need to make the
11
+ raw Markdown line up prettily. You can also use inline Markdown.
12
+
13
+ Markdown | Less | Pretty
14
+ --- | --- | ---
15
+ *Still* | `renders` | **nicely**
16
+ 1 | 2 | 3
17
+
18
+
19
+ ## Route Map
20
+
21
+  Prefix | Verb | URI Pattern | Controller#Action
22
+ --------- | ---------- | --------------- | --------------------
23
+ myaction1 | GET | /url1(.:format) | mycontroller1#action
24
+ myaction2 | POST | /url2(.:format) | mycontroller2#action
25
+  myaction3 | DELETE-GET | /url3(.:format) | mycontroller3#action \n")
26
+
27
+
28
+
29
+ Table name: `users`
30
+
31
+ ### Columns
32
+
33
+ Name | Type | Attributes
34
+ ----------------------- | ------------------ | ---------------------------
35
+ **`id`** | `integer` | `not null, primary key`
36
+ **`foreign_thing_id`** | `integer` | `not null`
37
+
38
+ ### Foreign Keys
39
+
40
+ * `fk_rails_...` (_ON DELETE => on_delete_value ON UPDATE => on_update_value_):
41
+ * **`foreign_thing_id => foreign_things.id`**
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: annotate
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.4
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Chaffee
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2018-06-03 00:00:00.000000000 Z
15
+ date: 2020-03-24 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rake
@@ -23,7 +23,7 @@ dependencies:
23
23
  version: '10.4'
24
24
  - - "<"
25
25
  - !ruby/object:Gem::Version
26
- version: '13.0'
26
+ version: '14.0'
27
27
  type: :runtime
28
28
  prerelease: false
29
29
  version_requirements: !ruby/object:Gem::Requirement
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '10.4'
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
- version: '13.0'
36
+ version: '14.0'
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: activerecord
39
39
  requirement: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '3.2'
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
- version: '6.0'
46
+ version: '7.0'
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
@@ -53,7 +53,7 @@ dependencies:
53
53
  version: '3.2'
54
54
  - - "<"
55
55
  - !ruby/object:Gem::Version
56
- version: '6.0'
56
+ version: '7.0'
57
57
  description: Annotates Rails/ActiveRecord Models, routes, fixtures, and others based
58
58
  on the database schema.
59
59
  email:
@@ -66,21 +66,24 @@ executables:
66
66
  - annotate
67
67
  extensions: []
68
68
  extra_rdoc_files:
69
- - README.rdoc
70
- - CHANGELOG.rdoc
71
- - TODO.rdoc
69
+ - README.md
70
+ - CHANGELOG.md
72
71
  files:
73
- - AUTHORS.rdoc
74
- - CHANGELOG.rdoc
72
+ - AUTHORS.md
73
+ - CHANGELOG.md
75
74
  - LICENSE.txt
76
- - README.rdoc
77
- - TODO.rdoc
75
+ - README.md
76
+ - RELEASE.md
78
77
  - annotate.gemspec
79
78
  - bin/annotate
80
79
  - lib/annotate.rb
81
80
  - lib/annotate/active_record_patch.rb
82
81
  - lib/annotate/annotate_models.rb
83
82
  - lib/annotate/annotate_routes.rb
83
+ - lib/annotate/annotate_routes/helpers.rb
84
+ - lib/annotate/constants.rb
85
+ - lib/annotate/helpers.rb
86
+ - lib/annotate/parser.rb
84
87
  - lib/annotate/tasks.rb
85
88
  - lib/annotate/version.rb
86
89
  - lib/generators/annotate/USAGE
@@ -89,10 +92,12 @@ files:
89
92
  - lib/tasks/annotate_models.rake
90
93
  - lib/tasks/annotate_models_migrate.rake
91
94
  - lib/tasks/annotate_routes.rake
95
+ - potato.md
92
96
  homepage: http://github.com/ctran/annotate_models
93
97
  licenses:
94
98
  - Ruby
95
- metadata: {}
99
+ metadata:
100
+ github_repo: ssh://github.com/ctran/annotate_models
96
101
  post_install_message:
97
102
  rdoc_options: []
98
103
  require_paths:
@@ -101,14 +106,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
101
106
  requirements:
102
107
  - - ">="
103
108
  - !ruby/object:Gem::Version
104
- version: 2.2.0
109
+ version: 2.4.0
105
110
  required_rubygems_version: !ruby/object:Gem::Requirement
106
111
  requirements:
107
112
  - - ">="
108
113
  - !ruby/object:Gem::Version
109
114
  version: '0'
110
115
  requirements: []
111
- rubyforge_project: annotate
116
+ rubyforge_project:
112
117
  rubygems_version: 2.7.7
113
118
  signing_key:
114
119
  specification_version: 4
data/CHANGELOG.rdoc DELETED
@@ -1,220 +0,0 @@
1
- == 2.7.4
2
- See https://github.com/ctran/annotate_models/releases/tag/v2.7.4
3
-
4
- == 2.7.3
5
- See https://github.com/ctran/annotate_models/releases/tag/v2.7.3
6
-
7
- == 2.7.2
8
- See https://github.com/ctran/annotate_models/releases/tag/v2.7.2
9
-
10
- == 2.7.1
11
- See https://github.com/ctran/annotate_models/releases/tag/v2.7.1
12
-
13
- == 2.7.0
14
- See https://github.com/ctran/annotate_models/releases/tag/v2.7.0
15
-
16
- == 2.6.9
17
- * Support foreigh key (#241)
18
- * Check if model has skip tag in annotate_model_file (#167)
19
- * Fix issue where serializer-related flags weren't being honored (#246)
20
- * Prefer SQL column type over normalized AR type (#231)
21
-
22
- == 2.6.8
23
- * Nothing annotated unless options[:model_dir] is specified, #234
24
-
25
- == 2.6.7
26
- * Nothing annotated unless options[:model_dir] is specified, #234
27
-
28
- == 2.6.6
29
- * Makes it possible to wrap annotations, #225
30
- * Fix single model generation, #214
31
- * Fix default value for Rails 4.2, #212
32
- * Don't crash on inherited models in subdirectories, #232
33
- * Process model_dir in rake task, #197
34
-
35
- == 2.6.4
36
- * Skip "models/concerns", #194
37
- * Fix #173 where annotate says "Nothing to annotate" in rails 4.2
38
- * Display an error message if not run from the root of the project, #186
39
- * Support rails 4.0 new default test directory, #182
40
- * Add an option to show timestamp in routes "-timestamp", #136
41
- * Skip plain ruby objects if they have the same class name as an ActiveRecord object, #121
42
-
43
- == 2.6.3
44
- * Fix bug of annotate position in routes (#158)
45
-
46
- == 2.6.2
47
- * Retain the current annotate block unless --force is specified
48
- * Always load models, since they may not be autoloaded by Rails
49
- * The pg array type is now detected (see #158)
50
-
51
- == 2.6.0.beta2
52
-
53
- * support for composite_primary_keys (garysweaver)
54
- * bug fix for annotate_one_file (vlado)
55
-
56
- == 2.6.0.beta1
57
-
58
- * It's now possible to use Annotate in standalone ActiveRecord (non-Rails)
59
- projects again.
60
- * Adding note that Markdown is actually MultiMarkdown, and recommending the use
61
- of the `kramdown` engine for parsing it.
62
- * Improved Markdown formatting considerably.
63
- * Bugfix: Needed to use inline-code tag for column and table names, otherwise
64
- underscores would cause havok with the formatting.
65
- * Bugfix: Markdown syntax was incorrect (can't have trailing spaces before the
66
- closing marker for an emphasis tag).
67
- * Bugfix: Remove-annotations wasn't properly finding test/spec files, and
68
- wasn't even looking for FactoryGirl factories under the new naming
69
- convention.
70
- * Bugfix: Load the Rakefile from the current directory, not the first Rakefile
71
- in our load path.
72
- * Added support for new FactoryGirl naming convention.
73
- * Fix behavior of route annotations in newer versions of Rake that don't spit
74
- out the CWD as their first line of output.
75
- * Overhauled integration testing system to be much easier to work with, better
76
- compartmentalized, and so forth -- at the cost that you must be using RVM to
77
- utilize it. (It'll spit out appropriate pending messages if you don't.)
78
- Also includes a mode for "tinkering" by hand with a scenario, and won't let
79
- you run it through rspect if the repo is in a dirty state. Added appropriate
80
- rake tasks to help with all of this.
81
- * Routes can now be appended, pre-pended, or removed -- and do sane things in
82
- all cases.
83
- * Expose all `position_*` variables as CLI params.
84
- * Make `ENV ['position']` work as a default for all the `ENV ['position_*']`
85
- variables.
86
- * Make rake tasks more resilient to unusual circumstances / code loading
87
- behavior.
88
- * Resolve annotate vs. annotate_models ambiguity once and for all by settling
89
- on `annotate_models` _and_ `annotate_routes`. This avoids a name collision
90
- with RMagick while not needlessly overloading the term.
91
- * Fixed that schema kept prepending additional newlines
92
- * Updates to make annotate smarter about when to touch a model
93
- * Recognize column+type, and don't change a file unless the column+type
94
- combination of the new schema are different than that of the old (i.e., don't
95
- regenerate if columns happen to be in a different order. That's just how life
96
- is sometimes)
97
- * Change annotate to use options hash instead of ENV.
98
-
99
- == 2.5.0
100
-
101
- * Works better with Rails 3
102
- * Bugfix: schema kept prepending additional newlines
103
- * Updates to make annotate smarter about when to touch a model
104
- * Recognize column+type, and don't change a file unless the column+type combination of the new schema are different than that of the old (i.e., don't regenerate if columns happen to be in a different order. That's just how life is sometimes.)
105
- * Grab old specification even if it has \r\n as line endings rather than pure \ns
106
- * Various warning and specification fixes
107
- * Fix "no such file to load -- annotate/annotate_models (MissingSourceFile)"
108
- error (require statements in tasks now use full path to lib files)
109
- * warn about macros, to mitigate when we're included during a production run,
110
- not just a rakefile run -- possibly at the expense of too much noise
111
- * Adding rake as a runtime dependency
112
- * If the schema is already in the model file, it will be replaced into the same
113
- location. If it didn't previously exist, it'll be placed according to the
114
- "position", as before.
115
- * Allow task loading from Rakefile for gems (plugin installation already
116
- auto-detects).
117
- * Add skip_on_db_migrate option as well for people that don't want it
118
- * Fix options parsing to convert strings to proper booleans
119
- * Add support for Fabrication fabricators
120
- * Leave magic encoding comment intact
121
- * Fix issue #14 - RuntimeError: Already memoized
122
- * Count a model as 'annotated' if any of its tests/fixtures are annotated
123
- * Support FactoryGirl
124
- * Support :change migrations (Rails 3.1)
125
- * Allow models with non-standard capitalization
126
- * Widen type column so we can handle longtexts with chopping things off.
127
- * Skip trying to get list of models from commandline when running via Rake (was
128
- preventing the use of multiple rake tasks in one command if one of them was
129
- db:migrate).
130
- * Add ability to skip annotations for a model by adding
131
- '# -*- SkipSchemaAnnotations' anywhere in the file.
132
- * Don't show column limits for integer and boolean types.
133
- * Add sorting for columns and indexes. (Helpful for out-of-order migration
134
- execution. Use --sort if you want this.)
135
- * Annotate unit tests in subfolders.
136
- * Add generator to install rakefile that automatically annotates on db:migrate.
137
- * Correct Gemfile to clarify which environments need which gems.
138
- * Add an .rvmrc to facilitate clean development.
139
- * Refactor out ActiveRecord monkey-patch to permit extending without
140
- side-effects.
141
- * Use ObjectSpace to locate models to facilitate handling of models with
142
- non-standard capitalization.
143
- Note that this still requires that the inflector be configured to understand
144
- the special case.
145
- * Shore up test cases a bit.
146
- * Merge against many of the older branches on Github whose functionality is
147
- already reflected to reduce confusion about what is and is not implemented
148
- here.
149
- * Accept String or Symbol for :position (et al) options.
150
- * Add RDoc output formatting as an option.
151
- * Add Markdown output formatting as an option.
152
- * Add option to force annotation regeneration.
153
- * Add new configuration option for controlling where info is placed in
154
- fixtures/factories.
155
- * Fix for models without tables.
156
- * Fix gemspec generation now that Jeweler looks at Gemfile.
157
- * Fix warning: `NOTE: Gem::Specification#default_executable= is deprecated with
158
- no replacement. It will be removed on or after 2011-10-01.`
159
- * Fix handling of files with no trailing newline when putting annotations at
160
- the end of the file.
161
- * Now works on tables with no primary key.
162
- * --format=markdown option
163
- * --trace option to help debug "Unable to annotate" errors
164
- * "Table name" annotation (if table name is different from model name)
165
- * "Human name" annotation (enabling translation to non-English locales)
166
- * Fix JRuby ObjectSpace compatibility bug (https://github.com/ctran/annotate_models/pull/85)
167
- * Fix FactoryGirl compatibility bug (https://github.com/ctran/annotate_models/pull/82)
168
-
169
- == 2.4.2 2009-11-21
170
-
171
- * Annotates (spec|test)/factories/<model>_factory.rb files
172
-
173
- == 2.4.1 2009-11-20
174
-
175
- * Annotates thoughtbot's factory_girl factories (test/factories/<model>_factory.rb)
176
- * Move default annotation position back to top
177
-
178
- == 2.4.0 2009-12-13
179
-
180
- * Incorporated lots of patches from the Github community, including support for
181
- Blueprints fixtures
182
- * Several bug fixes
183
-
184
- == 2.1 2009-10-18
185
-
186
- * New options
187
- * -R to require additional files before loading the models
188
- * -i to show database indexes in annotations
189
- * -e to exclude annotating tests or fixtures
190
- * -m to include the migration version number in the annotation
191
- * --model-dir to annotate model files stored a different place than app/models
192
- * Ignore unknown macros ('acts_as_whatever')
193
-
194
- == 2.0 2009-02-03
195
-
196
- * Add annotate_models plugin fork additions
197
- * Annotates Rspec and Test Unit models
198
- * Annotates Object Daddy exemplars
199
- * Annotates geometrical columns
200
- * Add AnnotateRoutes rake task
201
- * Up gem structure to newgem defaults
202
-
203
- == 1.0.4 2008-09-04
204
-
205
- * Only update modified models since last run, thanks to sant0sk1
206
-
207
- == 1.0.3 2008-05-02
208
-
209
- * Add misc changes from Dustin Sallings and Henrik N
210
- * Remove trailing whitespace
211
- * More intuitive info messages
212
- * Update README file with update-to-date example
213
-
214
- == 1.0.2 2008-03-22
215
-
216
- * Add contributions from Michael Bumann (http://github.com/bumi)
217
- * added an option "position" to choose to put the annotation,
218
- * spec/fixtures now also get annotated
219
- * added a task to remove the annotations
220
- * these options can be specified from command line as -d and -p [before|after]