rails_script 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74674fb169fb1798caf69614bdacee3df6d39d2f
4
- data.tar.gz: e6c987739e6ae8fc3fd2b129fbc3f2a78432165f
3
+ metadata.gz: a45c4e0cfcd3d7119e7bbfdd5faced86fff4fdf6
4
+ data.tar.gz: a2eea95db0864953d79755ba049ee60439950360
5
5
  SHA512:
6
- metadata.gz: daa009dcada287f2e959bac9a0752cbb307944436740392eb05e4dafd76a9bc64ef72df589ad9e94b846f6b67955d0c0876f5b0799c0b108eb2d233d061317e8
7
- data.tar.gz: 7ea7f35d25860c84ab242adc12c7910d53d6ef9861457e51074565d1d5cababaa7e869acaa9d6a1d68bccaaab6c528a5f108ae832d27e74ea7f50e1d3e0cfcf7
6
+ metadata.gz: 6ca7226ed715dc5e8132763055c0034433928e4b46954bfce6e89b0e322ca1a924553df64c2b771350e26b28515447bc2c09e82fa33b2110a5551af5677d6679
7
+ data.tar.gz: 324e36c76dee1acfe112fe9afb781101005c303895d68f59b723efb3687e9201eda8572a12a4384a392b9a92c5a9f87bffd042c2b5258115a156850f23574ca7
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Rails Script
1
+ # RailsScript
2
2
 
3
- Rails Script is a Rails-centric, object oriented, featherweight framework for writting CoffeeScript. It is optomized for the [Rails Asset Pipeline](http://guides.rubyonrails.org/asset_pipeline.html) and is compatible with [TurboLinks](https://github.com/rails/turbolinks). Using Rails controller names and actions to call JavaScript, it has never been easier to write clean, concise, and maintanable page specific JavaScript.
3
+ RailsScript is a Rails-centric, object oriented, featherweight framework for writting CoffeeScript. It is optomized for the [Rails Asset Pipeline](http://guides.rubyonrails.org/asset_pipeline.html) and is compatible with [TurboLinks](https://github.com/rails/turbolinks). Using Rails controller names and actions to call JavaScript, it has never been easier to write clean, concise, and maintanable page specific JavaScript.
4
4
 
5
5
  ## Installation
6
6
 
@@ -16,7 +16,7 @@ After bundling you need to run the initial installation generator:
16
16
 
17
17
  $ rails g rails_script:install
18
18
 
19
- After the generator finishes, you will be prompted to add helper call to your application layout. The generated code is responsible for initializing and call the action specific JavaScript. This helper shouyld be called before the closing body tag.
19
+ After the generator finishes, you will be prompted to add helper call to your application layout. The generated code is responsible for initializing and calling the action specific JavaScript. This helper shouyld be called before the closing body tag.
20
20
 
21
21
  ```
22
22
  <%= include_rails_script %>
@@ -107,7 +107,7 @@ In this example we extracted the rollover action into a new function. Doing so
107
107
 
108
108
  ### Generating New Controllers
109
109
 
110
- When a new controller is generated, the JavaScript asset file will be generated with Rails Script. However, if you need to manually generate a Rails Script controller you can use:
110
+ When a new controller is generated, the JavaScript asset file will be generated with RailsScript. However, if you need to manually generate a RailsScript controller you can use:
111
111
 
112
112
  $ rails g rails_script:controller Some::NewController
113
113
 
@@ -2,24 +2,10 @@ module RailsScript
2
2
  module Generators
3
3
  class ControllerGenerator < ::Rails::Generators::Base
4
4
  source_root File.expand_path("../templates", __FILE__)
5
- argument :controller_name, type: :string, default: ''
6
- hook_for :controller
5
+ argument :controller, type: :string
7
6
 
8
7
  def generate_file
9
- if controller_name.blank?
10
- Rails.application.eager_load!
11
- controllers = ApplicationController.descendants.map(&:to_s)
12
- controllers.each{ |c| c.gsub!('Controller', '') }
13
- else
14
- controllers = [controller_name]
15
- end
16
-
17
- controllers.each do |controller|
18
- if !File.exist?("app/assets/javascripts/#{controller.underscore}.js.coffee")
19
- template 'javascript.js.coffee', "app/assets/javascripts/#{controller.underscore}.js.coffee"
20
- gsub_file "app/assets/javascripts/#{controller.underscore}.js.coffee", 'Example', controller.gsub('::', '')
21
- end
22
- end
8
+ template 'javascript.js.coffee', "app/assets/javascripts/#{controller.underscore}.js.coffee"
23
9
  end
24
10
 
25
11
  end
@@ -1,5 +1,5 @@
1
1
  window.App ||= {}
2
- class App.Example extends App.Base
2
+ class App.<%= controller.gsub('::', '') %> extends App.Base
3
3
 
4
4
  constructor: ->
5
5
  super
@@ -16,10 +16,6 @@ module RailsScript
16
16
  end
17
17
  end
18
18
 
19
- def create_controllers
20
- generate 'rails_script:controller'
21
- end
22
-
23
19
  def insert_layout_javascript
24
20
  say <<-RUBY
25
21
  In order to complete installation, you must include the following helper BEFORE the closing body tag in the application layout:
@@ -1,3 +1,3 @@
1
1
  module RailsScript
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_script
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Pheasey