Class: CappRuby::FrameworkBuilder

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

Overview

class used for building CappRuby framework

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFrameworkBuilder

Returns a new instance of FrameworkBuilder.



34
35
36
37
# File 'lib/cappruby/framework_builder.rb', line 34

def initialize
  @app_root = Dir.getwd
  @build_dir = File.join(Dir.getwd, 'frameworks', 'CappRuby')
end

Instance Attribute Details

#build_dirObject (readonly)

Returns the value of attribute build_dir.



32
33
34
# File 'lib/cappruby/framework_builder.rb', line 32

def build_dir
  @build_dir
end

Instance Method Details

#build!Object



39
40
41
42
# File 'lib/cappruby/framework_builder.rb', line 39

def build!
  FileUtils.mkdir_p build_dir
  write_cappruby_j_file
end

#cappruby_j_fileObject



44
45
46
# File 'lib/cappruby/framework_builder.rb', line 44

def cappruby_j_file
  File.join(build_dir, 'CappRuby.j')
end

#write_cappruby_j_fileObject



48
49
50
51
52
53
54
55
56
57
# File 'lib/cappruby/framework_builder.rb', line 48

def write_cappruby_j_file
  File.open cappruby_j_file, 'w' do |f|
    sources = File.join(ROOTPATH, 'framework', '**', '*.js')
    Dir.glob(sources).each do |s|
      i = File.read(s)
      # should really minify
      f.puts i
    end
  end
end