Class: Spike

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/spike.rb

Constant Summary collapse

CSS_LOCATIONS =
{}
JS_LOCATIONS =
{}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



14
15
16
# File 'lib/spike.rb', line 14

def self.banner
  "spike #{self.arguments.map{ |a| a.usage }.join(' ')} [options]"
end

.source_rootObject



18
19
20
# File 'lib/spike.rb', line 18

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#create_application_filesObject



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_dirObject



41
42
43
# File 'lib/spike.rb', line 41

def create_css_dir
   empty_directory "#{project}/css"
end

#create_css_filesObject



45
46
47
48
49
50
51
52
# File 'lib/spike.rb', line 45

def create_css_files
  @css_locations = []
  CSS_LOCATIONS[options[: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_dirObject



33
34
35
# File 'lib/spike.rb', line 33

def create_images_dir
   empty_directory "#{project}/images"
end

#create_javascripts_dirObject



37
38
39
# File 'lib/spike.rb', line 37

def create_javascripts_dir
   empty_directory "#{project}/javascripts"
end

#create_project_dirObject



30
31
32
# File 'lib/spike.rb', line 30

def create_project_dir
  empty_directory project
end

#run_initializersObject



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