module Swift::Boiler

Constants

VERSION

Public Class Methods

boil(arguments) click to toggle source
# File lib/swift/boiler.rb, line 11
def boil(arguments)
  if is_help_request(arguments) 
    print_help_text()
  else 
    begin
      template = build_template_from_arguments(arguments)
      create_file_from_template(template)    
    rescue ArgumentError => argumentError
      print "swift-boiler: #{argumentError.message}. Please see 'swift-boil --help'."
    end
  end
end

Private Class Methods

build_template_from_arguments(arguments) click to toggle source
# File lib/swift/boiler.rb, line 31
def build_template_from_arguments(arguments)
  scanner = Swift::Boiler::Scanner.new
  parser = Swift::Boiler::Parser.new
  tokens = scanner.create_valid_token_pattern_from_arguments(arguments)
  template = parser.create_template_from_tokens(tokens)
  template
end
create_file_from_template(template) click to toggle source
# File lib/swift/boiler.rb, line 26
def create_file_from_template(template)
  builder = Swift::Boiler::Builder.new
  builder.build_template(template)
end
is_help_request(arguments) click to toggle source
# File lib/swift/boiler.rb, line 39
def is_help_request(arguments)
  return arguments[0] == '-h' || arguments[0] == '--help' || arguments == []
end
print_help_text() click to toggle source