who_am_i 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 288863730bbd33ec0a782b65eb247bf38d8c7d38
4
- data.tar.gz: 27ac823f61dfecff9099f5da67aa11449d521ca0
3
+ metadata.gz: 07fcf629d4740c2260df772d2471b262ab4c191b
4
+ data.tar.gz: b18ae631e989115427d6139b61d5869b617c98d9
5
5
  SHA512:
6
- metadata.gz: dc4b1779e3649746e7d4de71bbfa5235166bdfea8c1af754fd6c446f6546d75dbffa80d1ec8f979bb61ec15b10dcedfe042dcf2a5ace1942cdb346a6fef491db
7
- data.tar.gz: 5699729dd05db062fa99a7b4bc40dbab2cd8215dd9e9e057e3ea6ced5d52a209e6ab85c602a14dec5a690b198f539b011c394d8523772a980da37ae7e8052f90
6
+ metadata.gz: a1bd59efc01acd70020e97d884617e4c81699a17193f40af474162a62d8352e9c7ce5172f452102c60c01cf1a0ff382b19c0fef5a50818a31476d7b3b39949b5
7
+ data.tar.gz: 935cee6e7c3ce8147bf4ff85615c51b4162039d90c13dbc3c27e8384ce3b3ed3caafd9fbe179a4986b4c395ca6e1f551312ca647aa55945d07ce59c8fffc1a14
@@ -1,20 +1,13 @@
1
1
  module WhoAmI
2
- class Walker < AST::Processor
3
- def initialize
4
- @current_class = ExtractedClass.new(nil)
5
- @classes = [@current_class]
6
- end
7
-
8
- def read(file)
9
- content = File.read(file)
2
+ class FindClasses < Parser::AST::Processor
3
+ def read_and_call(path)
4
+ content = File.read(path)
10
5
  sexp = Parser::CurrentRuby.parse(content)
11
6
 
12
- classes(sexp).each do |klass|
13
- klass.model_filepath = file
14
- end
7
+ call(sexp)
15
8
  end
16
9
 
17
- def classes(sexp)
10
+ def call(sexp)
18
11
  @current_class = ExtractedClass.new(nil)
19
12
  @classes = [@current_class]
20
13
 
@@ -4,7 +4,11 @@ module WhoAmI
4
4
  include ProcParty
5
5
 
6
6
  def call
7
- ActiveRecord::Base.connection.tables
7
+ if ActiveRecord::Base.connection.respond_to?(:data_sources)
8
+ ActiveRecord::Base.connection.data_sources
9
+ else
10
+ ActiveRecord::Base.connection.tables
11
+ end
8
12
  end
9
13
  end
10
14
  end
@@ -19,7 +19,6 @@ module WhoAmI
19
19
  contents = YAML.load_file(initializer_path)
20
20
  deep_symbolize_hash(contents)
21
21
  else
22
- warn "WhoAmI configuration not found, using default"
23
22
  {}
24
23
  end
25
24
  end
@@ -4,10 +4,10 @@ module WhoAmI
4
4
  include ProcParty
5
5
 
6
6
  def call(path)
7
- walker = WhoAmI::Walker.new
8
- extracted_classes = walker.read(path)
7
+ walker = WhoAmI::FindClasses.new
8
+ extracted_classes = walker.read_and_call(path)
9
9
 
10
- extracted_classes
10
+ extracted_classes.each { |klass| klass.model_filepath = path }
11
11
  end
12
12
  end
13
13
  end
@@ -1,3 +1,3 @@
1
1
  module WhoAmI
2
- VERSION = "0.0.4".freeze
2
+ VERSION = "0.0.5".freeze
3
3
  end
data/lib/who_am_i.rb CHANGED
@@ -10,7 +10,7 @@ require "who_am_i/comment"
10
10
  require "who_am_i/table_info"
11
11
  require "who_am_i/table_column_info"
12
12
  require "who_am_i/version"
13
- require "who_am_i/walker"
13
+ require "who_am_i/find_classes"
14
14
  require "who_am_i/text_table"
15
15
  require "who_am_i/error"
16
16
  require "who_am_i/config"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: who_am_i
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Ahn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-11 00:00:00.000000000 Z
11
+ date: 2018-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -231,6 +231,7 @@ files:
231
231
  - lib/who_am_i/config.rb
232
232
  - lib/who_am_i/error.rb
233
233
  - lib/who_am_i/extracted_class.rb
234
+ - lib/who_am_i/find_classes.rb
234
235
  - lib/who_am_i/function/annotate_models.rb
235
236
  - lib/who_am_i/function/compute_comment.rb
236
237
  - lib/who_am_i/function/compute_content.rb
@@ -256,7 +257,6 @@ files:
256
257
  - lib/who_am_i/tasks.rake
257
258
  - lib/who_am_i/text_table.rb
258
259
  - lib/who_am_i/version.rb
259
- - lib/who_am_i/walker.rb
260
260
  - who_am_i.gemspec
261
261
  homepage:
262
262
  licenses: