coffee_asset_paths 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8d6d7132ad730eda7f29d5f6f295c67eac3d860d
4
+ data.tar.gz: 570192fbbe4f54bd7f7b103a14aedb579c504d8d
5
+ SHA512:
6
+ metadata.gz: c873b542047dd36404f23a57aaa45bed25d2f7191a8194f2c6fa921a7d018b3c9dcdb9b931af9f0fb658a9594d7f0002c372b4bdcba42e2189aee41a9c277fe3
7
+ data.tar.gz: 7ca0faca5b7b798aa3dee820afd0022b5c5157a47e5ee44e8c338a9c92e690b2fc2b24ffecd94337dbe9cb1affda45118f1e6cd69577c5ba90ad6230636c2ecc
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in coffee_asset_paths.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Dan Wentworth
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
+ # CoffeeAssetPaths
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'coffee_asset_paths'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install coffee_asset_paths
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( http://github.com/<my-github-username>/coffee_asset_paths/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 new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'coffee_asset_paths/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "coffee_asset_paths"
8
+ spec.version = CoffeeAssetPaths::VERSION
9
+ spec.authors = ["Dan Wentworth"]
10
+ spec.email = ["dan@atechmedia.com"]
11
+ spec.summary = %q{Little helper to allow you to access your rails asset paths from coffescript.}
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.5"
21
+ spec.add_development_dependency "rake"
22
+
23
+ spec.add_dependency "actionview", ">= 3.2", "< 5.0"
24
+ end
@@ -0,0 +1,3 @@
1
+ module CoffeeAssetPaths
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,36 @@
1
+ require "coffee_asset_paths/version"
2
+ require 'action_view/helpers/asset_url_helper'
3
+
4
+ module CoffeeAssetPaths
5
+
6
+ module Rails
7
+ class Engine < ::Rails::Engine
8
+ end
9
+ end
10
+
11
+ class << self
12
+ include ActionView::Helpers::AssetUrlHelper
13
+
14
+ def asset_types
15
+ ASSET_PUBLIC_DIRECTORIES.keys.to_json
16
+ end
17
+
18
+ def assets
19
+ @assets ||= begin
20
+ assets = {}
21
+
22
+ ASSET_PUBLIC_DIRECTORIES.each do |type, path|
23
+ asset_dir = File.join(::Rails.root, 'app', 'assets', path)
24
+ next unless File.directory?(asset_dir)
25
+
26
+ Dir.chdir(asset_dir) do
27
+ assets[type] = Dir["**"].inject({}) {|h,f| h.merge! f => asset_path(f)}
28
+ end
29
+ end
30
+
31
+ assets.to_json
32
+ end
33
+ end
34
+ end
35
+
36
+ end
@@ -0,0 +1,14 @@
1
+ window.CoffeeAssetPaths =
2
+
3
+ assets: <%= CoffeeAssetPaths.assets %>
4
+
5
+ assetTypes: <%= CoffeeAssetPaths.asset_types %>
6
+
7
+ assetPath: (type, name)->
8
+ if @assets[type]?
9
+ @assets[type][name]
10
+
11
+ for assetType in CoffeeAssetPaths.assetTypes
12
+ do (assetType)->
13
+ window["#{assetType}_path"] = (name)->
14
+ CoffeeAssetPaths.assetPath(assetType, name)
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: coffee_asset_paths
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Dan Wentworth
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-20 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.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
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: actionview
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '3.2'
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: '5.0'
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '3.2'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '5.0'
61
+ description:
62
+ email:
63
+ - dan@atechmedia.com
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files: []
67
+ files:
68
+ - Gemfile
69
+ - LICENSE.txt
70
+ - README.md
71
+ - Rakefile
72
+ - coffee_asset_paths.gemspec
73
+ - lib/coffee_asset_paths.rb
74
+ - lib/coffee_asset_paths/version.rb
75
+ - vendor/assets/javascripts/coffee_asset_paths.coffee.erb
76
+ homepage: ''
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.2.2
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Little helper to allow you to access your rails asset paths from coffescript.
100
+ test_files: []