class Forge::CLI
Public Class Methods
source_root()
click to toggle source
# File lib/forge/cli.rb, line 12 def self.source_root File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'layouts')) end
Public Instance Methods
build(dir='build')
click to toggle source
# File lib/forge/cli.rb, line 50 def build(dir='build') project = Forge::Project.new('.', self, nil, options[: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)
click to toggle source
# File lib/forge/cli.rb, line 17 def create(dir) theme = {} theme[:name] = dir project = Forge::Project.create(dir, theme, self) end
link(path)
click to toggle source
# 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)
click to toggle source
# File lib/forge/cli.rb, line 65 def package(filename=nil) project = Forge::Project.new('.', self, nil, options[:config]) builder = Builder.new(project) builder.build builder.zip(filename) end
watch()
click to toggle source
# File lib/forge/cli.rb, line 38 def watch project = Forge::Project.new('.', self, nil, options[: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
Protected Instance Methods
do_link(project, path)
click to toggle source
# File lib/forge/cli.rb, line 74 def do_link(project, path) begin project.link(path) rescue LinkSourceDirNotFound say_status :error, "The path #{File.dirname(path)} does not exist", :red exit 2 rescue Errno::EEXIST say_status :error, "The path #{path} already exsts", :red exit 2 end end