Class: Subduino::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/subduino/scaffold/generator.rb

Constant Summary collapse

Files =
%w{ Makefile scaffold.rb scaffold.pde}

Class Method Summary collapse

Class Method Details

.copy_files(dir) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/subduino/scaffold/generator.rb', line 8

def copy_files(dir)
  name = dir.split("/").last
  Files.each do |file|
    puts "Working on #{file}"
    dump = File.open(File.dirname(__FILE__) + "/#{file}").readlines
    file.gsub!(/scaffold/, name)
    File.open(dir + "/#{file}", 'w') do |f|
      f.write(dump.join.gsub(/!!SCAFFOLD!!/, name))
    end
  end
end

.os_detectObject



20
21
22
23
24
25
26
# File 'lib/subduino/scaffold/generator.rb', line 20

def os_detect
  case RUBY_PLATFORM
  when /linux/ then ""
  when /darwin/ then ""
    else raise "Dunno how to play with #{RUBY_PLATFORM}"
  end
end