Class: Dugway::Cli::Create
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Dugway::Cli::Create
- Includes:
- Thor::Actions
- Defined in:
- lib/dugway/cli/create.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.source_root ⇒ Object
18 19 20 |
# File 'lib/dugway/cli/create.rb', line 18 def self.source_root File.join(File.dirname(__FILE__), 'templates') end |
Instance Method Details
#core ⇒ Object
27 28 29 30 31 |
# File 'lib/dugway/cli/create.rb', line 27 def core template('config.tt', "#{ @theme_dir }/config.ru") template('dugway.tt', "#{ @theme_dir }/.dugway.json") template('source/settings.json', "#{ source_dir }/settings.json") end |
#done ⇒ Object
48 49 50 |
# File 'lib/dugway/cli/create.rb', line 48 def done say("#{ name } is ready!", :blue) end |
#git ⇒ Object
42 43 44 45 46 |
# File 'lib/dugway/cli/create.rb', line 42 def git unless ['skip-git'] copy_file('gitignore.tt', "#{ @theme_dir }/.gitignore") end end |
#source ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/dugway/cli/create.rb', line 33 def source unless ['skip-source'] Dir.glob("#{ self.class.source_root }/source/**/*.{html,jpg,png,js,coffee,css,sass}") do |file| file_name = file.gsub("#{ self.class.source_root }/source/", '') copy_file "source/#{ file_name }", "#{ source_dir }/#{ file_name }" end end end |
#variables ⇒ Object
22 23 24 25 |
# File 'lib/dugway/cli/create.rb', line 22 def variables @name = name.titleize @theme_dir = name.parameterize end |