Class: Workshop::Tasks

Inherits:
Object
  • Object
show all
Includes:
Rake::DSL
Defined in:
lib/workshop/tasks.rb

Instance Method Summary collapse

Constructor Details

#initialize(builder, uploader) ⇒ Tasks

Returns a new instance of Tasks.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/workshop/tasks.rb', line 4

def initialize(builder, uploader)

  desc 'create build directory'
  task :init do
    builder.create_build_directory
  end

  desc 'compile core, variant, and app source code'
  task :compile => [:init] do
    builder.compile
  end

  desc 'create archive from core, variant, and app source (except main loop file)'
  task :archive => [:compile] do
    builder.archive
  end

  desc 'link archive and main loop object file'
  task :link => [:archive] do
    builder.link
  end

  desc 'create eeprom file'
  task :eeprom => [:link] do
    builder.create_eeprom
  end

  desc 'create compiled *.hex file'
  task :hex => [:link] do
    builder.create_hex
  end

  desc 'delete build directory'
  task :clean do
    puts "Removing the build directory"
    builder.clean
  end

  desc 'upload *.hex file to arduino'
  task :upload => [:build] do
    uploader.upload
  end

  desc 'open a console to the arduino (ctrl-a ctrl-| to exit)'
  task :console do
    sh "screen #{uploader.com_port} 9600"
  end

  desc 'build *.hex and eeprom files'
  task :build => [:hex, :eeprom]

  desc 'find connected arduino and update config/com_port.yml with port'
  task :find do
    # TODO - find COM port and create config/com_port.yml
  end

  desc 'build application'
  task :default => :build
end