Class: CLI
- Includes:
- Thor::Actions
- Defined in:
- lib/volt/cli.rb,
lib/volt/cli/asset_compile.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.source_root ⇒ Object
69 70 71 |
# File 'lib/volt/cli.rb', line 69 def self.source_root File.(File.join(File.dirname(__FILE__), '../../templates')) end |
Instance Method Details
#console ⇒ Object
18 19 20 21 |
# File 'lib/volt/cli.rb', line 18 def console require 'volt/console' Console.start end |
#gem(name) ⇒ Object
63 64 65 66 67 |
# File 'lib/volt/cli.rb', line 63 def gem(name) require 'volt/cli/new_gem' NewGem.new(self, name, ) end |
#new(name) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/volt/cli.rb', line 8 def new(name) # Grab the current volt version version = File.read(File.join(File.dirname(__FILE__), '../../VERSION')) directory("project", name, {version: version, name: name}) say "Bundling Gems...." `cd #{name} ; bundle -j 4` end |
#precompile ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/volt/cli/asset_compile.rb', line 4 def precompile require 'fileutils' require 'opal' require 'volt' require 'volt/server/rack/component_paths' require 'volt/server/rack/component_code' require 'volt/server/rack/opal_files' write_component_js write_sprockets end |
#server ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/volt/cli.rb', line 25 def server require 'thin' require 'fileutils' # If we're in a Volt project, clear the temp directory # TODO: this is a work around for a bug when switching between # source maps and non-source maps. if File.exists?("config.ru") && File.exists?("Gemfile") FileUtils.rm_rf("tmp/.") else say("Current folder is not a Volt project", :red) return end ENV['SERVER'] = 'true' args = ['start', '--threaded', '--max-persistent-conns', '300', "--max-conns", "400"] if [:port] args += ['-p', [:port].to_s] end Thin::Runner.new(args).run! # require 'volt/server' # # EM.run do # thin = Rack::Handler.get("thin") # thin.run(Server.new.app, Port: 3000) # end end |