rails2use 0.0.33
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 +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +49 -0
- data/Rakefile +7 -0
- data/lib/rails2use/plantuml_writer.rb +94 -0
- data/lib/rails2use/railtie.rb +11 -0
- data/lib/rails2use/use_writer.rb +85 -0
- data/lib/rails2use/version.rb +3 -0
- data/lib/rails2use.rb +131 -0
- data/rails2use.gemspec +27 -0
- data/spec/lib/rails2use_spec.rb +7 -0
- data/spec/spec_helper.rb +1 -0
- data/tasks/uml.rake +25 -0
- metadata +118 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f0473e74fc7e85e11ce7f5cc7d2fe6242d751ee7
|
4
|
+
data.tar.gz: 6b35bc41d76c3e2ec80a709ed953a65472119b13
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ad0c5b7c90a2cbc7233ac70ecd1c9d8331e2ca598824951e89f718bbe5a4a092454abfe31a330da05faa8a95b58feaf9de1eb8ad3ac0804a2e51b939fb324adf
|
7
|
+
data.tar.gz: 82a7d6abfed777c5a5b9f33bb484456ca39f53cdb5160d76c9c9f443c0ddcd245e6bf8aa22c33893dcd0151bf2e0d9682d094a6cf3e0ddb3be203b3d7b74989c
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Manuel Dudda
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Rails2use
|
2
|
+
|
3
|
+
Extracts all rails model to one UML file written in USE (UML-based Specification Environment).
|
4
|
+
|
5
|
+
Currently is only ActiveRecord supported. Wrappers for Mongoid and others are planned.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'rails2use'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install rails2use
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Running Rake-Task:
|
24
|
+
|
25
|
+
rake doc:uml FORMAT=use|plantuml TYPE=object,class
|
26
|
+
|
27
|
+
Options:
|
28
|
+
|
29
|
+
- FORMAT: use | plantuml (default = plantuml)
|
30
|
+
- TYPE: object | class (default = object,class)
|
31
|
+
- OUTPUT: *filename* (default = doc/output.puml)
|
32
|
+
|
33
|
+
You can use multiple options in a comma separated way
|
34
|
+
|
35
|
+
Using in Ruby:
|
36
|
+
|
37
|
+
require 'Rails2use'
|
38
|
+
|
39
|
+
Rails2use.extract! # default will extract the use file to rails_project/doc/gen/uml/output.use
|
40
|
+
|
41
|
+
Rails2use.extract! file: Rails.root.join('doc', 'gen', 'api', 'uml', 'apiv2.use') # the folder structure will be automtically generated
|
42
|
+
|
43
|
+
## Contributing
|
44
|
+
|
45
|
+
1. Fork it ( https://github.com/[my-github-username]/rails2use/fork )
|
46
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
47
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
48
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
49
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
class PlantumlWriter
|
2
|
+
def self.suffix
|
3
|
+
'puml'
|
4
|
+
end
|
5
|
+
|
6
|
+
attr_accessor :types, :file
|
7
|
+
|
8
|
+
def initialize(file_name)
|
9
|
+
@filename = file_name
|
10
|
+
@object_filename = file_name.to_s.gsub(/\..*\/?$/, '_instances.puml')
|
11
|
+
@associations = ""
|
12
|
+
@types = {
|
13
|
+
'integer' => 'Integer',
|
14
|
+
'double' => 'Real',
|
15
|
+
'float' => 'Real',
|
16
|
+
'boolean' => 'Boolean',
|
17
|
+
'string' => 'String'
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
def close
|
22
|
+
@file.try :close
|
23
|
+
@instances_file.try :close
|
24
|
+
end
|
25
|
+
|
26
|
+
def write_head(type=:class)
|
27
|
+
file = case type
|
28
|
+
when :object then
|
29
|
+
@instances_file = File.open(@object_filename, 'w')
|
30
|
+
@instances_file
|
31
|
+
else
|
32
|
+
@file = File.open(@filename, 'w')
|
33
|
+
@file
|
34
|
+
end
|
35
|
+
file.write "@startuml\n\n" #write head
|
36
|
+
end
|
37
|
+
|
38
|
+
def write_foot(type=:class)
|
39
|
+
file = case type
|
40
|
+
when :object then
|
41
|
+
@instances_file
|
42
|
+
else
|
43
|
+
@file
|
44
|
+
end
|
45
|
+
file.write "\n@enduml"
|
46
|
+
end
|
47
|
+
|
48
|
+
def write_abstract_class(class_name)
|
49
|
+
@file.write "abstract class #{class_name}\n"
|
50
|
+
end
|
51
|
+
|
52
|
+
def write_class(class_name, super_classes="", attributes="", associations={})
|
53
|
+
@file.write "#{super_classes} <|- #{class_name}\n" unless super_classes.blank?
|
54
|
+
@file.write "class #{class_name} {\n#{attributes}\n}\n\n"
|
55
|
+
|
56
|
+
associations[:has_many].each do |name, values|
|
57
|
+
@associations << values[:class_name]+ ' "1" o-- "*" '+ values[:foreign_class_name] + "\n"
|
58
|
+
|
59
|
+
#@associations << "association #{name} between\n"
|
60
|
+
#@associations << "\t#{values[:class_name]}[1] role #{values[:role_name]}\n"
|
61
|
+
#@associations << "\t#{values[:foreign_class_name]}[*] role #{values[:foreign_role_name]}\nend\n\n"
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
associations[:has_one].each do |name, values|
|
66
|
+
@associations << values[:class_name]+ ' "1" o-- "1" '+ values[:foreign_class_name] + "\n"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def write_class_end
|
71
|
+
@file.write @associations
|
72
|
+
end
|
73
|
+
|
74
|
+
def write_instance(instance_name, class_name, attributes=[], associations={})
|
75
|
+
@instances_file.write "object #{instance_name}{\n"
|
76
|
+
attributes.each do |attribute, value|
|
77
|
+
if value.is_a?(Numeric) || value.is_a?(TrueClass) || value.is_a?(FalseClass)
|
78
|
+
@instances_file.write "#{attribute} = #{value}\n"
|
79
|
+
else
|
80
|
+
@instances_file.write "#{attribute} = '#{value}'\n"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
@instances_file.write "}\n\n"
|
84
|
+
associations.each do |x|
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
def write_association(association_name, instance_name, foreign_instance_name)
|
91
|
+
@instances_file.write "#{instance_name} o-- #{foreign_instance_name}\n"
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
class UseWriter
|
2
|
+
def self.suffix
|
3
|
+
'use'
|
4
|
+
end
|
5
|
+
|
6
|
+
attr_accessor :types, :file
|
7
|
+
|
8
|
+
def initialize(file_name)
|
9
|
+
@filename = file_name
|
10
|
+
@associations = ""
|
11
|
+
@object_filename = file_name.to_s.gsub(/\..*\/?$/, '_instances.use_cmd')
|
12
|
+
@types = {
|
13
|
+
'integer' => 'Integer',
|
14
|
+
'double' => 'Real',
|
15
|
+
'float' => 'Real',
|
16
|
+
'boolean' => 'Boolean',
|
17
|
+
'string' => 'String'
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
def close
|
22
|
+
@file.try :close
|
23
|
+
@instances_file.try :close
|
24
|
+
end
|
25
|
+
|
26
|
+
def write_head(type=:class)
|
27
|
+
case type
|
28
|
+
when :object then
|
29
|
+
@instances_file = File.open(@object_filename, 'w')
|
30
|
+
else
|
31
|
+
@file = File.open(@filename, 'w')
|
32
|
+
@file.write "model #{Rails.application.class.parent_name}\n\n-- classes\n\n" #write head
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
def write_foot(type=:class)
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
def write_abstract_class(class_name)
|
42
|
+
@file.write "abstract class #{class_name}\n\nend\n\n"
|
43
|
+
end
|
44
|
+
|
45
|
+
def write_class(class_name, super_classes="", attributes="", associations={})
|
46
|
+
super_classes = " < #{super_classes}" unless super_classes.blank?
|
47
|
+
@file.write "class #{class_name}#{super_classes}\nattributes\n#{attributes}\nend\n\n"
|
48
|
+
|
49
|
+
associations[:has_many].each do |name, values|
|
50
|
+
@associations << "association #{name} between\n"
|
51
|
+
@associations << "\t#{values[:class_name]}[1] role #{values[:role_name]}\n"
|
52
|
+
@associations << "\t#{values[:foreign_class_name]}[*] role #{values[:foreign_role_name]}\nend\n\n"
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
associations[:has_one].each do |name, values|
|
57
|
+
@associations << "association #{name} between\n"
|
58
|
+
@associations << "\t#{values[:class_name]}[1] role #{values[:role_name]}\n"
|
59
|
+
@associations << "\t#{values[:foreign_class_name]}[1] role #{values[:foreign_role_name]}\nend\n\n"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def write_class_end
|
64
|
+
@file.write @associations
|
65
|
+
end
|
66
|
+
|
67
|
+
def write_instance(instance_name, class_name, attributes=[], associations={})
|
68
|
+
@instances_file.write "!create #{instance_name}:#{class_name}\n"
|
69
|
+
attributes.each do |attribute, value|
|
70
|
+
if value.is_a?(Numeric) || value.is_a?(TrueClass) || value.is_a?(FalseClass)
|
71
|
+
@instances_file.write "!set #{instance_name}.#{attribute} := #{value.to_s}\n"
|
72
|
+
else
|
73
|
+
@instances_file.write "!set #{instance_name}.#{attribute} := '#{value.to_s}'\n"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
associations.each do |x|
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def write_association(association_name, instance_name, foreign_instance_name)
|
82
|
+
@instances_file.write "!insert (#{instance_name}, #{foreign_instance_name}) into #{association_name}\n"
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
data/lib/rails2use.rb
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
%w(version use_writer plantuml_writer railtie).each { |f| require "rails2use/#{f}" }
|
2
|
+
|
3
|
+
module Rails2use
|
4
|
+
attr_accessor :writer
|
5
|
+
|
6
|
+
def self.extract!(options={})
|
7
|
+
Rails2use.extract(options)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.extract(options={})
|
11
|
+
options[:writer] ||= 'PlantumlWriter'
|
12
|
+
const_writer = options[:writer].constantize
|
13
|
+
suffix = const_writer.suffix
|
14
|
+
options[:file] ||= Rails.root.join('doc', 'uml', "output.#{suffix}")
|
15
|
+
|
16
|
+
types = if options[:type]
|
17
|
+
options[:type].split(',').map { |t| t.strip.downcase }
|
18
|
+
else
|
19
|
+
'class'
|
20
|
+
end
|
21
|
+
|
22
|
+
path = Rails.root.join ''
|
23
|
+
sub_paths = (options[:file].to_s+'/').gsub(path.to_s, '').split('/')
|
24
|
+
|
25
|
+
sub_paths.each do |subdir|
|
26
|
+
path = path.join subdir
|
27
|
+
Dir.mkdir(path.dirname) unless Dir.exists?(path.dirname)
|
28
|
+
end
|
29
|
+
#path
|
30
|
+
|
31
|
+
abstract_classes = []
|
32
|
+
subclasses = {}
|
33
|
+
|
34
|
+
model_blacklist = defined?(Doorkeeper) ? [Doorkeeper::AccessGrant, Doorkeeper::AccessToken, Doorkeeper::Application] : []
|
35
|
+
Rails.application.eager_load! #unless Rails.configuration.cache_classes
|
36
|
+
all_models = (ActiveRecord::Base.descendants - model_blacklist)
|
37
|
+
|
38
|
+
attribute_blacklist = %w(model)
|
39
|
+
|
40
|
+
@writer = const_writer.new options[:file]
|
41
|
+
|
42
|
+
@writer.write_head :class if types.include?('class')
|
43
|
+
#abstract classes first
|
44
|
+
all_models.each do |model|
|
45
|
+
|
46
|
+
#belongs_to
|
47
|
+
model.reflect_on_all_associations(:belongs_to).each do |association|
|
48
|
+
#extract polymorphic classes and determine abstract class status
|
49
|
+
class_name = association.name.to_s.camelcase
|
50
|
+
if association.options.has_key?(:polymorphic)
|
51
|
+
if !abstract_classes.include?(class_name)
|
52
|
+
@writer.write_abstract_class class_name if types.include?('class')
|
53
|
+
abstract_classes << class_name
|
54
|
+
end
|
55
|
+
subclasses[model.name] = [class_name]
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
all_models.each do |model|
|
61
|
+
model_associations = {:has_many => {}, :has_one => {}}
|
62
|
+
#def_abstract_class = abstract_classes.include?(model.name) ? 'abstract ' : ''
|
63
|
+
def_super_classes = subclasses.has_key?(model.name) ? subclasses[model.name].join(',') : ''
|
64
|
+
|
65
|
+
model_attributes = ''
|
66
|
+
attribute_names = model.try(:attribute_names) rescue model.columns.map { |c| c.name }
|
67
|
+
attribute_names.each do |attribute|
|
68
|
+
model_attributes << " #{attribute} : #{@writer.types[model.columns_hash[attribute].type.to_s]}\n" if @writer.types.has_key?(model.columns_hash[attribute].type.to_s) && !attribute_blacklist.include?(attribute)
|
69
|
+
end
|
70
|
+
|
71
|
+
#has_many
|
72
|
+
model.reflect_on_all_associations(:has_many).each do |association|
|
73
|
+
#extract associations, also belongs_to are covered by this feature
|
74
|
+
class_name = association.options.has_key?(:as) && abstract_classes.include?(association.options[:as].to_s.camelcase) ? association.options[:as].to_s.camelcase : association.class_name
|
75
|
+
model_associations[:has_many][(model.name.to_s+'_'+association.name.to_s).camelcase] = {class_name: model.name, role_name: (association.name.to_s+model.name).underscore, foreign_class_name: class_name, foreign_role_name: association.name}
|
76
|
+
end
|
77
|
+
|
78
|
+
#has_and_belongs_to_many
|
79
|
+
|
80
|
+
#has_one
|
81
|
+
model.reflect_on_all_associations(:has_one).each do |association|
|
82
|
+
#skip thorugh-associations
|
83
|
+
unless association.options.has_key?(:through)
|
84
|
+
model_associations[:has_one][(model.name.to_s+'_'+association.name.to_s).camelcase] = {class_name: model.name, role_name: (association.name.to_s+model.name).underscore, foreign_class_name: association.class_name, foreign_role_name: association.name}
|
85
|
+
end
|
86
|
+
end
|
87
|
+
@writer.write_class model.name, def_super_classes, model_attributes, model_associations if types.include?('class')
|
88
|
+
end
|
89
|
+
@writer.write_class_end if types.include?('class')
|
90
|
+
|
91
|
+
@writer.write_foot :class if types.include?('class')
|
92
|
+
# end class diagram
|
93
|
+
|
94
|
+
if types.include?('object')
|
95
|
+
@writer.write_head :object
|
96
|
+
all_instances = []
|
97
|
+
all_models.each do |model|
|
98
|
+
all_instances_by_model = model.unscoped.all
|
99
|
+
all_instances += all_instances_by_model
|
100
|
+
all_instances_by_model.each do |instance|
|
101
|
+
instance_name = "#{model.name.underscore}#{instance.id.to_s}"
|
102
|
+
attributes = {}
|
103
|
+
attribute_names = model.try(:attribute_names) rescue model.columns.map { |c| c.name }
|
104
|
+
attribute_names.each do |attribute|
|
105
|
+
if @writer.types.has_key?(model.columns_hash[attribute].type.to_s) && !attribute_blacklist.include?(attribute)
|
106
|
+
value = instance.send attribute
|
107
|
+
attributes[attribute] = value if value.present?
|
108
|
+
end
|
109
|
+
end
|
110
|
+
@writer.write_instance instance_name, model.name, attributes
|
111
|
+
end
|
112
|
+
end
|
113
|
+
all_instances.each do |instance|
|
114
|
+
model = instance.class
|
115
|
+
instance_name = "#{model.name.underscore}#{instance.id.to_s}"
|
116
|
+
model.reflect_on_all_associations(:has_many).each do |association|
|
117
|
+
association_name = (model.name.to_s+'_'+association.name.to_s).camelcase
|
118
|
+
foreign_instances = instance.send association.name
|
119
|
+
foreign_instances = [foreign_instances] unless foreign_instances.is_a?(Enumerable)
|
120
|
+
foreign_instances.each do |foreign_instance|
|
121
|
+
@writer.write_association association_name, instance_name, foreign_instance.class.to_s.underscore+foreign_instance.id.to_s
|
122
|
+
end
|
123
|
+
#class_name = association.options.has_key?(:as) && association.options[:as].to_s.camelcase.in?(abstract_classes) ? association.options[:as].to_s.camelcase : association.class_name
|
124
|
+
end
|
125
|
+
end
|
126
|
+
@writer.write_foot :object
|
127
|
+
end
|
128
|
+
@writer.close
|
129
|
+
options[:file]
|
130
|
+
end
|
131
|
+
end
|
data/rails2use.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rails2use/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rails2use"
|
8
|
+
spec.version = Rails2use::VERSION
|
9
|
+
spec.authors = ["Manuel Dudda"]
|
10
|
+
spec.email = ["dudda@redpeppix.de"]
|
11
|
+
spec.summary = "Extracts all rails model to one UML file written in USE (UML-based Specification Environment)."
|
12
|
+
spec.description = "Currently only ActiveRecord is supported. Wrappers for Mongoid and others are planned."
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency 'rake', '~> 0'
|
23
|
+
spec.add_development_dependency 'rspec', '~> 0'
|
24
|
+
spec.homepage= 'https://github.com/manuel84/rails2use'
|
25
|
+
|
26
|
+
spec.add_runtime_dependency 'rails'#, '~> 0'
|
27
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'rails2use'
|
data/tasks/uml.rake
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
namespace :doc do
|
2
|
+
|
3
|
+
desc 'Generates UML diagrams.'
|
4
|
+
task :uml => :environment do
|
5
|
+
puts 'Generating ...'
|
6
|
+
options = {}
|
7
|
+
options[:file] = ENV['OUTPUT'] if ENV['OUTPUT']
|
8
|
+
options[:writer] = case ENV['FORMAT']
|
9
|
+
when /plant(_)?(uml)?/
|
10
|
+
'PlantumlWriter'
|
11
|
+
when /use(_)?(uml)?/
|
12
|
+
'UseWriter'
|
13
|
+
else
|
14
|
+
'PlantumlWriter'
|
15
|
+
end
|
16
|
+
|
17
|
+
options[:type] = ENV['TYPE'] ? ENV['TYPE'] : 'class'
|
18
|
+
|
19
|
+
file = Rails2use.extract! options
|
20
|
+
puts "using #{options[:writer]}"
|
21
|
+
puts "uml diagrams: #{options[:type]}"
|
22
|
+
puts "output written to #{File.split(file)[0]}."
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails2use
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.33
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Manuel Dudda
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Currently only ActiveRecord is supported. Wrappers for Mongoid and others
|
70
|
+
are planned.
|
71
|
+
email:
|
72
|
+
- dudda@redpeppix.de
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- lib/rails2use.rb
|
83
|
+
- lib/rails2use/plantuml_writer.rb
|
84
|
+
- lib/rails2use/railtie.rb
|
85
|
+
- lib/rails2use/use_writer.rb
|
86
|
+
- lib/rails2use/version.rb
|
87
|
+
- rails2use.gemspec
|
88
|
+
- spec/lib/rails2use_spec.rb
|
89
|
+
- spec/spec_helper.rb
|
90
|
+
- tasks/uml.rake
|
91
|
+
homepage: https://github.com/manuel84/rails2use
|
92
|
+
licenses:
|
93
|
+
- MIT
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.2.2
|
112
|
+
signing_key:
|
113
|
+
specification_version: 4
|
114
|
+
summary: Extracts all rails model to one UML file written in USE (UML-based Specification
|
115
|
+
Environment).
|
116
|
+
test_files:
|
117
|
+
- spec/lib/rails2use_spec.rb
|
118
|
+
- spec/spec_helper.rb
|