ender-rails 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 +7 -0
- data/.gitignore +19 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +77 -0
- data/Rakefile +20 -0
- data/ender-rails.gemspec +20 -0
- data/lib/ender-rails.rb +6 -0
- data/lib/ender-rails/railtie.rb +11 -0
- data/lib/ender-rails/version.rb +3 -0
- data/lib/tasks/ender.rake +87 -0
- metadata +69 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 982b400c21d1989ab889397f945190daa7f2af79
|
4
|
+
data.tar.gz: 95213c800ea85d55d634f02c51b69a9837771b88
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 70c7f2fafd08d37559384501a3461822853691459aa05b72b510efa2352a66be6fac55ebf8b13d0bf4f5901df8191665fc5bef63bcdfb50b9837f738f4831a12
|
7
|
+
data.tar.gz: 079b0b62d6031f77b207fe6a4d407bdf3172869ba46a2fcbb94b53d76677a54a4131d759d6f8e4685f008793f137a480b53a6d69ece80c97215b286f58754b72
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 mose
|
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,77 @@
|
|
1
|
+
# Ender-Rails
|
2
|
+
|
3
|
+
To fight the paretto monopoly of jQuery, let's have [Ender](http://ender.jit.su) and [the Jeesh](https://github.com/ender-js/jeesh) manage our javascript in Ruby on Rails. And an [ender-ujs](https://github.com/mose/ender-ujs) to make it right.
|
4
|
+
|
5
|
+
|
6
|
+
## Requirement
|
7
|
+
|
8
|
+
* Rails >= 3.1
|
9
|
+
* Node >= 0.4
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
gem 'ender-rails'
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install ender-rails
|
24
|
+
|
25
|
+
## Node installation
|
26
|
+
|
27
|
+
Ender-rails is going to help installing Nvm and Node with some simple rake task.
|
28
|
+
If you don't have Node.js already available, just run:
|
29
|
+
|
30
|
+
rake ender:node:install
|
31
|
+
|
32
|
+
Honestly it can also be a good occasion to begin checking out this tool if you have not already.
|
33
|
+
|
34
|
+
## Usage
|
35
|
+
|
36
|
+
rake ender:install
|
37
|
+
|
38
|
+
When ender is installed you can use ender instead of "rake ender"
|
39
|
+
|
40
|
+
rake ender:build # will copy a version of the jeesh in app/assets/javascripts/
|
41
|
+
rake ender:info # lists installed packages
|
42
|
+
rake ender:help
|
43
|
+
rake ender:add[somepackage]
|
44
|
+
rake ender:remove[somepackage]
|
45
|
+
|
46
|
+
Rake is a bit awkward when it comes to pass arguments, so here are the was to do it
|
47
|
+
|
48
|
+
rake ender:add[somepackage]
|
49
|
+
rake ender:add['somepackage someother']
|
50
|
+
rake ender:add[somepackage\ someother]
|
51
|
+
rake ender:add['somepackage someother ../src/some_local_package']
|
52
|
+
|
53
|
+
Find list of available ender packages on https://github.com/ender-js/Ender/wiki/Ender-package-list
|
54
|
+
|
55
|
+
Refer to [ender documentation](http://ender.jit.su/#docs) on how to add more flecibility in your javascript package binder.
|
56
|
+
|
57
|
+
In your views, you can then use the basic [Jeesh tools](https://github.com/ender-js/jeesh) which you feel like you are using jQuery for most parts (without the bulk).
|
58
|
+
|
59
|
+
## Todo
|
60
|
+
|
61
|
+
* create an ender-ujs package (see https://github.com/mose/ender-ujs)
|
62
|
+
* add more rake commands
|
63
|
+
* test the install on various ruby versions (using apraisal ?)
|
64
|
+
* write some rake tests
|
65
|
+
* fix the nvm install and usage
|
66
|
+
|
67
|
+
## Contributing
|
68
|
+
|
69
|
+
1. Fork it
|
70
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
71
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
72
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
73
|
+
5. Create new Pull Request
|
74
|
+
|
75
|
+
## License
|
76
|
+
|
77
|
+
Copyright (c) 2013 mose - distributed under MIT license
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
|
3
|
+
$:<< File.expand_path('../lib', __FILE__)
|
4
|
+
|
5
|
+
require "bundler/gem_tasks"
|
6
|
+
|
7
|
+
require 'rake/clean'
|
8
|
+
require 'rake/testtask'
|
9
|
+
|
10
|
+
load 'tasks/ender.rake'
|
11
|
+
|
12
|
+
task :default => :test
|
13
|
+
|
14
|
+
Rake::TestTask.new do |t|
|
15
|
+
t.libs << 'lib'
|
16
|
+
t.verbose = false
|
17
|
+
t.test_files = FileList['test/test_*.rb']
|
18
|
+
end
|
19
|
+
|
20
|
+
task :default => :test
|
data/ender-rails.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/ender-rails/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |g|
|
5
|
+
g.authors = ["mose"]
|
6
|
+
g.email = ["mose@mose.com"]
|
7
|
+
g.description = %q{Install Ender and the Jeesh in rails.}
|
8
|
+
g.summary = %q{Install Ender and the Jeesh in rails, using some simple rake tasks.}
|
9
|
+
g.homepage = "https://github.com/mose/ender-rails"
|
10
|
+
g.license = "MIT"
|
11
|
+
|
12
|
+
g.files = `git ls-files`.split($\)
|
13
|
+
g.executables = g.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
14
|
+
g.test_files = g.files.grep(%r{^(test|spec|features)/})
|
15
|
+
g.name = "ender-rails"
|
16
|
+
g.require_paths = ["lib"]
|
17
|
+
g.version = EnderRails::VERSION
|
18
|
+
|
19
|
+
g.add_dependency "rake", "~> 10.0.0"
|
20
|
+
end
|
data/lib/ender-rails.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
OUTPUT = File.join('app','assets','javascripts','ender')
|
2
|
+
|
3
|
+
namespace :ender do
|
4
|
+
|
5
|
+
namespace :node do
|
6
|
+
|
7
|
+
desc "install nvm"
|
8
|
+
task :install_nvm do
|
9
|
+
begin
|
10
|
+
if `which curl`.size.>(0)
|
11
|
+
sh "curl https://raw.github.com/creationix/nvm/master/install.sh | sh"
|
12
|
+
else
|
13
|
+
sh "wget -qO- https://raw.github.com/creationix/nvm/master/install.sh | sh"
|
14
|
+
end
|
15
|
+
puts "NVM : https://github.com/creationix/nvm"
|
16
|
+
puts "has been installed for your account. NVM is the node/npm version manager."
|
17
|
+
puts "If you liked RVM, you will feel like at home."
|
18
|
+
puts
|
19
|
+
rescue Exception => e
|
20
|
+
puts e
|
21
|
+
puts e.backtrace
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "install node version NODE_VERSION (default 0.8.16)"
|
26
|
+
task :install do
|
27
|
+
Rake::Task['ender:node:install_nvm'].invoke unless ENV['NVM_DIR']
|
28
|
+
node_version = ENV['NODE_VERSION'] || '0.8.16'
|
29
|
+
sh "/bin/bash -c 'source ~/.nvm/nvm.sh && nvm install #{node_version}'"
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "install files from ender"
|
35
|
+
task :install do
|
36
|
+
if `which npm`.size.<=(0)
|
37
|
+
if ENV['NVM_DIR']
|
38
|
+
node_version = ENV['NODE_VERSION'] || '0.8.16'
|
39
|
+
sh "/bin/bash -c 'source #{ENV['NVM_DIR']}/nvm.sh && nvm install #{node_version} && nvm use #{node_version}'"
|
40
|
+
else
|
41
|
+
Rake::Task['ender:node:install'].invoke
|
42
|
+
end
|
43
|
+
end
|
44
|
+
sh 'npm install ender -g'
|
45
|
+
puts "Please run 'source ~/.nvm/nvm.sh && nvm use #{node_version}' to reload nodejs environment '"
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "check is ender is installed"
|
49
|
+
task :check do
|
50
|
+
Rake::Task['ender:install'].invoke unless `which ender`.size.>(0)
|
51
|
+
end
|
52
|
+
|
53
|
+
desc "build ender base jeesh packages (and remove all the rest)"
|
54
|
+
task :build => :check do
|
55
|
+
sh "ender build jeesh --output #{OUTPUT}"
|
56
|
+
FileUtils.rm("#{output_path}.min.js") if File.exist?("#{OUTPUT}.min.js")
|
57
|
+
end
|
58
|
+
|
59
|
+
desc "refresh the build"
|
60
|
+
task :refresh => :check do
|
61
|
+
sh "ender refresh --use #{OUTPUT}"
|
62
|
+
FileUtils.rm("#{output_path}.min.js") if File.exist?("#{OUTPUT}.min.js")
|
63
|
+
end
|
64
|
+
|
65
|
+
desc "show list of installed packages"
|
66
|
+
task :info => :check do
|
67
|
+
sh "ender info --use #{OUTPUT}"
|
68
|
+
end
|
69
|
+
|
70
|
+
desc "display ender help"
|
71
|
+
task :help => :check do
|
72
|
+
sh "ender"
|
73
|
+
end
|
74
|
+
|
75
|
+
desc "add a package to the ender build"
|
76
|
+
task :add, [:package] => [:check] do |t,p|
|
77
|
+
sh "ender add #{p[:package]} --use #{OUTPUT}"
|
78
|
+
FileUtils.rm("#{output_path}.min.js") if File.exist?("#{OUTPUT}.min.js")
|
79
|
+
end
|
80
|
+
|
81
|
+
desc "remove a package from the ender build"
|
82
|
+
task :remove, [:package] => [:check] do |t,p|
|
83
|
+
sh "ender remove #{p[:package]} --use #{OUTPUT}"
|
84
|
+
FileUtils.rm("#{output_path}.min.js") if File.exist?("#{OUTPUT}.min.js")
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
metadata
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ender-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- mose
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-04-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 10.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 10.0.0
|
27
|
+
description: Install Ender and the Jeesh in rails.
|
28
|
+
email:
|
29
|
+
- mose@mose.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- .gitignore
|
35
|
+
- .rvmrc
|
36
|
+
- Gemfile
|
37
|
+
- LICENSE
|
38
|
+
- README.md
|
39
|
+
- Rakefile
|
40
|
+
- ender-rails.gemspec
|
41
|
+
- lib/ender-rails.rb
|
42
|
+
- lib/ender-rails/railtie.rb
|
43
|
+
- lib/ender-rails/version.rb
|
44
|
+
- lib/tasks/ender.rake
|
45
|
+
homepage: https://github.com/mose/ender-rails
|
46
|
+
licenses:
|
47
|
+
- MIT
|
48
|
+
metadata: {}
|
49
|
+
post_install_message:
|
50
|
+
rdoc_options: []
|
51
|
+
require_paths:
|
52
|
+
- lib
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - '>='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
requirements: []
|
64
|
+
rubyforge_project:
|
65
|
+
rubygems_version: 2.0.0.rc.2
|
66
|
+
signing_key:
|
67
|
+
specification_version: 4
|
68
|
+
summary: Install Ender and the Jeesh in rails, using some simple rake tasks.
|
69
|
+
test_files: []
|