relationships 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/relationships +1 -1
- data/lib/relationships.rb +2 -2
- data/lib/relationships/model.rb +8 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22e3c9224e42274c0d72517b53aa93ae2bab68ee
|
4
|
+
data.tar.gz: bb6df9410ca0db20ead7961670ad3dfcbd633166
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5a9a4d5e880d8191ad0dfed4269ce72c096fc1203c023ff666cacc2c1987f2c5f9d5c938938d8822bc1508fa5a7e994b643cad50fdd3df2b4a8e2f865ef97af
|
7
|
+
data.tar.gz: e550a7e93843b1ff274625a3033fe4a3775b297cfb184e7a55435b71c39ac956ff099fd1804f51767b3854f983d0fd6b991cf1a52887eb99ca9fb0bb4dc70b35
|
data/bin/relationships
CHANGED
data/lib/relationships.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'rails'
|
2
2
|
|
3
|
-
|
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
|
data/lib/relationships/model.rb
CHANGED
@@ -7,7 +7,14 @@ class Model
|
|
7
7
|
|
8
8
|
def initialize(args = {})
|
9
9
|
@file_path = args[:file]
|
10
|
-
|
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.
|
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
|
13
|
+
description: One simply calls relationships to generate ActiveRecord relationship
|
14
|
+
output.
|
14
15
|
email: ajkofink@gmail.com
|
15
16
|
executables:
|
16
17
|
- relationships
|