Class: Workbench::Cli
- Inherits:
-
Thor
- Object
- Thor
- Workbench::Cli
- Includes:
- Thor::Actions
- Defined in:
- lib/work_bench/cli.rb
Overview
CLI application for Workbench
Class Method Summary collapse
Instance Method Summary collapse
- #export(path = 'export') ⇒ Object
- #init(path = '.') ⇒ Object
- #js ⇒ Object
- #start(path = '.') ⇒ Object
- #version ⇒ Object
Class Method Details
.source_root ⇒ Object
10 11 12 |
# File 'lib/work_bench/cli.rb', line 10 def self.source_root File.join(File.dirname(__FILE__), '..', '..', 'template') end |
Instance Method Details
#export(path = 'export') ⇒ Object
84 85 86 87 |
# File 'lib/work_bench/cli.rb', line 84 def export path = 'export' export = Workbench::Exporter.new File.('.'), File.join(File.('.'), path), [:fix_urls] export.process end |
#init(path = '.') ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/work_bench/cli.rb', line 49 def init path = '.' puts 'Create empty project'.color(:green) self.destination_root = File. path empty_directory 'haml' empty_directory 'sass' empty_directory 'public/css' empty_directory 'public/js' empty_directory 'public/img' if [:normalize] copy_file '_normalize.scss', 'sass/_normalize.scss' end if [:js] && ![:js].empty? js_libs = Workbench::JSLibs::LIST [:js].each do |js| if js_libs[js] get js_libs[js], "public/js/#{File.basename(js_libs[js])}" end end end copy_file 'scripts.js', 'public/js/scripts.js' template 'style.sass', 'sass/style.sass' template 'index.haml', 'haml/index.haml' copy_file 'Gemfile', 'Gemfile' end |
#js ⇒ Object
95 96 97 98 |
# File 'lib/work_bench/cli.rb', line 95 def js puts 'Available JS frameworks'.color(:green) Workbench::JSLibs::LIST.each { |index, item| puts " * #{index.color(:blue)} => #{item}" } end |
#start(path = '.') ⇒ Object
28 29 30 31 32 33 |
# File 'lib/work_bench/cli.rb', line 28 def start path = '.' path = File. path puts 'Starting HTTP server...'.color(:green) app = Workbench::Application.new path app.start [:port], [:workers] end |