Skip to content

Commit caa1ae7

Browse files
authored
Move old annotate code into AnnotateRb namespace (#10)
This PR has a lot of changes and I've tried to make commits as discrete and clear as possible. A result of this change is that rake tasks and the executable most likely won't work.
1 parent 5d593ea commit caa1ae7

File tree

63 files changed

+1885
-3916
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1885
-3916
lines changed

exe/annotate

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,21 @@ end
1414
here = File.expand_path(File.dirname __FILE__)
1515
$LOAD_PATH << "#{here}/../lib"
1616

17-
require 'annotate'
18-
require 'annotate/parser'
17+
require 'annotate_rb'
1918

20-
Annotate.bootstrap_rake
19+
AnnotateRb::OldAnnotate.bootstrap_rake
2120

22-
# Annotate::Parser.parse takes in ARGV
23-
# - Parses it and writes stuff to ENV
24-
# - Returns some in a hash as seen below, this script will exit if `:exit` is defined
25-
options_result = Annotate::Parser.parse(ARGV)
21+
options = ::AnnotateRb::Options.from({}, {})
2622

27-
exit if options_result[:exit]
23+
if options[:models]
24+
# Eager load Models when we're annotating models
25+
AnnotateRb::OldAnnotate.eager_load(options)
2826

29-
# Not sure what this does yet
30-
options = Annotate.setup_options(
31-
# .setup_options takes in starting options. It looks like :is_rake is used later down the road so we want to capture
32-
# if it was done via rake task or not.
33-
#
34-
# Looks like it's set in lib/tasks/annotate*.rake files
35-
is_rake: ENV['is_rake'] && !ENV['is_rake'].empty?
36-
)
37-
38-
# Eager load Models when we're annotating models
39-
Annotate.eager_load(options) if Annotate::Helpers.include_models?
27+
puts "Annotating models"
28+
AnnotateRb::ModelAnnotator::Annotator.send(options[:target_action], options)
29+
end
4030

41-
# options_result[:target_action] has possible values of: [:do_annotations, :remove_annotations]
42-
AnnotateModels.send(options_result[:target_action], options) if Annotate::Helpers.include_models?
43-
AnnotateRoutes.send(options_result[:target_action], options) if Annotate::Helpers.include_routes?
31+
if options[:routes]
32+
puts "Annotating routes"
33+
AnnotateRb::RouteAnnotator::Annotator.send(options[:target_action], options)
34+
end

lib/annotate.rb

Lines changed: 0 additions & 147 deletions
This file was deleted.

0 commit comments

Comments
 (0)