Method: Cf::Form#preview

Defined in:
lib/cf/cli/form.rb

#previewObject



65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/cf/cli/form.rb', line 65

def preview
  line_destination = Dir.pwd
  unless File.exist?("#{line_destination}/line.yml")
    say("The current directory is not a valid line directory.", :red) and return
  end
  if File.exist?("#{line_destination}/station#{options[:station]}.html")
    say "Generating preview form for station #{options[:station]}", :green
    form_content = File.read("station#{options[:station]}.html")
    Cf::FormPreview.start([options[:station], form_content])
  else
    say "No form exists for station #{options[:station]}", :red
    say "Generate the form for station 2 and then preview it.", :red
  end
end