assetsio 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg
5
+ rdoc
6
+ **.swp
7
+ **.swo
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm --create ruby-1.9.2-p180@assetsio-gem
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify this gem's dependencies in assetsio.gemspec
4
+ gemspec
data/MIT-LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2011 Martin Rehfeld
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # Assets.io Ruby Helpers
2
+
3
+ Use Assets.io to deliver your Javascript and CSS assets from the
4
+ Amazon Cloudfront CDN.
5
+
6
+ Note: This is work in progress. Do not use (yet).
7
+
8
+ ## References
9
+
10
+ For more information about Assets.io visit <http://www.assets.io>
11
+
12
+ ## License
13
+
14
+ The `assetsio` Gem is released under the MIT license.
data/Rakefile ADDED
@@ -0,0 +1,18 @@
1
+ require 'bundler'
2
+ require 'bundler/setup'
3
+ require 'bundler/gem_tasks'
4
+
5
+ require 'rdoc/task'
6
+ require 'rspec/core/rake_task'
7
+
8
+ task :default => :spec
9
+
10
+ desc 'Generate documentation'
11
+ RDoc::Task.new do |rdoc|
12
+ rdoc.rdoc_dir = 'rdoc'
13
+ rdoc.title = 'Assets.io Ruby Helpers'
14
+ rdoc.options << '--line-numbers' << '--inline-source'
15
+ rdoc.rdoc_files.include('README.md')
16
+ rdoc.rdoc_files.include('lib/assetsio.rb')
17
+ rdoc.rdoc_files.include('lib/assetsio/**/*.rb')
18
+ end
data/assetsio.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'assetsio/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'assetsio'
7
+ s.summary = 'Assets.io Ruby helpers'
8
+ s.email = 'martin.rehfeld@assets.io'
9
+ s.homepage = 'https://github.com/assets-io/assetsio'
10
+ s.description = 'Use Assets.io to deliver your Javascript and CSS assets from the Amazon Cloudfront CDN.'
11
+ s.authors = ['Martin Rehfeld']
12
+ s.version = AssetsIO::VERSION
13
+ s.platform = Gem::Platform::RUBY
14
+
15
+ s.add_dependency 'addressable'
16
+
17
+ s.add_development_dependency 'rdoc', '>=2.4.2'
18
+ s.add_development_dependency 'rspec', '>=2.0'
19
+ s.add_development_dependency 'rake'
20
+
21
+ s.files = `git ls-files`.split("\n")
22
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
23
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
24
+ s.require_paths = ['lib']
25
+ end
data/lib/assetsio.rb ADDED
@@ -0,0 +1 @@
1
+ require 'assetsio/helpers'
@@ -0,0 +1,25 @@
1
+ require 'addressable/uri'
2
+ require 'base64'
3
+
4
+ module AssetsIO
5
+
6
+ class << self
7
+ attr_accessor :account, :origin
8
+
9
+ def asset_url(request, source, type)
10
+ source_url = Addressable::URI.parse(request.url) + source
11
+ asset_spec = {
12
+ :a => account,
13
+ :r => 'b6',
14
+ :h => 'localhost', # TODO: remove once whitelisting refers to sources
15
+ :s => [ source_url.to_s ],
16
+ :v => 0,
17
+ :w => 0
18
+ }
19
+
20
+ origin_server = origin || "//#{account}.cloudfront.net"
21
+ "#{origin_server}/#{Base64.urlsafe_encode64(asset_spec.to_json)}.#{type}"
22
+ end
23
+ end
24
+
25
+ end
@@ -0,0 +1,5 @@
1
+ module AssetsIO
2
+
3
+ VERSION = '0.0.1'
4
+
5
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: assetsio
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Martin Rehfeld
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-06-07 00:00:00 +02:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: addressable
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: rdoc
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 2.4.2
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: rspec
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "2.0"
46
+ type: :development
47
+ prerelease: false
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: rake
51
+ requirement: &id004 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ type: :development
58
+ prerelease: false
59
+ version_requirements: *id004
60
+ description: Use Assets.io to deliver your Javascript and CSS assets from the Amazon Cloudfront CDN.
61
+ email: martin.rehfeld@assets.io
62
+ executables: []
63
+
64
+ extensions: []
65
+
66
+ extra_rdoc_files: []
67
+
68
+ files:
69
+ - .gitignore
70
+ - .rvmrc
71
+ - Gemfile
72
+ - MIT-LICENSE
73
+ - README.md
74
+ - Rakefile
75
+ - assetsio.gemspec
76
+ - lib/assetsio.rb
77
+ - lib/assetsio/helpers.rb
78
+ - lib/assetsio/version.rb
79
+ has_rdoc: true
80
+ homepage: https://github.com/assets-io/assetsio
81
+ licenses: []
82
+
83
+ post_install_message:
84
+ rdoc_options: []
85
+
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ hash: 2688446288608726187
94
+ segments:
95
+ - 0
96
+ version: "0"
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ hash: 2688446288608726187
103
+ segments:
104
+ - 0
105
+ version: "0"
106
+ requirements: []
107
+
108
+ rubyforge_project:
109
+ rubygems_version: 1.6.2
110
+ signing_key:
111
+ specification_version: 3
112
+ summary: Assets.io Ruby helpers
113
+ test_files: []
114
+