Skip to content

Commit 74cc091

Browse files
committed
Add a class generator for creating a new class with no RESTful functions.
1 parent 69514ff commit 74cc091

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

lib/generators/rails_script/class/USAGE

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module RailsScript
2+
module Generators
3+
class ClassGenerator < ::Rails::Generators::Base
4+
source_root File.expand_path("../templates", __FILE__)
5+
argument :class_name, type: :string
6+
7+
def generate_file
8+
template 'javascript.js.coffee', "app/assets/javascripts/#{class_name.underscore}.js.coffee"
9+
end
10+
11+
end
12+
end
13+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
window.App ||= {}
2+
class App.<%= class_name.gsub('::', '') %> extends App.Base
3+
4+
constructor: ->
5+
super
6+
return this

lib/generators/rails_script/install/install_generator.rb

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def insert_layout_javascript
2121
In order to complete installation, you must include the following helper BEFORE the closing body tag in the application layout:
2222
2323
<%= include_rails_script %>
24+
2425
RUBY
2526
end
2627

0 commit comments

Comments
 (0)