sprockets-rails 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile ADDED
@@ -0,0 +1,91 @@
1
+ h1. Sprockets-rails
2
+
3
+ Sprockets-rails sets up your Rails application for use with "Sprockets":http://github.com/sstephenson/sprockets/.
4
+
5
+ h2. Installation
6
+
7
+ The first thing you need to do is install the Sprockets RubyGem. Just run;
8
+
9
+ bc. gem install --remote sprockets
10
+
11
+ For more information about installing and using Sprockets, check out the "Sprockets website":http://getsprockets.org/ and the "Sprockets github project":http://github.com/sstephenson/sprockets.
12
+
13
+ Sprockets-rails can be installed as a gem or as a plugin;
14
+
15
+ h3. Installing as a gem
16
+
17
+ Add this to your @environment.rb@ file;
18
+
19
+ bc. config.gem 'sprockets-rails', :source => 'http://gemcutter.org'
20
+
21
+ And run;
22
+
23
+ bc. rake gems:install
24
+
25
+ Once the gem is installed, run the generator and you're all set;
26
+
27
+ bc. script/generate sprockets_rails
28
+
29
+ The gem is now installed and the required files and folders will be generated into your project.
30
+
31
+ h3. Installing as a plugin
32
+
33
+ Run this in the root of your Rails project;
34
+
35
+ bc. script/plugin install git://github.com/80beans/sprockets-rails.git
36
+
37
+ The plugin will get installed and the required files and folders will be generated into your project.
38
+
39
+ h2. Usage
40
+
41
+ Now you have sprockets-rails installed as a gem or a plugin. You now have @app/javascripts/@ and @vendor/sprockets/@ directories in your application, as well as a @config/sprockets.yml@ file.
42
+
43
+ Edit your @config/routes.rb@ file to add routes for @SprocketsController@:
44
+
45
+ bc. ActionController::Routing::Routes.draw do |map|
46
+ # Add the following line:
47
+ SprocketsApplication.routes(map)
48
+ ...
49
+ end
50
+
51
+ Now, move your JavaScript source files from @public/javascripts/@ into @app/javascripts/@. All files in all subdirectories of @app/javascripts/@ will be required by Sprockets in alphabetical order, with the exception of @app/javascripts/application.js@, which is required _before any other file_. (You can change this behavior by editing the @source_files@ line of @config/sprockets.yml@.)
52
+
53
+ The last thing you'll have to do is adjust your HTML templates to call @<%= sprockets_include_tag %>@ instead of @<%= javascript_include_tag ... %>@.
54
+
55
+ Once @sprockets-rails@ is installed, you can check out Sprockets plugins into the @vendor/sprockets/@ directory. By default, @sprockets-rails@ configures Sprockets' load path to search @vendor/sprockets/*/src/@, as well as @vendor/plugins/*/javascripts/@. This means that the @javascripts/@ directories of Rails plugins are automatically installed into your Sprockets load path
56
+
57
+ h2. Using multiple sprockets configurations in a project
58
+
59
+ Edit your @config/sprockets.rb@ file to name the configurations:
60
+
61
+ bc. :default:
62
+ :asset_root: public
63
+ :load_path:
64
+ - app/javascripts
65
+ - vendor/sprockets/*/src
66
+ - vendor/plugins/*/javascripts
67
+ :source_files:
68
+ - app/javascripts/application.js
69
+ :special:
70
+ :asset_root: public
71
+ :load_path:
72
+ - app/javascripts
73
+ - vendor/sprockets/*/src
74
+ - vendor/plugins/*/javascripts
75
+ :source_files:
76
+ - app/javascripts/special.js
77
+
78
+ Now, adjust your HTML templates to call @<%= sprockets_include_tag(:config_name) %>@ with the name of the configuration you wish to use. Concatenations are located at @RAILS_ROOT/sprockets/<config_name>.js@, except for the default configuration, whose concatenation located at @RAILS_ROOT/sprockets.js@.
79
+
80
+
81
+ h2. How it works
82
+
83
+ Sprockets-rails includes a controller named @SprocketsController@ that renders your application's Sprockets concatenation. When caching is enabled, e.g. in production mode, @SprocketsController@ uses Rails page caching to save the concatenated output to @public/sprockets.js@ the first time it is requested. When caching is disabled, e.g. in development mode, @SprocketsController@ will render a fresh concatenation any time a source file changes.
84
+
85
+ To source Sprockets' JavaScript concatenation from your HTML templates, use the provided @sprockets_include_tag@ helper.
86
+
87
+ Sprockets-rails also includes a set of Rake tasks for generating the concatenation (@rake sprockets:install_script@) and installing provided assets (@rake sprockets:install_assets@). Run @sprockets:install_assets@ any time you add or update a Sprockets plugin in your application. Add @after "deploy:update_code", "sprockets:install_script"@ as a "Capistrano":http://www.capify.org/ post-deploy hook to generate the Sprockets concatenation on your servers automatically at deploy time.
88
+
89
+ h2. License
90
+
91
+ Copyright (c) 2009 Sam Stephenson, released under the MIT license
data/Rakefile CHANGED
@@ -11,7 +11,8 @@ begin
11
11
  gem.description = %Q{Sprockets JavaScript dependency management and concatenation support for Rails applications}
12
12
  gem.email = "jeff@80beans.com"
13
13
  gem.homepage = "http://github.com/80beans/sprockets-rails"
14
- gem.authors = ["Jeff Kreeftmeijer"]
14
+ gem.authors = ["Sam Stephenson","Jeff Kreeftmeijer"]
15
+ gem.add_dependency 'sprockets', ">= 1.0.2"
15
16
  end
16
17
  rescue LoadError
17
18
  puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.0.1
@@ -5,20 +5,20 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sprockets-rails}
8
- s.version = "0.0.0"
8
+ s.version = "0.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Jeff Kreeftmeijer"]
11
+ s.authors = ["Sam Stephenson", "Jeff Kreeftmeijer"]
12
12
  s.date = %q{2009-12-02}
13
13
  s.description = %q{Sprockets JavaScript dependency management and concatenation support for Rails applications}
14
14
  s.email = %q{jeff@80beans.com}
15
15
  s.extra_rdoc_files = [
16
- "README.markdown"
16
+ "README.textile"
17
17
  ]
18
18
  s.files = [
19
19
  ".gitignore",
20
20
  "MIT-LICENSE",
21
- "README.markdown",
21
+ "README.textile",
22
22
  "Rakefile",
23
23
  "VERSION",
24
24
  "config/sprockets.yml",
@@ -50,8 +50,11 @@ Gem::Specification.new do |s|
50
50
  s.specification_version = 3
51
51
 
52
52
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
53
+ s.add_runtime_dependency(%q<sprockets>, [">= 1.0.2"])
53
54
  else
55
+ s.add_dependency(%q<sprockets>, [">= 1.0.2"])
54
56
  end
55
57
  else
58
+ s.add_dependency(%q<sprockets>, [">= 1.0.2"])
56
59
  end
57
60
  end
metadata CHANGED
@@ -1,9 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
+ - Sam Stephenson
7
8
  - Jeff Kreeftmeijer
8
9
  autorequire:
9
10
  bindir: bin
@@ -11,8 +12,17 @@ cert_chain: []
11
12
 
12
13
  date: 2009-12-02 00:00:00 +01:00
13
14
  default_executable:
14
- dependencies: []
15
-
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: sprockets
18
+ type: :runtime
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 1.0.2
25
+ version:
16
26
  description: Sprockets JavaScript dependency management and concatenation support for Rails applications
17
27
  email: jeff@80beans.com
18
28
  executables: []
@@ -20,11 +30,11 @@ executables: []
20
30
  extensions: []
21
31
 
22
32
  extra_rdoc_files:
23
- - README.markdown
33
+ - README.textile
24
34
  files:
25
35
  - .gitignore
26
36
  - MIT-LICENSE
27
- - README.markdown
37
+ - README.textile
28
38
  - Rakefile
29
39
  - VERSION
30
40
  - config/sprockets.yml
data/README.markdown DELETED
@@ -1,67 +0,0 @@
1
- `sprockets-rails`
2
- =================
3
-
4
- The `sprockets-rails` plugin sets up your Rails application for use with [Sprockets](http://github.com/sstephenson/sprockets). To install it, first install the `sprockets` RubyGem, then check out a copy of the `sprockets-rails` repository into your `vendor/plugins/` directory. When you run the bundled `install.rb` script, `sprockets-rails` will create two new directories in your application and copy a configuration file into your `config/` directory.
5
-
6
- `sprockets-rails` includes a controller named `SprocketsController` that renders your application's Sprockets concatenation. When caching is enabled, e.g. in production mode, `SprocketsController` uses Rails page caching to save the concatenated output to `public/sprockets.js` the first time it is requested. When caching is disabled, e.g. in development mode, `SprocketsController` will render a fresh concatenation any time a source file changes.
7
-
8
- To source Sprockets' JavaScript concatenation from your HTML templates, use the provided `sprockets_include_tag` helper.
9
-
10
- `sprockets-rails` also includes a set of Rake tasks for generating the concatenation (`rake sprockets:install_script`) and installing provided assets (`rake sprockets:install_assets`). Run `sprockets:install_assets` any time you add or update a Sprockets plugin in your application. Add `after "deploy:update_code", "sprockets:install_script"` as a [Capistrano](http://www.capify.org/) post-deploy hook to generate the Sprockets concatenation on your servers automatically at deploy time.
11
-
12
- Here's a walkthrough of the installation process:
13
-
14
- 1. `gem install --remote sprockets`
15
-
16
- 2. `script/plugin install git://github.com/sstephenson/sprockets-rails.git`
17
-
18
- You now have `app/javascripts/` and `vendor/sprockets/` directories in your application, as well as a `config/sprockets.yml` file.
19
-
20
- 3. Edit your `config/routes.rb` file to add routes for `SprocketsController`:
21
-
22
- ActionController::Routing::Routes.draw do |map|
23
- # Add the following line:
24
- SprocketsApplication.routes(map)
25
- ...
26
- end
27
-
28
- 4. Move your JavaScript source files from `public/javascripts/` into `app/javascripts/`. All files in all subdirectories of `app/javascripts/` will be required by Sprockets in alphabetical order, with the exception of `app/javascripts/application.js`, which is required _before any other file_. (You can change this behavior by editing the `source_files` line of `config/sprockets.yml`.)
29
-
30
- 5. Adjust your HTML templates to call `<%= sprockets_include_tag %>` instead of `<%= javascript_include_tag ... %>`.
31
-
32
- Once `sprockets-rails` is installed, you can check out Sprockets plugins into the `vendor/sprockets/` directory. By default, `sprockets-rails` configures Sprockets' load path to search `vendor/sprockets/*/src/`, as well as `vendor/plugins/*/javascripts/`. This means that the `javascripts/` directories of Rails plugins are automatically installed into your Sprockets load path.
33
-
34
- ## Using multiple sprockets configurations in a project
35
-
36
- 1. Edit your `config/sprockets.rb` file to name the configurations:
37
-
38
- :default:
39
- :asset_root: public
40
- :load_path:
41
- - app/javascripts
42
- - vendor/sprockets/*/src
43
- - vendor/plugins/*/javascripts
44
- :source_files:
45
- - app/javascripts/application.js
46
- :special:
47
- :asset_root: public
48
- :load_path:
49
- - app/javascripts
50
- - vendor/sprockets/*/src
51
- - vendor/plugins/*/javascripts
52
- :source_files:
53
- - app/javascripts/special.js
54
-
55
- 2. Adjust your HTML templates to call `<%= sprockets_include_tag(:config_name) %>` with the name of the configuration you wish to use.
56
-
57
- 3. Concatenations are located at `RAILS_ROOT/sprockets/<config_name>.js`, except for the default configuration, whose concatenation located at `RAILS_ROOT/sprockets.js`.
58
-
59
- ## License
60
-
61
- Copyright &copy; 2009 Sam Stephenson.
62
-
63
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
64
-
65
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
66
-
67
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.