Class: Spike
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Spike
- Includes:
- Thor::Actions
- Defined in:
- lib/spike.rb
Constant Summary collapse
- CSS_LOCATIONS =
{}
- JS_LOCATIONS =
{}
Class Method Summary collapse
Instance Method Summary collapse
- #create_application_files ⇒ Object
- #create_css_dir ⇒ Object
- #create_css_files ⇒ Object
- #create_images_dir ⇒ Object
- #create_javascripts_dir ⇒ Object
- #create_project_dir ⇒ Object
- #run_initializers ⇒ Object
Class Method Details
.banner ⇒ Object
14 15 16 |
# File 'lib/spike.rb', line 14 def self. "spike #{self.arguments.map{ |a| a.usage }.join(' ')} [options]" end |
.source_root ⇒ Object
18 19 20 |
# File 'lib/spike.rb', line 18 def self.source_root File.dirname(__FILE__) end |
Instance Method Details
#create_application_files ⇒ Object
54 55 56 57 |
# File 'lib/spike.rb', line 54 def create_application_files template "template/app.css", "#{project}/css/app.css" template "template/index.html", "#{project}/index.html" end |
#create_css_dir ⇒ Object
41 42 43 |
# File 'lib/spike.rb', line 41 def create_css_dir empty_directory "#{project}/css" end |
#create_css_files ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/spike.rb', line 45 def create_css_files @css_locations = [] CSS_LOCATIONS[[:css]].each do |loc| #todo - if location is URI, dont copy and include as-is for css location copy_file loc, "#{project}/css/#{File.basename(loc)}" @css_locations << "css/#{File.basename(loc)}" end end |
#create_images_dir ⇒ Object
33 34 35 |
# File 'lib/spike.rb', line 33 def create_images_dir empty_directory "#{project}/images" end |
#create_javascripts_dir ⇒ Object
37 38 39 |
# File 'lib/spike.rb', line 37 def create_javascripts_dir empty_directory "#{project}/javascripts" end |
#create_project_dir ⇒ Object
30 31 32 |
# File 'lib/spike.rb', line 30 def create_project_dir empty_directory project end |
#run_initializers ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/spike.rb', line 22 def run_initializers Dir["#{Spike.source_root}/initializers/*.rb"].each do |ext| File.open(ext) do |f| instance_eval f.read end end end |