class Embork::CLI
Public Instance Methods
build(environment = :production)
click to toggle source
# File lib/embork/cli.rb, line 64 def build(environment = :production) borkfile = Embork::Borkfile.new options[:borkfile], environment builder = Embork::Builder.new(borkfile) builder.build end
clean()
click to toggle source
# File lib/embork/cli.rb, line 71 def clean borkfile = Embork::Borkfile.new options[:borkfile] FileUtils.rm_rf File.expand_path('build', borkfile.project_root) end
clean_cache()
click to toggle source
# File lib/embork/cli.rb, line 77 def clean_cache borkfile = Embork::Borkfile.new options[:borkfile] FileUtils.rm_rf File.expand_path('.cache', borkfile.project_root) end
create(package_name)
click to toggle source
# File lib/embork/cli.rb, line 12 def create(package_name) puts %{Creating embork app in "%s"} % package_name Embork::Generator.new(package_name, options).generate end
deps()
click to toggle source
# File lib/embork/cli.rb, line 91 def deps if !system('which node 2>&1 > /dev/null') puts "Please install node and npm before continuing." exit 1 elsif !system('which npm 2>&1 > /dev/null') puts "Please install npm before continuing." exit 1 end borkfile = Embork::Borkfile.new options[:borkfile] Dir.chdir borkfile.project_root do system('npm install') system('PATH=$(npm bin):$PATH bower install') end end
hint()
click to toggle source
# File lib/embork/cli.rb, line 83 def hint borkfile = Embork::Borkfile.new options[:borkfile] Dir.chdir borkfile.project_root do system('PATH=$(npm bin):$PATH jshint app tests') end end
phrender(environment = :development)
click to toggle source
# File lib/embork/cli.rb, line 33 def phrender(environment = :development) borkfile = Embork::Borkfile.new options[:borkfile], environment Embork::Phrender.new(borkfile, options).run_webrick end
server(environment = :development)
click to toggle source
# File lib/embork/cli.rb, line 23 def server(environment = :development) borkfile = Embork::Borkfile.new options[:borkfile], environment Embork::Server.new(borkfile, options).run_webrick end
test(environment = :development)
click to toggle source
# File lib/embork/cli.rb, line 39 def test(environment = :development) borkfile = Embork::Borkfile.new options[:borkfile], environment min = 52000 max = 65000 port = (Random.rand * (max - min) + min).to_i host = '0.0.0.0' server_options = { :host => host, :port => port, :enable_tests => true, :disable_logging => true } server = Embork::Server.new(borkfile, server_options) server_thread = Thread.new{ server.run_webrick } test_url = "http://%s:%s/tests.html" % [ host, port ] Qunit::Runner.new(test_url).run(10000) server_thread.kill end