jquery-rails 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of jquery-rails might be problematic. Click here for more details.
- data/.gitignore +2 -0
- data/Gemfile +4 -0
- data/README.md +17 -0
- data/Rakefile +2 -0
- data/jquery-rails.gemspec +23 -0
- data/lib/generators/jquery/install/install_generator.rb +30 -0
- data/lib/jquery-rails.rb +13 -0
- data/lib/jquery-rails/version.rb +5 -0
- metadata +103 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Jquery-rails
|
2
|
+
|
3
|
+
This gem adds a single generator to Rails 3, jquery:install. Running the generator will remove any Prototype JS files you may happen to have, fetch jQuery and the jQuery-ujs driver for Rails, and (optionally) fetch jQuery UI.
|
4
|
+
|
5
|
+
The gem will also hook into the Rails configuration process, removing Prototype and adding jQuery to the javascript files included by the `javascript_tag(:default)` call. While the plugin downloads minified and un-minified versions of jQuery and jQuery UI, only the minified versions are included in :default.
|
6
|
+
|
7
|
+
### Installation
|
8
|
+
|
9
|
+
In your Gemfile, add this line:
|
10
|
+
|
11
|
+
gem "jquery-rails"
|
12
|
+
|
13
|
+
Then, run `bundle install`. To invoke the generator, run:
|
14
|
+
|
15
|
+
rails generate jquery:install #--ui to enable jQuery UI
|
16
|
+
|
17
|
+
You're done! Don't forget to output `csrf_meta_tag` somewhere inside your `<head>` tag in your layout!
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/jquery-rails/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "jquery-rails"
|
6
|
+
s.version = Jquery::Rails::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ["André Arko"]
|
9
|
+
s.email = ["andre@arko.net"]
|
10
|
+
s.homepage = "http://rubygems.org/gems/jquery-rails"
|
11
|
+
s.summary = "Use jQuery with Rails 3"
|
12
|
+
s.description = "This gem provides a Rails generator to install jQuery and the jQuery-ujs driver into your Rails 3 application, and then have them included automatically instead of Prototype."
|
13
|
+
|
14
|
+
s.required_rubygems_version = ">= 1.3.6"
|
15
|
+
s.rubyforge_project = "jquery-rails"
|
16
|
+
|
17
|
+
s.add_dependency "rails", "~>3.0.0.rc"
|
18
|
+
s.add_development_dependency "bundler", ">= 1.0.0.rc.6.pre"
|
19
|
+
|
20
|
+
s.files = `git ls-files`.split("\n")
|
21
|
+
s.executables = `git ls-files`.split("\n").select{|f| f =~ /^bin/}
|
22
|
+
s.require_path = 'lib'
|
23
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Jquery
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < ::Rails::Generators::Base
|
4
|
+
desc "This generator downloads and installs jQuery 1.4.2, jQuery-ujs HEAD, and (optionally) jQuery UI 1.8.4"
|
5
|
+
class_option :ui, :type => :boolean, :default => false, :desc => "Indicates when to Include JQueryUI (minified version; source: Google Libraries API)"
|
6
|
+
|
7
|
+
def remove_prototype
|
8
|
+
%w(controls.js dragdrop.js effects.js prototype.js).each do |js|
|
9
|
+
remove_file "public/javascripts/#{js}"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def download_jquery
|
14
|
+
# Downloading latest jQuery
|
15
|
+
get "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js", "public/javascripts/jquery.min.js"
|
16
|
+
get "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js", "public/javascripts/jquery.js"
|
17
|
+
|
18
|
+
# Downloading latest jQueryUI minified
|
19
|
+
get "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.min.js", "public/javascripts/jquery-ui.min.js" if options.ui?
|
20
|
+
get "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.js", "public/javascripts/jquery-ui.js" if options.ui?
|
21
|
+
end
|
22
|
+
|
23
|
+
def download_ujs_driver
|
24
|
+
# Downloading latest jQuery drivers
|
25
|
+
get "http://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/jquery-rails.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
module Jquery
|
2
|
+
module Rails
|
3
|
+
class Railtie < ::Rails::Railtie
|
4
|
+
config.before_configuration do
|
5
|
+
if ::Rails.root.join("javascripts/jquery-ui.min.js").exist?
|
6
|
+
config.action_view.javascript_expansions[:defaults] = %w(jquery.min jquery-ui.min rails)
|
7
|
+
else
|
8
|
+
config.action_view.javascript_expansions[:defaults] = %w(jquery.min rails)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jquery-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- "Andr\xC3\xA9 Arko"
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-08-16 00:00:00 -07:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rails
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 3
|
29
|
+
- 0
|
30
|
+
- 0
|
31
|
+
- rc
|
32
|
+
version: 3.0.0.rc
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: bundler
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
segments:
|
43
|
+
- 1
|
44
|
+
- 0
|
45
|
+
- 0
|
46
|
+
- rc
|
47
|
+
- 6
|
48
|
+
- pre
|
49
|
+
version: 1.0.0.rc.6.pre
|
50
|
+
type: :development
|
51
|
+
version_requirements: *id002
|
52
|
+
description: This gem provides a Rails generator to install jQuery and the jQuery-ujs driver into your Rails 3 application, and then have them included automatically instead of Prototype.
|
53
|
+
email:
|
54
|
+
- andre@arko.net
|
55
|
+
executables: []
|
56
|
+
|
57
|
+
extensions: []
|
58
|
+
|
59
|
+
extra_rdoc_files: []
|
60
|
+
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- Gemfile
|
64
|
+
- README.md
|
65
|
+
- Rakefile
|
66
|
+
- jquery-rails.gemspec
|
67
|
+
- lib/generators/jquery/install/install_generator.rb
|
68
|
+
- lib/jquery-rails.rb
|
69
|
+
- lib/jquery-rails/version.rb
|
70
|
+
has_rdoc: true
|
71
|
+
homepage: http://rubygems.org/gems/jquery-rails
|
72
|
+
licenses: []
|
73
|
+
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options: []
|
76
|
+
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
segments:
|
84
|
+
- 0
|
85
|
+
version: "0"
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
segments:
|
91
|
+
- 1
|
92
|
+
- 3
|
93
|
+
- 6
|
94
|
+
version: 1.3.6
|
95
|
+
requirements: []
|
96
|
+
|
97
|
+
rubyforge_project: jquery-rails
|
98
|
+
rubygems_version: 1.3.6
|
99
|
+
signing_key:
|
100
|
+
specification_version: 3
|
101
|
+
summary: Use jQuery with Rails 3
|
102
|
+
test_files: []
|
103
|
+
|