Class: Jib::Compiler

Inherits:
Object
  • Object
show all
Defined in:
lib/jib.rb

Instance Method Summary collapse

Instance Method Details

#compileObject



132
133
134
135
136
137
# File 'lib/jib.rb', line 132

def compile
  compile_targets.each do |src, dest|
    Kernel.system("coffee -o #{dest} -c #{src}")
    Kernel.exit(1) unless $? == 0
  end
end

#compile_sources(list) ⇒ Object



144
145
146
# File 'lib/jib.rb', line 144

def compile_sources(list)
  list.select { |src| File.extname(src) == ".coffee" }
end

#compile_targetsObject



139
140
141
142
# File 'lib/jib.rb', line 139

def compile_targets
  target(compile_sources(Jib.config.sources), Jib.config.source_path) +
    target(compile_sources(Jib.config.specs), Jib.config.spec_path)
end

#target(sources, path) ⇒ Object



148
149
150
151
152
153
154
155
# File 'lib/jib.rb', line 148

def target(sources, path)
  sources.map do |filename|
    [
      File.join(Jib.root, path, filename),
      File.dirname(File.join(Jib.workspace_path, path, filename))
    ]
  end
end