Class: RailsERD::CLI
- Inherits:
-
Object
- Object
- RailsERD::CLI
- Defined in:
- lib/rails_erd/cli.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path, options) ⇒ CLI
constructor
A new instance of CLI.
- #start ⇒ Object
Constructor Details
#initialize(path, options) ⇒ CLI
Returns a new instance of CLI.
165 166 167 168 |
# File 'lib/rails_erd/cli.rb', line 165 def initialize(path, ) @path, @options = path, require "rails_erd/diagram/graphviz" if .generator == :graphviz end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
144 145 146 |
# File 'lib/rails_erd/cli.rb', line 144 def @options end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
144 145 146 |
# File 'lib/rails_erd/cli.rb', line 144 def path @path end |
Class Method Details
.start ⇒ Object
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/rails_erd/cli.rb', line 147 def start path = Choice.rest.first || Dir.pwd = Choice.choices.each_with_object({}) do |(key, value), opts| if key.start_with? "no_" opts[key.gsub("no_", "").to_sym] = !value elsif value.to_s.include? "," opts[key.to_sym] = value.split(",").map(&:to_s) else opts[key.to_sym] = value end end if [:config_file] && [:config_file] != '' RailsERD. = RailsERD..merge(Config.load([:config_file])) end new(path, ).start end |
Instance Method Details
#start ⇒ Object
170 171 172 173 174 175 176 |
# File 'lib/rails_erd/cli.rb', line 170 def start load_application create_diagram rescue Exception => e $stderr.puts "Failed: #{e.class}: #{e.}" $stderr.puts e.backtrace.map { |t| " from #{t}" } if [:debug] end |