Class: Forge::CLI
Class Method Summary collapse
Instance Method Summary collapse
- #build(dir = 'build') ⇒ Object
- #create(dir) ⇒ Object
- #link(path) ⇒ Object
- #package(filename = nil) ⇒ Object
- #watch ⇒ Object
Class Method Details
.source_root ⇒ Object
12 13 14 |
# File 'lib/forge/cli.rb', line 12 def self.source_root File.(File.join(File.dirname(__FILE__), '..', '..', 'layouts')) end |
Instance Method Details
#build(dir = 'build') ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/forge/cli.rb', line 50 def build(dir='build') project = Forge::Project.new('.', self, nil, [:config]) builder = Builder.new(project) builder.build Dir.glob(File.join(dir, '**', '*')).each do |file| shell.mute { remove_file(file) } end directory(project.build_path, dir) end |
#create(dir) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/forge/cli.rb', line 17 def create(dir) theme = {} theme[:name] = dir project = Forge::Project.create(dir, theme, self) end |
#link(path) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/forge/cli.rb', line 27 def link(path) project = Forge::Project.new('.', self) FileUtils.mkdir_p project.build_path unless File.directory?(project.build_path) do_link(project, path) end |
#package(filename = nil) ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/forge/cli.rb', line 65 def package(filename=nil) project = Forge::Project.new('.', self, nil, [:config]) builder = Builder.new(project) builder.build builder.zip(filename) end |
#watch ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/forge/cli.rb', line 38 def watch project = Forge::Project.new('.', self, nil, [:config]) # Empty the build directory before starting up to clean out old files FileUtils.rm_rf project.build_path FileUtils.mkdir_p project.build_path Forge::Guard.start(project, self) end |