Class: Burn::BurnTasks

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/burn/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ BurnTasks

Returns a new instance of BurnTasks.



8
9
10
11
12
# File 'lib/burn/cli.rb', line 8

def initialize(*args)
  super
  @workspace_root = Dir.getwd
  @os = Util::Os.new
end

Class Method Details

.source_rootObject

desc “release”, “To be designed”



77
78
79
# File 'lib/burn/cli.rb', line 77

def self.source_root
  File.dirname(__FILE__) + "/.."
end

Instance Method Details

#fire(mainfile = nil) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/burn/cli.rb', line 51

def fire(mainfile=nil)
  mainfile="main.rb" if mainfile.nil?
  load_conf_and_options(mainfile)
  if options[:rom_server] then
    server "#{@workspace_root}/tmp/burn/release/js/", mainfile

  else
    if @conf.app.target==:rom then
      make_and_play mainfile, options[:preview]

    elsif @conf.app.target==:telnet then
      say "starting telnet server #{@conf.server.ip_addr}:#{@conf.server.port}...."
      Server::Telnet.new(File.read("#{@workspace_root}/#{mainfile}"), @conf).start
    end
  end

end

#fuel(filename = nil) ⇒ Object



41
42
43
44
45
# File 'lib/burn/cli.rb', line 41

def fuel(filename=nil)
  textfile = !filename.nil? ? File.read(filename) : $stdin.read
  fuel = Util::Txt2Fuel.new(options[:width], options[:height], options[:separator], options[:rabbit_timer])
  say fuel.convert(textfile)
end

#initObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/burn/cli.rb', line 16

def init
  base_path = "#{File.dirname(__FILE__)}/tools"
  remove_dir base_path+ "/"+@os.name, :verbose => options[:verbose]
  Util::Unpack.new.unpack "#{base_path}/#{@os.name}.tar.gz", base_path
  if !@os.is_win? && !options[:quick] then
    Util::Unpack.new.unpack "#{base_path}/src.tar.gz", base_path
    run "/bin/bash #{File.dirname(__FILE__)}/tools/make_exec.sh #{base_path}"
    ["cc","ca","ld"].each do |pre|
      copy_file "#{base_path}/src/#{pre}65/#{pre}65", "#{base_path}/#{@os.name}/cc65/bin/#{pre}65", :force => true
    end
  end
  say <<-EOS
#{Util::Logo.new(VERSION).to_s}

successfully finished. you've got ready to burn.

EOS
end

#versionObject



71
72
73
# File 'lib/burn/cli.rb', line 71

def version
  say "burn #{Burn::VERSION}"
end