Class: LucidMachines::CLI
- Inherits:
-
Thor
- Object
- Thor
- LucidMachines::CLI
- Defined in:
- lib/lucidMachines/cli.rb
Instance Method Summary collapse
- #convert(csv_file, sheet = "") ⇒ Object
- #list(csv_file) ⇒ Object
- #update(csv_file, sheet, file, class_name) ⇒ Object
Instance Method Details
#convert(csv_file, sheet = "") ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/lucidMachines/cli.rb', line 10 def convert(csv_file, sheet = "") chart = ChartLoader.new(csv_file).chart if(sheet == "") export_all chart else export(chart, sheet) end end |
#list(csv_file) ⇒ Object
44 45 46 47 48 |
# File 'lib/lucidMachines/cli.rb', line 44 def list(csv_file) chart = ChartLoader.new(csv_file).chart chart.pages.each_value {|p| puts p.name.to_s } end |
#update(csv_file, sheet, file, class_name) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/lucidMachines/cli.rb', line 21 def update(csv_file, sheet, file, class_name) puts "Exporting #{csv_file}, sheet: #{sheet}." require "./#{file}" @chart = ChartLoader.new(csv_file).chart page = @chart.page(sheet) subchart = @chart.subchart_for_page page c = Object.const_get(class_name) puts c.class.to_s @ae = AASMExport.new(subchart); nil ; c.class_eval @ae.export # puts @ae.generate_methods_placeholder_for(c).to_s open("#{file}-updated.rb", 'w') do |f| # f << @ae.export f << @ae.generate_methods_placeholder_for(c) end end |