Skip to content

Commit 178f022

Browse files
authored
Removed unused helper methods and Env class (#18)
Cleaning up some unused code.
1 parent af67d61 commit 178f022

File tree

6 files changed

+0
-57
lines changed

6 files changed

+0
-57
lines changed

lib/annotate_rb.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
require_relative 'annotate_rb/runner'
1919
require_relative 'annotate_rb/route_annotator'
2020
require_relative 'annotate_rb/model_annotator'
21-
require_relative 'annotate_rb/env'
2221
require_relative 'annotate_rb/options'
2322
require_relative 'annotate_rb/eager_loader'
2423
require_relative 'annotate_rb/rake_bootstrapper'

lib/annotate_rb/env.rb

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

lib/annotate_rb/model_annotator/helper.rb

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,6 @@ def magic_comments_as_string(content)
2424
end
2525
end
2626

27-
def skip_on_migration?
28-
Env.read('ANNOTATE_SKIP_ON_DB_MIGRATE') =~ Constants::TRUE_RE || Env.read('skip_on_db_migrate') =~ Constants::TRUE_RE
29-
end
30-
31-
def include_routes?
32-
Env.read('routes') =~ Constants::TRUE_RE
33-
end
34-
35-
def include_models?
36-
Env.read('models') =~ Constants::TRUE_RE
37-
end
38-
3927
def true?(val)
4028
val.present? && Constants::TRUE_RE.match?(val)
4129
end
@@ -44,10 +32,6 @@ def true?(val)
4432
def fallback(*args)
4533
args.compact.detect(&:present?)
4634
end
47-
48-
def reset_options(options)
49-
options.flatten.each { |key| Env.write(key, nil) }
50-
end
5135
end
5236
end
5337
end

spec/lib/annotate_rb/annotate_models/annotate_models_annotating_a_file_frozen_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class User < ActiveRecord::Base
1818
mock_column(:name, :string, limit: 50)
1919
])
2020
@schema_info = AnnotateRb::ModelAnnotator::SchemaInfo.generate(@klass, '== Schema Info')
21-
AnnotateRb::ModelAnnotator::Helper.reset_options(AnnotateRb::ModelAnnotator::Constants::ALL_ANNOTATE_OPTIONS)
2221
end
2322

2423
# TODO: Check out why this test fails due to test pollution

spec/lib/annotate_rb/annotate_models/annotate_models_annotating_a_file_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class User < ActiveRecord::Base
1919
mock_column(:name, :string, limit: 50)
2020
])
2121
@schema_info = AnnotateRb::ModelAnnotator::SchemaInfo.generate(@klass, '== Schema Info')
22-
AnnotateRb::ModelAnnotator::Helper.reset_options(AnnotateRb::ModelAnnotator::Constants::ALL_ANNOTATE_OPTIONS)
2322
end
2423

2524
context "with 'before'" do

spec/support/annotate_test_helpers.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
# frozen_string_literal: true
22

33
module AnnotateTestHelpers
4-
5-
# This method is used to debug flakes/test pollution due to relying on ENV
6-
# Can remove after the dependency on ENV is removed
7-
def self.print_annotate_env_values
8-
keys = Annotate::Constants::ALL_ANNOTATE_OPTIONS.flatten.map(&:to_s)
9-
pp ENV.to_h.slice(*keys)
10-
end
11-
124
def annotate_one_file(options = {})
135
opts = AnnotateRb::Options.from(options)
146

0 commit comments

Comments
 (0)