requirejs-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.
Files changed (48) hide show
  1. data/.gitignore +6 -0
  2. data/.rvmrc +55 -0
  3. data/CHANGELOG.md +5 -0
  4. data/Gemfile +17 -0
  5. data/Gemfile.lock +99 -0
  6. data/MIT-LICENSE +20 -0
  7. data/README.md +33 -0
  8. data/Rakefile +37 -0
  9. data/lib/requirejs-rails.rb +4 -0
  10. data/lib/requirejs/rails/version.rb +5 -0
  11. data/lib/tasks/requirejs-rails_tasks.rake +4 -0
  12. data/requirejs-rails.gemspec +25 -0
  13. data/test/dummy/Rakefile +7 -0
  14. data/test/dummy/app/assets/javascripts/application.js +9 -0
  15. data/test/dummy/app/assets/stylesheets/application.css +7 -0
  16. data/test/dummy/app/controllers/application_controller.rb +3 -0
  17. data/test/dummy/app/helpers/application_helper.rb +2 -0
  18. data/test/dummy/app/mailers/.gitkeep +0 -0
  19. data/test/dummy/app/models/.gitkeep +0 -0
  20. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  21. data/test/dummy/config.ru +4 -0
  22. data/test/dummy/config/application.rb +45 -0
  23. data/test/dummy/config/boot.rb +10 -0
  24. data/test/dummy/config/database.yml +25 -0
  25. data/test/dummy/config/environment.rb +5 -0
  26. data/test/dummy/config/environments/development.rb +30 -0
  27. data/test/dummy/config/environments/production.rb +60 -0
  28. data/test/dummy/config/environments/test.rb +39 -0
  29. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  30. data/test/dummy/config/initializers/inflections.rb +10 -0
  31. data/test/dummy/config/initializers/mime_types.rb +5 -0
  32. data/test/dummy/config/initializers/secret_token.rb +7 -0
  33. data/test/dummy/config/initializers/session_store.rb +8 -0
  34. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  35. data/test/dummy/config/locales/en.yml +5 -0
  36. data/test/dummy/config/routes.rb +58 -0
  37. data/test/dummy/lib/assets/.gitkeep +0 -0
  38. data/test/dummy/log/.gitkeep +0 -0
  39. data/test/dummy/public/404.html +26 -0
  40. data/test/dummy/public/422.html +26 -0
  41. data/test/dummy/public/500.html +26 -0
  42. data/test/dummy/public/favicon.ico +0 -0
  43. data/test/dummy/script/rails +6 -0
  44. data/test/requirejs-rails_test.rb +8 -0
  45. data/test/test_helper.rb +10 -0
  46. data/vendor/assets/javascripts/order.js +180 -0
  47. data/vendor/assets/javascripts/require.js +1934 -0
  48. metadata +154 -0
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ test/dummy/db/*.sqlite3
5
+ test/dummy/log/*.log
6
+ test/dummy/tmp/
data/.rvmrc ADDED
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
7
+ environment_id="ruby-1.9.3-p0@requirejs-rails"
8
+
9
+ #
10
+ # Uncomment following line if you want options to be set only for given project.
11
+ #
12
+ # PROJECT_JRUBY_OPTS=( --1.9 )
13
+
14
+ #
15
+ # First we attempt to load the desired environment directly from the environment
16
+ # file. This is very fast and efficient compared to running through the entire
17
+ # CLI and selector. If you want feedback on which environment was used then
18
+ # insert the word 'use' after --create as this triggers verbose mode.
19
+ #
20
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
21
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
22
+ then
23
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
24
+
25
+ if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
26
+ then
27
+ . "${rvm_path:-$HOME/.rvm}/hooks/after_use"
28
+ fi
29
+ else
30
+ # If the environment file has not yet been created, use the RVM CLI to select.
31
+ if ! rvm --create use "$environment_id"
32
+ then
33
+ echo "Failed to create RVM environment '${environment_id}'."
34
+ return 1
35
+ fi
36
+ fi
37
+
38
+ #
39
+ # If you use an RVM gemset file to install a list of gems (*.gems), you can have
40
+ # it be automatically loaded. Uncomment the following and adjust the filename if
41
+ # necessary.
42
+ #
43
+ # filename=".gems"
44
+ # if [[ -s "$filename" ]]
45
+ # then
46
+ # rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
47
+ # fi
48
+
49
+ # If you use bundler, this might be useful to you:
50
+ # if command -v bundle && [[ -s Gemfile ]]
51
+ # then
52
+ # bundle install
53
+ # fi
54
+
55
+
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # v0.0.1
2
+
3
+ - Birthday!
4
+ - This gem makes `require.js` and the `order.js` plugin available to the Rails 3 Asset Pipeline.
5
+
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Declare your gem's dependencies in requirejs-rails.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+ gemspec
7
+
8
+ # jquery-rails is used by the dummy application
9
+ gem "jquery-rails"
10
+
11
+ # Declare any dependencies that are still in development here instead of in
12
+ # your gemspec. These might include edge Rails or gems from your path or
13
+ # Git. Remember to move these dependencies to your gemspec before releasing
14
+ # your gem to rubygems.org.
15
+
16
+ # To use debugger
17
+ # gem 'ruby-debug19', :require => 'ruby-debug'
data/Gemfile.lock ADDED
@@ -0,0 +1,99 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ requirejs-rails (0.0.1)
5
+ rails (~> 3.1.1)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actionmailer (3.1.1)
11
+ actionpack (= 3.1.1)
12
+ mail (~> 2.3.0)
13
+ actionpack (3.1.1)
14
+ activemodel (= 3.1.1)
15
+ activesupport (= 3.1.1)
16
+ builder (~> 3.0.0)
17
+ erubis (~> 2.7.0)
18
+ i18n (~> 0.6)
19
+ rack (~> 1.3.2)
20
+ rack-cache (~> 1.1)
21
+ rack-mount (~> 0.8.2)
22
+ rack-test (~> 0.6.1)
23
+ sprockets (~> 2.0.2)
24
+ activemodel (3.1.1)
25
+ activesupport (= 3.1.1)
26
+ builder (~> 3.0.0)
27
+ i18n (~> 0.6)
28
+ activerecord (3.1.1)
29
+ activemodel (= 3.1.1)
30
+ activesupport (= 3.1.1)
31
+ arel (~> 2.2.1)
32
+ tzinfo (~> 0.3.29)
33
+ activeresource (3.1.1)
34
+ activemodel (= 3.1.1)
35
+ activesupport (= 3.1.1)
36
+ activesupport (3.1.1)
37
+ multi_json (~> 1.0)
38
+ arel (2.2.1)
39
+ builder (3.0.0)
40
+ erubis (2.7.0)
41
+ hike (1.2.1)
42
+ i18n (0.6.0)
43
+ jquery-rails (1.0.17)
44
+ railties (~> 3.0)
45
+ thor (~> 0.14)
46
+ json (1.6.1)
47
+ mail (2.3.0)
48
+ i18n (>= 0.4.0)
49
+ mime-types (~> 1.16)
50
+ treetop (~> 1.4.8)
51
+ mime-types (1.17.2)
52
+ multi_json (1.0.3)
53
+ polyglot (0.3.3)
54
+ rack (1.3.5)
55
+ rack-cache (1.1)
56
+ rack (>= 0.4)
57
+ rack-mount (0.8.3)
58
+ rack (>= 1.0.0)
59
+ rack-ssl (1.3.2)
60
+ rack
61
+ rack-test (0.6.1)
62
+ rack (>= 1.0)
63
+ rails (3.1.1)
64
+ actionmailer (= 3.1.1)
65
+ actionpack (= 3.1.1)
66
+ activerecord (= 3.1.1)
67
+ activeresource (= 3.1.1)
68
+ activesupport (= 3.1.1)
69
+ bundler (~> 1.0)
70
+ railties (= 3.1.1)
71
+ railties (3.1.1)
72
+ actionpack (= 3.1.1)
73
+ activesupport (= 3.1.1)
74
+ rack-ssl (~> 1.3.2)
75
+ rake (>= 0.8.7)
76
+ rdoc (~> 3.4)
77
+ thor (~> 0.14.6)
78
+ rake (0.9.2.2)
79
+ rdoc (3.11)
80
+ json (~> 1.4)
81
+ sprockets (2.0.3)
82
+ hike (~> 1.2)
83
+ rack (~> 1.0)
84
+ tilt (~> 1.1, != 1.3.0)
85
+ sqlite3 (1.3.4)
86
+ thor (0.14.6)
87
+ tilt (1.3.3)
88
+ treetop (1.4.10)
89
+ polyglot
90
+ polyglot (>= 0.3.1)
91
+ tzinfo (0.3.31)
92
+
93
+ PLATFORMS
94
+ ruby
95
+
96
+ DEPENDENCIES
97
+ jquery-rails
98
+ requirejs-rails!
99
+ sqlite3
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2011 John Whitley
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # RequireJS for Rails
2
+
3
+ Integrates [RequireJS](http://requirejs.org/) into the Rails 3 Asset Pipeline.
4
+
5
+ ## Usage
6
+
7
+ 1. `gem install requirejs-rails`
8
+
9
+ 2. Your `application.js` file should contain just this snippet. The rest of your JavaScript or CoffeeScript code should be pulled in via RequireJS, including jQuery.
10
+
11
+ ```
12
+ //= require require
13
+
14
+ require.config({
15
+ baseUrl: "/assets"
16
+ });
17
+ ```
18
+
19
+ 3. Add any additional config directives you need to the above code, e.g. `paths`.
20
+
21
+ ## Changes
22
+
23
+ See [the Changelog](CHANGELOG.md) for recent updates
24
+
25
+ ## TODOs
26
+
27
+ - Sample app, including jQuery usage
28
+ - Support RequireJS precompilation via r.js
29
+ - Generator and/or template support.. ?
30
+
31
+ ----
32
+
33
+ Copyright 2011 John Whitley. See the file MIT-LICENSE for terms.
data/Rakefile ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'RequirejsRails'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+ Bundler::GemHelper.install_tasks
26
+
27
+ require 'rake/testtask'
28
+
29
+ Rake::TestTask.new(:test) do |t|
30
+ t.libs << 'lib'
31
+ t.libs << 'test'
32
+ t.pattern = 'test/**/*_test.rb'
33
+ t.verbose = false
34
+ end
35
+
36
+
37
+ task :default => :test
@@ -0,0 +1,4 @@
1
+ module Requirejs
2
+ module Rails
3
+ end
4
+ end
@@ -0,0 +1,5 @@
1
+ module Requirejs
2
+ module Rails
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :requirejs-rails do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,25 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ # Maintain your gem's version:
4
+ require "requirejs/rails/version"
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |s|
8
+ s.name = "requirejs-rails"
9
+ s.version = Requirejs::Rails::VERSION
10
+ s.authors = ["John Whitley"]
11
+ s.email = ["whitley@bangpath.org"]
12
+ s.homepage = "http://github.com/jwhitley/requirejs-rails"
13
+ s.summary = "Use RequireJS with the Rails 3 Asset Pipeline"
14
+ s.description = "This gem provides RequireJS support for your Rails 3 application."
15
+
16
+ git_test_files, git_files = `git ls-files`.split("\n").partition { |f| f =~ /^test/ }
17
+ s.test_files = git_test_files
18
+ s.files = git_files
19
+ s.require_path = 'lib'
20
+
21
+ s.add_dependency "rails", "~> 3.1.1"
22
+ s.requirements << "If needed, jQuery should be v1.7 or greater (jquery-rails >= 1.0.17)."
23
+
24
+ s.add_development_dependency "sqlite3"
25
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,9 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require jquery
8
+ //= require jquery_ujs
9
+ //= require_tree .
@@ -0,0 +1,7 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *= require_self
6
+ *= require_tree .
7
+ */
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -0,0 +1,45 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require
6
+ require "requirejs-rails"
7
+
8
+ module Dummy
9
+ class Application < Rails::Application
10
+ # Settings in config/environments/* take precedence over those specified here.
11
+ # Application configuration should go into files in config/initializers
12
+ # -- all .rb files in that directory are automatically loaded.
13
+
14
+ # Custom directories with classes and modules you want to be autoloadable.
15
+ # config.autoload_paths += %W(#{config.root}/extras)
16
+
17
+ # Only load the plugins named here, in the order given (default is alphabetical).
18
+ # :all can be used as a placeholder for all plugins not explicitly named.
19
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
20
+
21
+ # Activate observers that should always be running.
22
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
23
+
24
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
25
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
26
+ # config.time_zone = 'Central Time (US & Canada)'
27
+
28
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
29
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
30
+ # config.i18n.default_locale = :de
31
+
32
+ # Configure the default encoding used in templates for Ruby 1.9.
33
+ config.encoding = "utf-8"
34
+
35
+ # Configure sensitive parameters which will be filtered from the log file.
36
+ config.filter_parameters += [:password]
37
+
38
+ # Enable the asset pipeline
39
+ config.assets.enabled = true
40
+
41
+ # Version of your assets, change this if you want to expire all your assets
42
+ config.assets.version = '1.0'
43
+ end
44
+ end
45
+