Class: InesitaCLI
- Inherits:
-
Thor
- Object
- Thor
- InesitaCLI
- Includes:
- Thor::Actions
- Defined in:
- lib/inesita/cli/new.rb,
lib/inesita/cli/build.rb,
lib/inesita/cli/watch.rb,
lib/inesita/cli/server.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.source_root ⇒ Object
23 24 25 |
# File 'lib/inesita/cli/new.rb', line 23 def self.source_root File.dirname(__FILE__) end |
Instance Method Details
#build ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/inesita/cli/build.rb', line 35 def build assets = assets_server empty_directory [:destination_dir], force: [:force] copy_static create_asset(assets, 'index.html', ->(s) { Inesita::Minify.html(s) }) create_asset(assets, 'application.js', ->(s) { Inesita::Minify.js(s) }) create_asset(assets, 'stylesheet.css', ->(s) { Inesita::Minify.css(s) }) end |
#new(project_dir) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/inesita/cli/new.rb', line 15 def new(project_dir) directory('template', project_dir, project_name: project_dir, build_dir: Inesita::Config::BUILD_DIR) inside project_dir do run 'bundle install' end end |
#server ⇒ Object
17 18 19 |
# File 'lib/inesita/cli/server.rb', line 17 def server Rack::Server.start config: 'config.ru', Port: ['port'], Host: ['host'] end |
#watch ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/inesita/cli/watch.rb', line 35 def watch puts 'building...' build puts 'done.' listener = Listen.to([:source_dir]) do |_modified, _added, _removed| puts "rebuilding..." build puts "done." end.start loop { sleep 1000 } end |