relationships 0.0.1 → 0.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0857e3692b19aa05daecc73688b8187611f1b0f
4
- data.tar.gz: 7cb2372bf794b09d8d5d2d10499c12cef026e320
3
+ metadata.gz: 22e3c9224e42274c0d72517b53aa93ae2bab68ee
4
+ data.tar.gz: bb6df9410ca0db20ead7961670ad3dfcbd633166
5
5
  SHA512:
6
- metadata.gz: 0aee99da0fc41dbe96605b2447566f8b82e586921d40d104088d750ee7164aeda4d7928b78b0408284acbb83df22112cbc43c340b0a0e4f093662a0edf023d0a
7
- data.tar.gz: adff1cadfae2a6ff4a7be20f7c0e262dfeba280cb9b8d8d32474910b3a48e82aab2eec9de4eaaa12e2726bdfc5d39cd133506128280ac1bb6489d4aa33dc8ebb
6
+ metadata.gz: e5a9a4d5e880d8191ad0dfed4269ce72c096fc1203c023ff666cacc2c1987f2c5f9d5c938938d8822bc1508fa5a7e994b643cad50fdd3df2b4a8e2f865ef97af
7
+ data.tar.gz: e550a7e93843b1ff274625a3033fe4a3775b297cfb184e7a55435b71c39ac956ff099fd1804f51767b3854f983d0fd6b991cf1a52887eb99ca9fb0bb4dc70b35
@@ -2,4 +2,4 @@
2
2
 
3
3
  require 'relationships'
4
4
 
5
- relationships.run!
5
+ Relationships.run!
@@ -1,10 +1,10 @@
1
1
  require 'rails'
2
2
 
3
- Dir['./lib/relationships/*'].map {|m| require m}
3
+ Gem.find_files('relationships/*').each {|m| require m}
4
4
 
5
5
  class Relationships
6
6
  def self.run!
7
- model_files = Dir[Pathname.new('app/models/*')]
7
+ model_files = Dir[Pathname.new('app/models/**/*.rb')]
8
8
  models = FileParser.parse model_files
9
9
  MarkdownGenerator.output models
10
10
  end
@@ -7,7 +7,14 @@ class Model
7
7
 
8
8
  def initialize(args = {})
9
9
  @file_path = args[:file]
10
- @file_contents = File.read file_path if file_path
10
+ if File.directory? file_path
11
+ model_files = Dir[Pathname.new(file_path)]
12
+ models = model_files.map do |model_file|
13
+ Model.from_file model_file
14
+ end
15
+ else
16
+ @file_contents = File.read file_path if file_path
17
+ end
11
18
  end
12
19
 
13
20
  def relationships
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relationships
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kofink
@@ -10,7 +10,8 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2013-10-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: One simply calls rake relationships to generate relation output.
13
+ description: One simply calls relationships to generate ActiveRecord relationship
14
+ output.
14
15
  email: ajkofink@gmail.com
15
16
  executables:
16
17
  - relationships