Class: LucidMachines::CLI
- Inherits:
-
Thor
- Object
- Thor
- LucidMachines::CLI
- Defined in:
- lib/lucidMachines/cli.rb
Instance Method Summary collapse
- #convert(csv_file, sheet = "", class_name = "MyClass") ⇒ Object
- #list(csv_file) ⇒ Object
- #update(csv_file, sheet, file, class_name) ⇒ Object
Instance Method Details
#convert(csv_file, sheet = "", class_name = "MyClass") ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/lucidMachines/cli.rb', line 9 def convert(csv_file, sheet = "", class_name = "MyClass") chart = ChartLoader.new(csv_file).chart if(sheet == "") export_all chart else export(chart, sheet, class_name) end end |
#list(csv_file) ⇒ Object
43 44 45 46 47 |
# File 'lib/lucidMachines/cli.rb', line 43 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
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/lucidMachines/cli.rb', line 20 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) 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 |