Class: WidgetGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/lsd/widget_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_widget_fileObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/lsd/widget_generator.rb', line 9

def create_widget_file
  widgets_path = "public/javascripts/Source/Widget"
  @widget_name = @widget_name.classify
  @app_name = LSD.detect_project_name
  
  empty_directory(widgets_path)
  
  inside(widgets_path) do
    template(self.class.source_root + "new_widget.js", @widget_name + '.js')
  end
  
  append_to_file(widgets_path + '/../package.yml') do
    %{\n  - "Widget/#{@widget_name}.js"}
  end
end