typekit-rails 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/LICENSE +22 -0
- data/README.md +41 -0
- data/app/assets/javascripts/typekit.js.coffee +2 -0
- data/app/helpers/typekit/view_helper.rb +8 -0
- data/lib/typekit/generators/install_generator.rb +47 -0
- data/lib/typekit/rails/engine.rb +13 -0
- data/lib/typekit/rails/railtie.rb +9 -0
- data/lib/typekit/version.rb +3 -0
- data/lib/typekit-rails.rb +1 -0
- data/lib/typekit_rails.rb +4 -0
- data/typekit-rails.gemspec +24 -0
- metadata +56 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 35b60f6dcd9447e5e50bdc0dedefeed59366fae0
|
4
|
+
data.tar.gz: c62b89c393b3d87af6933f77405fa0282c4fd470
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c9af0cd457399356c9d157ce98aa46863b62df18dea7d4cd57826bab696504bcd335b286bc377b35cba8dcbac31cc61ecd28a2e509a5537d72531013ca558bec
|
7
|
+
data.tar.gz: 2ad8b414f5997f5d9eba03c2a22cc78547fdf3c3b40de0e7d305b3e2f8a1ed37b6caca24229894471e49aeba56411d75d72ba1f3a794c91899d8990cbeef23c3
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
typekit-rails-*.gem
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Chris Bielinski
|
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,41 @@
|
|
1
|
+
# Typekit for Rails [![Gem Version](http://img.shields.io/gem/v/typekit.svg)](https://rubygems.org/gems/typekit-rails)
|
2
|
+
|
3
|
+
Adds a Typekit helper to your Rails application and uses [some best practices](http://www.hagenburger.net/BLOG/A-Better-Typekit-Integration.html) for the integration.
|
4
|
+
|
5
|
+
### Installation
|
6
|
+
|
7
|
+
In your `Gemfile` just add:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'typekit'
|
11
|
+
```
|
12
|
+
|
13
|
+
#### Use the Generator
|
14
|
+
|
15
|
+
Run the generator which will prompt you for your kit ID.
|
16
|
+
|
17
|
+
```
|
18
|
+
rails g typekit:install`
|
19
|
+
```
|
20
|
+
|
21
|
+
#### Pro Usage
|
22
|
+
|
23
|
+
Add the JavaScript helper to `application.js` or equivalent:
|
24
|
+
|
25
|
+
```
|
26
|
+
//= require typekit
|
27
|
+
```
|
28
|
+
|
29
|
+
Specify your kit ID as such right near the top of your `<head>` element:
|
30
|
+
|
31
|
+
```
|
32
|
+
<%= typekit 'abc123def456' %>
|
33
|
+
```
|
34
|
+
|
35
|
+
### License
|
36
|
+
|
37
|
+
Licensed under the [MIT License](http://opensource.org/licenses/mit-license.html).
|
38
|
+
|
39
|
+
### Authors
|
40
|
+
|
41
|
+
* Chris Bielinski <chris@shadowreactor.com>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Typekit
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < ::Rails::Generators::Base
|
6
|
+
desc 'Inject Typekit helpers into application code'
|
7
|
+
|
8
|
+
def inject_javascript
|
9
|
+
application_js_path = 'app/assets/javascripts/application.js'
|
10
|
+
if ::File.exists?(::File.join(destination_root, application_js_path))
|
11
|
+
inject_into_file application_js_path, before: '//= require_tree' do
|
12
|
+
"//= require typekit\n"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# def inject_view_helper
|
18
|
+
# application_controller_path = 'app/controllers/application_controller.rb'
|
19
|
+
# if ::File.exists?(::File.join(destination_root, application_controller_path))
|
20
|
+
# inject_into_file application_controller_path, after: "class ApplicationController < ActionController::Base\n" do
|
21
|
+
# " helper :typekit\n"
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
# end
|
25
|
+
|
26
|
+
def inject_into_layout
|
27
|
+
application_layout_path_prefix = 'app/views/layouts/application.html'
|
28
|
+
|
29
|
+
api_key = ask 'What is your kit ID (leave blank to specify later):'
|
30
|
+
api_key = '- YOUR KIT ID HERE -' if api_key.blank?
|
31
|
+
|
32
|
+
layout_templates = { slim: { content: " = typekit '#{api_key}'", after: "head\n" }}
|
33
|
+
layout_templates[:erb] = { content: " <%#{layout_templates[:slim][:content]} %>", after: "<head>\n" }
|
34
|
+
|
35
|
+
layout_templates.each_pair do |lang,options|
|
36
|
+
path = ::File.join(destination_root, "#{application_layout_path_prefix}.#{lang}")
|
37
|
+
if ::File.exists?(path)
|
38
|
+
inject_into_file path, after: options[:after] do
|
39
|
+
"#{options[:content]}\n"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'typekit_rails'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "typekit/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'typekit-rails'
|
7
|
+
s.version = Typekit::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = [ 'Chris Bielinski' ]
|
10
|
+
s.email = [ 'chris@shadowreactor.com' ]
|
11
|
+
s.homepage = 'https://github.com/chrisb/typekit-rails'
|
12
|
+
s.summary = %q{Adobe Typekit helper for Rails.}
|
13
|
+
s.description = %q{Adobe Typekit helper for Rails.}
|
14
|
+
|
15
|
+
s.license = 'MIT'
|
16
|
+
|
17
|
+
# s.add_development_dependency "rspec"
|
18
|
+
# s.rubyforge_project = "lorem"
|
19
|
+
|
20
|
+
s.files = `git ls-files`.split("\n")
|
21
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
23
|
+
s.require_paths = [ 'lib' ]
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: typekit-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Bielinski
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-07 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Adobe Typekit helper for Rails.
|
14
|
+
email:
|
15
|
+
- chris@shadowreactor.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".gitignore"
|
21
|
+
- LICENSE
|
22
|
+
- README.md
|
23
|
+
- app/assets/javascripts/typekit.js.coffee
|
24
|
+
- app/helpers/typekit/view_helper.rb
|
25
|
+
- lib/typekit-rails.rb
|
26
|
+
- lib/typekit/generators/install_generator.rb
|
27
|
+
- lib/typekit/rails/engine.rb
|
28
|
+
- lib/typekit/rails/railtie.rb
|
29
|
+
- lib/typekit/version.rb
|
30
|
+
- lib/typekit_rails.rb
|
31
|
+
- typekit-rails.gemspec
|
32
|
+
homepage: https://github.com/chrisb/typekit-rails
|
33
|
+
licenses:
|
34
|
+
- MIT
|
35
|
+
metadata: {}
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 2.2.2
|
53
|
+
signing_key:
|
54
|
+
specification_version: 4
|
55
|
+
summary: Adobe Typekit helper for Rails.
|
56
|
+
test_files: []
|