rails_script 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d5b46f04cb39d9d79a4f57d88e536c2f2527b179
4
+ data.tar.gz: 0a9f9c488c7d8c0a6afe31a4b9afd13b2f2d4cd5
5
+ SHA512:
6
+ metadata.gz: d3a613986d7760ce2d3e60b5b604c7760fb0d02590ef46be91a6d3d737288cfdf255ef60a4440cb70644111fb56cc4605dc6b1cc8bee052d248184c40f8ab16e
7
+ data.tar.gz: 142aab5ca3b550b0b95c0745743fc5f108213287efc22a35113ecc5dba75c2dfebf4edaa1d7faf4d7830f920d0d06677247ba62a91722bbd7101c8b885d93065
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
23
+ .idea
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rails_script.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Kevin
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # RailsScript
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'rails_script'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install rails_script
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( https://github.com/[my-github-username]/rails_script/fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
File without changes
@@ -0,0 +1,27 @@
1
+ module RailsScript
2
+ module Generators
3
+ class ControllerGenerator < ::Rails::Generators::Base
4
+ source_root File.expand_path("../templates", __FILE__)
5
+ argument :controller_name, type: :string, default: ''
6
+ hook_for :controller
7
+
8
+ 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
23
+ end
24
+
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,22 @@
1
+ window.App ||= {}
2
+ class App.Example extends App.Base
3
+
4
+ constructor: ->
5
+ super
6
+ return this
7
+
8
+
9
+ index: ->
10
+ return
11
+
12
+
13
+ show: ->
14
+ return
15
+
16
+
17
+ new: ->
18
+ return
19
+
20
+
21
+ edit: ->
22
+ return
File without changes
@@ -0,0 +1,50 @@
1
+ module RailsScript
2
+ module Generators
3
+ class InstallGenerator < ::Rails::Generators::Base
4
+ source_root File.expand_path("../templates", __FILE__)
5
+
6
+ def copy_files
7
+ template 'base.js.coffee', 'app/assets/javascripts/base.js.coffee'
8
+ template 'global.js.coffee', 'app/assets/javascripts/global.js.coffee'
9
+ end
10
+
11
+ def insert_load_order
12
+ if File.exist?('app/assets/javascripts/application.js')
13
+ inject_into_file 'app/assets/javascripts/application.js', "\n//= require base", before: "\n//= require_tree ."
14
+ elsif File.exist?('app/assets/javascripts/application.js.coffee')
15
+ inject_into_file 'app/assets/javascripts/application.js.coffee', "\n#= require base", before: "\n#= require_tree ."
16
+ end
17
+ end
18
+
19
+ def create_controllers
20
+ generate 'rails_script:controller'
21
+ end
22
+
23
+ def insert_layout_javascript
24
+ say <<-RUBY
25
+ In order to complete installation, you must add the following JavaScript snippet before the CLOSING body tag in your application layout.
26
+
27
+ ERB:
28
+ <script>
29
+ jQuery(function() {
30
+ window.$this = new (App.\#{controller_path.split(/\/|_/).map(&:capitalize).join('')} || App.Base)();
31
+ if (typeof $this.\#{action_name} === 'function') {
32
+ return $this.\#{action_name}.call();
33
+ }
34
+ });
35
+ </script>
36
+
37
+ HAML:
38
+ :javascript
39
+ jQuery(function() {
40
+ window.$this = new (App.\#{controller_path.split(/\/|_/).map(&:capitalize).join('')} || App.Base)();
41
+ if (typeof $this.\#{action_name} === 'function') {
42
+ return $this.\#{action_name}.call();
43
+ }
44
+ });
45
+ RUBY
46
+ end
47
+
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,15 @@
1
+ window.App ||= {}
2
+ class App.Base
3
+
4
+ constructor: ->
5
+ return this
6
+
7
+
8
+ create: ->
9
+ $this.new()
10
+ return
11
+
12
+
13
+ update: ->
14
+ $this.edit()
15
+ return
@@ -0,0 +1 @@
1
+ window.App ||= {}
@@ -0,0 +1,5 @@
1
+ require 'rails_script/version'
2
+ require 'rails_script/railtie' if defined?(Rails)
3
+
4
+ module RailsScript
5
+ end
@@ -0,0 +1,7 @@
1
+ module RailsScript
2
+ class Railtie < Rails::Railtie
3
+ config.app_generators do |g|
4
+ g.templates.unshift File::expand_path('../../templates', __FILE__)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module RailsScript
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,22 @@
1
+ window.App ||= {}
2
+ class App.<%= class_name %> extends App.Base
3
+
4
+ constructor: ->
5
+ super
6
+ return this
7
+
8
+
9
+ index: ->
10
+ return
11
+
12
+
13
+ show: ->
14
+ return
15
+
16
+
17
+ new: ->
18
+ return
19
+
20
+
21
+ edit: ->
22
+ return
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rails_script/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'rails_script'
8
+ spec.version = RailsScript::VERSION
9
+ spec.authors = ['Kevin Pheasey']
10
+ spec.email = ['kevin.pheasey@gmail.com']
11
+ spec.summary = %q{A CoffeeScript framework for the Rails asset pipeline.}
12
+ spec.description = %q{A CoffeeScript framework for the Rails asset pipeline.}
13
+ spec.homepage = 'https://github.com/gemgento/rails_script'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\u0000")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.6'
22
+ spec.add_development_dependency 'rake'
23
+
24
+ spec.add_dependency 'coffee-rails', '~> 4.0.0'
25
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_script
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Kevin Pheasey
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: coffee-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 4.0.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 4.0.0
55
+ description: A CoffeeScript framework for the Rails asset pipeline.
56
+ email:
57
+ - kevin.pheasey@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - lib/generators/rails_script/controller/USAGE
68
+ - lib/generators/rails_script/controller/controller_generator.rb
69
+ - lib/generators/rails_script/controller/templates/javascript.js.coffee
70
+ - lib/generators/rails_script/install/USAGE
71
+ - lib/generators/rails_script/install/install_generator.rb
72
+ - lib/generators/rails_script/install/templates/base.js.coffee
73
+ - lib/generators/rails_script/install/templates/global.js.coffee
74
+ - lib/rails_script.rb
75
+ - lib/rails_script/railtie.rb
76
+ - lib/rails_script/version.rb
77
+ - lib/templates/coffee/assets/javascript.js.coffee
78
+ - rails_script.gemspec
79
+ homepage: https://github.com/gemgento/rails_script
80
+ licenses:
81
+ - MIT
82
+ metadata: {}
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project:
99
+ rubygems_version: 2.2.2
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: A CoffeeScript framework for the Rails asset pipeline.
103
+ test_files: []