Sha256: 8be431bbe4026476bf28c6bdfec15fcf2fde18d5fa35ddf1d5d7972a7b2cda0f
Contents?: true
Size: 1.92 KB
Versions: 1
Compression:
Stored size: 1.92 KB
Contents
require "chinstrap/version" require "thor" module Chinstrap class CLI < Thor include Thor::Actions desc "new [APP_NAME]", "Create a new skeleton for a Sinatra application named [APP_NAME]" def new(name) name = name.chomp("/") target = File.join(Dir.pwd, name) constant_name = name.split('_').map{ |p| p[0..0].upcase + p[1..-1] }.join constant_name = constant_name.split('-').map{ |q| q[0..0].upcase + q[1..-1] }.join('::') if constant_name =~ /-/ options = { name: name, constant_name: constant_name } empty_directory target empty_directory File.join(target, "app/models") template File.join("app/routes/main.rb"), File.join(target, "app/routes/main.rb"), options empty_directory File.join(target, "app/views") template File.join("app/app.rb"), File.join(target, "app/#{name}.rb"), options template File.join("config/environment.rb"), File.join(target, "config/environment.rb"), options empty_directory File.join(target, "lib") template File.join("test/test_helper.rb"), File.join(target, "test/test_helper.rb"), options empty_directory File.join(target, "tmp") empty_directory File.join(target, "vendor") template File.join("gitignore"), File.join(target, ".gitignore"), options template File.join("config.ru"), File.join(target, "config.ru"), options template File.join("Gemfile"), File.join(target, "Gemfile"), options template File.join("Rakefile"), File.join(target, "Rakefile"), options end def self.source_root File.expand_path(File.join(File.dirname(__FILE__), "chinstrap/templates")) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
chinstrap-0.0.1 | lib/chinstrap.rb |