fonts-rails 0.1.5 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +7 -1
  4. data/Rakefile +1 -14
  5. data/lib/fonts/rails.rb +2 -1
  6. data/lib/fonts/rails/extensions/action_view/base.rb +20 -0
  7. data/lib/fonts/rails/railtie.rb +4 -2
  8. data/lib/fonts/rails/version.rb +1 -1
  9. data/test/dummy/Rakefile +1 -2
  10. data/test/dummy/app/assets/javascripts/application.js +2 -2
  11. data/test/dummy/app/assets/stylesheets/application.css +6 -4
  12. data/test/dummy/app/views/layouts/application.html.erb +9 -12
  13. data/test/dummy/bin/bundle +1 -0
  14. data/test/dummy/bin/rails +2 -1
  15. data/test/dummy/bin/rake +1 -0
  16. data/test/dummy/bin/setup +30 -0
  17. data/test/dummy/config.ru +1 -1
  18. data/test/dummy/config/application.rb +6 -2
  19. data/test/dummy/config/boot.rb +1 -1
  20. data/test/dummy/config/environment.rb +1 -1
  21. data/test/dummy/config/environments/development.rb +14 -5
  22. data/test/dummy/config/environments/production.rb +18 -26
  23. data/test/dummy/config/environments/test.rb +10 -12
  24. data/test/dummy/config/initializers/assets.rb +11 -0
  25. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  26. data/test/dummy/config/initializers/mime_types.rb +1 -2
  27. data/test/dummy/config/initializers/session_store.rb +1 -1
  28. data/test/dummy/config/routes.rb +2 -2
  29. data/test/dummy/config/secrets.yml +22 -0
  30. data/test/dummy/log/test.log +24 -0
  31. data/test/dummy/public/404.html +58 -55
  32. data/test/dummy/public/422.html +58 -55
  33. data/test/dummy/public/500.html +57 -54
  34. data/test/link_tag_test.rb +5 -2
  35. data/test/test_helper.rb +5 -14
  36. metadata +19 -43
  37. data/lib/fonts/rails/action_view/base.rb +0 -22
  38. data/test/dummy/README.rdoc +0 -28
  39. data/test/dummy/config/database.yml +0 -25
  40. data/test/dummy/config/initializers/secret_token.rb +0 -13
  41. data/test/dummy/db/schema.rb +0 -16
  42. data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  43. data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  44. data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  45. data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  46. data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  47. data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 61274cc05799b0ac2df92bd529134ba47d41b309
4
- data.tar.gz: 65434b98268b196630cc93b632cbd3e672a3ef0a
3
+ metadata.gz: 6a833ff891daaa2fc03199c3340a94f3801ca4b2
4
+ data.tar.gz: 626a3b5610b7bb7ac4bcb7d4b1b15d59bfe758f9
5
5
  SHA512:
6
- metadata.gz: ee1618057ed4b40f636f2a39eefea59264191e783b57ae722fd042387f924e8d197092629e40a7bbaa5a34ad3d699d001b9750e11e867e9c13f9e3d574018509
7
- data.tar.gz: 2905d60707f1932794ecb196a57728c224166c7b8359a2630265a7d32baa62fc1969b7e6e81246994508f9c2d210f7e9cd226ff3a48e71fc6a49e05176232120
6
+ metadata.gz: 763f5fd2f058af67752b0d0b1f873d4d8800bee189dc3bd8cd74eb2311e5554424fd7bd3e1b4930da3d981fb1c7defdd8e22af935599dc16255d70977211214a
7
+ data.tar.gz: 53b847523233559c4afd90f7add1b1645f1e08cca1bbf070480d969b16ca3e13a379fe81e966f17e356bb00af08feff8964a9cab16468fe24429a32f1b0ab28f
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2015 Mathías Montossi
1
+ Copyright 2016 Mathías Montossi
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -5,7 +5,13 @@
5
5
 
6
6
  # Fonts Rails
7
7
 
8
- Adds a simple helper to create the google fonts link tag in rails.
8
+ Adds a helper to create the google fonts link in rails.
9
+
10
+ ## Why
11
+
12
+ I did this gem to:
13
+
14
+ - Have a simple but versatile way to include google fonts.
9
15
 
10
16
  ## Install
11
17
 
data/Rakefile CHANGED
@@ -4,19 +4,6 @@ rescue LoadError
4
4
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
5
  end
6
6
 
7
- require 'rdoc/task'
8
-
9
- RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'FontsRails'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.rdoc')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
15
- end
16
-
17
-
18
-
19
-
20
7
  Bundler::GemHelper.install_tasks
21
8
 
22
9
  require 'rake/testtask'
@@ -26,7 +13,7 @@ Rake::TestTask.new(:test) do |t|
26
13
  t.libs << 'test'
27
14
  t.pattern = 'test/**/*_test.rb'
28
15
  t.verbose = false
16
+ t.warning = false
29
17
  end
30
18
 
31
-
32
19
  task default: :test
data/lib/fonts/rails.rb CHANGED
@@ -1,5 +1,6 @@
1
- require 'fonts/rails/action_view/base'
1
+ require 'fonts/rails/extensions/action_view/base'
2
2
  require 'fonts/rails/railtie'
3
+ require 'fonts/rails/version'
3
4
 
4
5
  module Fonts
5
6
  module Rails
@@ -0,0 +1,20 @@
1
+ module Fonts
2
+ module Rails
3
+ module Extensions
4
+ module ActionView
5
+ module Base
6
+ extend ActiveSupport::Concern
7
+
8
+ def google_fonts_link_tag(family)
9
+ tag(
10
+ :link,
11
+ rel: 'stylesheet',
12
+ href: "#{request.protocol}fonts.googleapis.com/css?family=#{family}"
13
+ )
14
+ end
15
+
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -2,8 +2,10 @@ module Fonts
2
2
  module Rails
3
3
  class Railtie < ::Rails::Railtie
4
4
 
5
- initializer 'fonts.rails' do
6
- ::ActionView::Base.send :include, Fonts::Rails::ActionView::Base
5
+ initializer :fonts do
6
+ ::ActionView::Base.include(
7
+ Fonts::Rails::Extensions::ActionView::Base
8
+ )
7
9
  end
8
10
 
9
11
  end
@@ -1,7 +1,7 @@
1
1
  module Fonts
2
2
  module Rails
3
3
 
4
- VERSION = '0.1.5'
4
+ VERSION = '0.1.7'
5
5
 
6
6
  end
7
7
  end
data/test/dummy/Rakefile CHANGED
@@ -2,5 +2,4 @@
2
2
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
3
 
4
4
  require File.expand_path('../config/application', __FILE__)
5
-
6
- Dummy::Application.load_tasks
5
+ Rails.application.load_tasks
@@ -2,12 +2,12 @@
2
2
  // listed below.
3
3
  //
4
4
  // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
6
  //
7
7
  // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
8
  // compiled file.
9
9
  //
10
- // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
13
  //= require_tree .
@@ -3,11 +3,13 @@
3
3
  * listed below.
4
4
  *
5
5
  * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
7
  *
8
- * You're free to add application-wide styles to this file and they'll appear at the top of the
9
- * compiled file, but it's generally better to create a new file per style scope.
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
10
12
  *
11
- *= require_self
12
13
  *= require_tree .
14
+ *= require_self
13
15
  */
@@ -1,15 +1,12 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%= google_fonts_link_tag 'Open+Sans:300' %>
6
- <%= stylesheet_link_tag 'application', media: 'all' %>
7
- <%= javascript_include_tag 'application' %>
8
- <%= csrf_meta_tags %>
9
- </head>
10
- <body>
11
-
12
- <%= yield %>
13
-
14
- </body>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+ <%= yield %>
11
+ </body>
15
12
  </html>
@@ -1,3 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
+
2
3
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
4
  load Gem.bin_path('bundler', 'bundle')
data/test/dummy/bin/rails CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
2
+
3
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
4
  require_relative '../config/boot'
4
5
  require 'rails/commands'
data/test/dummy/bin/rake CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+
2
3
  require_relative '../config/boot'
3
4
  require 'rake'
4
5
  Rake.application.run
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pathname'
4
+
5
+ # path to your application root.
6
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
7
+
8
+ Dir.chdir APP_ROOT do
9
+ # This script is a starting point to setup your application.
10
+ # Add necessary setup steps to this file:
11
+
12
+ puts '== Installing dependencies =='
13
+ system 'gem install bundler --conservative'
14
+ system 'bundle check || bundle install'
15
+
16
+ # puts "\n== Copying sample files =="
17
+ # unless File.exist?('config/database.yml')
18
+ # system 'cp config/database.yml.sample config/database.yml'
19
+ # end
20
+
21
+ puts "\n== Preparing database =="
22
+ system 'bin/rake db:setup'
23
+
24
+ puts "\n== Removing old logs and tempfiles =="
25
+ system 'rm -f log/*'
26
+ system 'rm -rf tmp/cache'
27
+
28
+ puts "\n== Restarting application server =="
29
+ system 'touch tmp/restart.txt'
30
+ end
data/test/dummy/config.ru CHANGED
@@ -1,4 +1,4 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require ::File.expand_path('../config/environment', __FILE__)
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
4
  run Rails.application
@@ -1,6 +1,11 @@
1
1
  require File.expand_path('../boot', __FILE__)
2
2
 
3
- require 'rails/all'
3
+ require 'active_model/railtie'
4
+ require 'action_controller/railtie'
5
+ require 'action_mailer/railtie'
6
+ require 'action_view/railtie'
7
+ require 'sprockets/railtie'
8
+ require 'rails/test_unit/railtie'
4
9
 
5
10
  Bundler.require(*Rails.groups)
6
11
  require 'fonts-rails'
@@ -20,4 +25,3 @@ module Dummy
20
25
  # config.i18n.default_locale = :de
21
26
  end
22
27
  end
23
-
@@ -1,5 +1,5 @@
1
1
  # Set up gems listed in the Gemfile.
2
2
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
3
 
4
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
5
  $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -2,4 +2,4 @@
2
2
  require File.expand_path('../application', __FILE__)
3
3
 
4
4
  # Initialize the Rails application.
5
- Dummy::Application.initialize!
5
+ Rails.application.initialize!
@@ -1,4 +1,4 @@
1
- Dummy::Application.configure do
1
+ Rails.application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
4
  # In the development environment your application's code is reloaded on
@@ -10,7 +10,7 @@ Dummy::Application.configure do
10
10
  config.eager_load = false
11
11
 
12
12
  # Show full error reports and disable caching.
13
- config.consider_all_requests_local = true
13
+ config.consider_all_requests_local = true
14
14
  config.action_controller.perform_caching = false
15
15
 
16
16
  # Don't care if the mailer can't send.
@@ -19,11 +19,20 @@ Dummy::Application.configure do
19
19
  # Print deprecation notices to the Rails logger.
20
20
  config.active_support.deprecation = :log
21
21
 
22
- # Raise an error on page load if there are pending migrations
23
- config.active_record.migration_error = :page_load
24
-
25
22
  # Debug mode disables concatenation and preprocessing of assets.
26
23
  # This option may cause significant delays in view rendering with a large
27
24
  # number of complex assets.
28
25
  config.assets.debug = true
26
+
27
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
28
+ # yet still be able to expire them through the digest params.
29
+ config.assets.digest = true
30
+
31
+ # Adds additional error checking when serving assets at runtime.
32
+ # Checks for improperly declared sprockets dependencies.
33
+ # Raises helpful error messages.
34
+ config.assets.raise_runtime_errors = true
35
+
36
+ # Raises error for missing translations
37
+ # config.action_view.raise_on_missing_translations = true
29
38
  end
@@ -1,30 +1,28 @@
1
- Dummy::Application.configure do
1
+ Rails.application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
4
  # Code is not reloaded between requests.
5
5
  config.cache_classes = true
6
6
 
7
7
  # Eager load code on boot. This eager loads most of Rails and
8
- # your application in memory, allowing both thread web servers
8
+ # your application in memory, allowing both threaded web servers
9
9
  # and those relying on copy on write to perform better.
10
10
  # Rake tasks automatically ignore this option for performance.
11
11
  config.eager_load = true
12
12
 
13
13
  # Full error reports are disabled and caching is turned on.
14
- config.consider_all_requests_local = false
14
+ config.consider_all_requests_local = false
15
15
  config.action_controller.perform_caching = true
16
16
 
17
17
  # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
18
  # Add `rack-cache` to your Gemfile before enabling this.
19
- # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
19
+ # For large-scale production use, consider using a caching reverse proxy like
20
+ # NGINX, varnish or squid.
20
21
  # config.action_dispatch.rack_cache = true
21
22
 
22
- # Disable Rails's static asset server (Apache or nginx will already do this).
23
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
24
- config.serve_static_files = false
25
- else
26
- config.serve_static_assets = false
27
- end
23
+ # Disable serving static files from the `/public` folder by default since
24
+ # Apache or NGINX already handles this.
25
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
28
26
 
29
27
  # Compress JavaScripts and CSS.
30
28
  config.assets.js_compressor = :uglifier
@@ -33,21 +31,22 @@ Dummy::Application.configure do
33
31
  # Do not fallback to assets pipeline if a precompiled asset is missed.
34
32
  config.assets.compile = false
35
33
 
36
- # Generate digests for assets URLs.
34
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
35
+ # yet still be able to expire them through the digest params.
37
36
  config.assets.digest = true
38
37
 
39
- # Version of your assets, change this if you want to expire all your assets.
40
- config.assets.version = '1.0'
38
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
41
39
 
42
40
  # Specifies the header that your server uses for sending files.
43
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
44
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
42
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
45
43
 
46
44
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
47
45
  # config.force_ssl = true
48
46
 
49
- # Set to :debug to see everything in the log.
50
- config.log_level = :info
47
+ # Use the lowest log level to ensure availability of diagnostic information
48
+ # when problems arise.
49
+ config.log_level = :debug
51
50
 
52
51
  # Prepend all log lines with the following tags.
53
52
  # config.log_tags = [ :subdomain, :uuid ]
@@ -59,26 +58,19 @@ Dummy::Application.configure do
59
58
  # config.cache_store = :mem_cache_store
60
59
 
61
60
  # Enable serving of images, stylesheets, and JavaScripts from an asset server.
62
- # config.action_controller.asset_host = "http://assets.example.com"
63
-
64
- # Precompile additional assets.
65
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
66
- # config.assets.precompile += %w( search.js )
61
+ # config.action_controller.asset_host = 'http://assets.example.com'
67
62
 
68
63
  # Ignore bad email addresses and do not raise email delivery errors.
69
64
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
70
65
  # config.action_mailer.raise_delivery_errors = false
71
66
 
72
67
  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
73
- # the I18n.default_locale when a translation can not be found).
68
+ # the I18n.default_locale when a translation cannot be found).
74
69
  config.i18n.fallbacks = true
75
70
 
76
71
  # Send deprecation notices to registered listeners.
77
72
  config.active_support.deprecation = :notify
78
73
 
79
- # Disable automatic flushing of the log to improve performance.
80
- # config.autoflush_log = false
81
-
82
74
  # Use default logging formatter so that PID and timestamp are not suppressed.
83
75
  config.log_formatter = ::Logger::Formatter.new
84
76
  end
@@ -1,4 +1,4 @@
1
- Dummy::Application.configure do
1
+ Rails.application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
4
  # The test environment is used exclusively to run your application's
@@ -12,16 +12,12 @@ Dummy::Application.configure do
12
12
  # preloads Rails for running tests, you may have to set it to true.
13
13
  config.eager_load = false
14
14
 
15
- # Configure static asset server for tests with Cache-Control for performance.
16
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
17
- config.serve_static_files = false
18
- else
19
- config.serve_static_assets = false
20
- end
21
- config.static_cache_control = "public, max-age=3600"
15
+ # Configure static file server for tests with Cache-Control for performance.
16
+ config.serve_static_files = true
17
+ config.static_cache_control = 'public, max-age=3600'
22
18
 
23
19
  # Show full error reports and disable caching.
24
- config.consider_all_requests_local = true
20
+ config.consider_all_requests_local = true
25
21
  config.action_controller.perform_caching = false
26
22
 
27
23
  # Raise exceptions instead of rendering exception templates.
@@ -35,10 +31,12 @@ Dummy::Application.configure do
35
31
  # ActionMailer::Base.deliveries array.
36
32
  config.action_mailer.delivery_method = :test
37
33
 
34
+ # Randomize the order test cases are executed.
35
+ config.active_support.test_order = :random
36
+
38
37
  # Print deprecation notices to the stderr.
39
38
  config.active_support.deprecation = :stderr
40
39
 
41
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
42
- config.active_support.test_order = :random
43
- end
40
+ # Raises error for missing translations
41
+ # config.action_view.raise_on_missing_translations = true
44
42
  end