Class: Clamshell::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/clamshell/cli.rb

Instance Method Summary collapse

Constructor Details

#initializeCLI

Returns a new instance of CLI.



6
7
8
9
# File 'lib/clamshell/cli.rb', line 6

def initialize(*)
  super
  Clamshell.settings = options
end

Instance Method Details

#convert(file) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/clamshell/cli.rb', line 14

def convert(file)
  check_file(file)

  file_out = Clamshell.settings[:shell_out]
  if file_out
    File.open(file_out, "w") {|f| f.write(Dsl.build(file) + "\n") }
  else
    puts Dsl.build(file)
  end
end

#convert_string(string) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/clamshell/cli.rb', line 27

def convert_string(string)
  input = <<-I
    Environment.setup do
      #{string}
    end
  I
  puts instance_eval(input).inspect
end