weather-icons-rails 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/app/assets/stylesheets/weather-icons/_bootstrap.css.scss +87 -0
 - data/app/assets/stylesheets/weather-icons/_bordered-pulled.css.scss +16 -0
 - data/app/assets/stylesheets/weather-icons/_core.css.scss +13 -0
 - data/app/assets/stylesheets/weather-icons/_extras.css.scss +44 -0
 - data/app/assets/stylesheets/weather-icons/_fixed-width.css.scss +6 -0
 - data/app/assets/stylesheets/weather-icons/_icons.css.scss +95 -0
 - data/app/assets/stylesheets/weather-icons/_larger.css.scss +43 -0
 - data/app/assets/stylesheets/weather-icons/_list.css.scss +19 -0
 - data/app/assets/stylesheets/weather-icons/_mixins.css.scss +20 -0
 - data/app/assets/stylesheets/weather-icons/_path.css.scss +13 -0
 - data/app/assets/stylesheets/weather-icons/_rotated-flipped.css.scss +9 -0
 - data/app/assets/stylesheets/weather-icons/_spinning.css.scss +27 -0
 - data/app/assets/stylesheets/weather-icons/_stacked.css.scss +20 -0
 - data/app/assets/stylesheets/weather-icons/_variables.css.scss +102 -0
 - data/app/assets/stylesheets/weather-icons.css.scss +45 -0
 - data/lib/weather-icons/rails/rails/engine.rb +13 -0
 - data/lib/weather-icons/rails/rails/helpers.rb +94 -0
 - data/lib/weather-icons/rails/rails/railtie.rb +13 -0
 - data/lib/weather-icons/rails/version.rb +5 -0
 - data/lib/weather-icons/rails.rb +58 -0
 - data/lib/weather-icons-rails.rb +3 -4
 - data/test/dummy/app/assets/stylesheets/sass-import.css.sass +1 -1
 - data/test/dummy/app/assets/stylesheets/scss-import.css.scss +1 -1
 - data/test/dummy/app/assets/stylesheets/sprockets-require.css +2 -2
 - data/test/dummy/app/controllers/pages_controller.rb +2 -2
 - data/test/dummy/app/views/pages/icons.html.erb +2 -2
 - data/test/dummy/config/application.rb +18 -18
 - data/test/dummy/config/boot.rb +10 -10
 - data/test/dummy/config/environment.rb +5 -5
 - data/test/dummy/config/initializers/secret_token.rb +8 -8
 - data/test/dummy/config/routes.rb +3 -3
 - data/test/dummy/config.ru +4 -4
 - data/test/font_awesome_rails_test.rb +65 -65
 - data/test/icon_helper_test.rb +113 -113
 - data/test/test_helper.rb +7 -7
 - metadata +80 -9
 - data/app/assets/stylesheets/weather-icons.css +0 -327
 - data/app/helpers/font_awesome/rails/icon_helper.rb +0 -92
 - data/app/helpers/weather_icons/rails/icon_helper.rb +0 -92
 - data/lib/weather-icons-rails/engine.rb +0 -4
 - data/lib/weather-icons-rails/version.rb +0 -3
 
| 
         @@ -0,0 +1,94 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module WeatherIcons
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Rails
         
     | 
| 
      
 3 
     | 
    
         
            +
                module Rails
         
     | 
| 
      
 4 
     | 
    
         
            +
                  module IconHelpers
         
     | 
| 
      
 5 
     | 
    
         
            +
                    # Creates an icon tag given an icon name and possible icon
         
     | 
| 
      
 6 
     | 
    
         
            +
                    # modifiers.
         
     | 
| 
      
 7 
     | 
    
         
            +
                    #
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Examples
         
     | 
| 
      
 9 
     | 
    
         
            +
                    #
         
     | 
| 
      
 10 
     | 
    
         
            +
                    #   wi_icon "camera-retro"
         
     | 
| 
      
 11 
     | 
    
         
            +
                    #   # => <i class="wi-camera-retro"></i>
         
     | 
| 
      
 12 
     | 
    
         
            +
                    #
         
     | 
| 
      
 13 
     | 
    
         
            +
                    #   wi_icon "camera-retro", text: "Take a photo"
         
     | 
| 
      
 14 
     | 
    
         
            +
                    #   # => <i class="wi-camera-retro"></i> Take a photo
         
     | 
| 
      
 15 
     | 
    
         
            +
                    #
         
     | 
| 
      
 16 
     | 
    
         
            +
                    #   wi_icon "camera-retro 2x"
         
     | 
| 
      
 17 
     | 
    
         
            +
                    #   # => <i class="wi-camera-retro wi-2x"></i>
         
     | 
| 
      
 18 
     | 
    
         
            +
                    #   wi_icon ["camera-retro", "4x"]
         
     | 
| 
      
 19 
     | 
    
         
            +
                    #   # => <i class="wi-camera-retro wi-4x"></i>
         
     | 
| 
      
 20 
     | 
    
         
            +
                    #   wi_icon "spinner spin lg"
         
     | 
| 
      
 21 
     | 
    
         
            +
                    #   # => <i class="wi-spinner wi-spin wi-lg">
         
     | 
| 
      
 22 
     | 
    
         
            +
                    #
         
     | 
| 
      
 23 
     | 
    
         
            +
                    #   wi_icon "quote-left 4x", class: "pull-left"
         
     | 
| 
      
 24 
     | 
    
         
            +
                    #   # => <i class="wi-quote-left wi-4x pull-left"></i>
         
     | 
| 
      
 25 
     | 
    
         
            +
                    #
         
     | 
| 
      
 26 
     | 
    
         
            +
                    #   wi_icon "user", data: { id: 123 }
         
     | 
| 
      
 27 
     | 
    
         
            +
                    #   # => <i class="wi-user" data-id="123"></i>
         
     | 
| 
      
 28 
     | 
    
         
            +
                    #
         
     | 
| 
      
 29 
     | 
    
         
            +
                    #   content_tag(:li, wi_icon("check li", text: "Bulleted list item"))
         
     | 
| 
      
 30 
     | 
    
         
            +
                    #   # => <li><i class="wi-check wi-li"></i> Bulleted list item</li>
         
     | 
| 
      
 31 
     | 
    
         
            +
                    def wi_icon(names = "flag", options = {})
         
     | 
| 
      
 32 
     | 
    
         
            +
                      classes = []
         
     | 
| 
      
 33 
     | 
    
         
            +
                      classes.concat Private.icon_names(names)
         
     | 
| 
      
 34 
     | 
    
         
            +
                      classes.concat Array(options.delete(:class))
         
     | 
| 
      
 35 
     | 
    
         
            +
                      text = options.delete(:text)
         
     | 
| 
      
 36 
     | 
    
         
            +
                      icon = content_tag(:i, nil, options.merge(:class => classes))
         
     | 
| 
      
 37 
     | 
    
         
            +
                      Private.icon_join(icon, text)
         
     | 
| 
      
 38 
     | 
    
         
            +
                    end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                    # Creates an stack set of icon tags given a base icon name, a main icon
         
     | 
| 
      
 41 
     | 
    
         
            +
                    # name, and possible icon modifiers.
         
     | 
| 
      
 42 
     | 
    
         
            +
                    #
         
     | 
| 
      
 43 
     | 
    
         
            +
                    # Examples
         
     | 
| 
      
 44 
     | 
    
         
            +
                    #
         
     | 
| 
      
 45 
     | 
    
         
            +
                    #   wi_stacked_icon "twitter", base: "square-o"
         
     | 
| 
      
 46 
     | 
    
         
            +
                    #   # => <span class="wi-stack">
         
     | 
| 
      
 47 
     | 
    
         
            +
                    #   # =>   <i class="wi-square-o wi-stack-2x"></i>
         
     | 
| 
      
 48 
     | 
    
         
            +
                    #   # =>   <i class="wi-twitter wi-stack-1x"></i>
         
     | 
| 
      
 49 
     | 
    
         
            +
                    #   # => </span>
         
     | 
| 
      
 50 
     | 
    
         
            +
                    #
         
     | 
| 
      
 51 
     | 
    
         
            +
                    #   wi_stacked_icon "terminal inverse", base: "square", class: "pull-right", text: "Hi!"
         
     | 
| 
      
 52 
     | 
    
         
            +
                    #   # => <span class="wi-stack pull-right">
         
     | 
| 
      
 53 
     | 
    
         
            +
                    #   # =>   <i class="wi-square wi-stack-2x"></i>
         
     | 
| 
      
 54 
     | 
    
         
            +
                    #   # =>   <i class="wi-terminal wi-inverse wi-stack-1x"></i>
         
     | 
| 
      
 55 
     | 
    
         
            +
                    #   # => </span> Hi!
         
     | 
| 
      
 56 
     | 
    
         
            +
                    #
         
     | 
| 
      
 57 
     | 
    
         
            +
                    #   wi_stacked_icon "camera", base: "ban-circle", reverse: true
         
     | 
| 
      
 58 
     | 
    
         
            +
                    #   # => <span class="wi-stack">
         
     | 
| 
      
 59 
     | 
    
         
            +
                    #   # =>   <i class="wi-camera wi-stack-1x"></i>
         
     | 
| 
      
 60 
     | 
    
         
            +
                    #   # =>   <i class="wi-ban-circle wi-stack-2x"></i>
         
     | 
| 
      
 61 
     | 
    
         
            +
                    #   # => </span>
         
     | 
| 
      
 62 
     | 
    
         
            +
                    def wi_stacked_icon(names = "flag", options = {})
         
     | 
| 
      
 63 
     | 
    
         
            +
                      classes = Private.icon_names("stack").concat(Array(options.delete(:class)))
         
     | 
| 
      
 64 
     | 
    
         
            +
                      base_names = Private.array_value(options.delete(:base) || "square-o").push("stack-2x")
         
     | 
| 
      
 65 
     | 
    
         
            +
                      names = Private.array_value(names).push("stack-1x")
         
     | 
| 
      
 66 
     | 
    
         
            +
                      base = wi_icon(base_names, options.delete(:base_options) || {})
         
     | 
| 
      
 67 
     | 
    
         
            +
                      icon = wi_icon(names, options.delete(:icon_options) || {})
         
     | 
| 
      
 68 
     | 
    
         
            +
                      icons = [base, icon]
         
     | 
| 
      
 69 
     | 
    
         
            +
                      icons.reverse! if options.delete(:reverse)
         
     | 
| 
      
 70 
     | 
    
         
            +
                      text = options.delete(:text)
         
     | 
| 
      
 71 
     | 
    
         
            +
                      stacked_icon = content_tag(:span, safe_join(icons), options.merge(:class => classes))
         
     | 
| 
      
 72 
     | 
    
         
            +
                      Private.icon_join(stacked_icon, text)
         
     | 
| 
      
 73 
     | 
    
         
            +
                    end
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
                    module Private
         
     | 
| 
      
 76 
     | 
    
         
            +
                      extend ActionView::Helpers::OutputSafetyHelper
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                      def self.icon_join(icon, text)
         
     | 
| 
      
 79 
     | 
    
         
            +
                        return icon if text.blank?
         
     | 
| 
      
 80 
     | 
    
         
            +
                        safe_join([icon, ERB::Util.html_escape(text)], " ")
         
     | 
| 
      
 81 
     | 
    
         
            +
                      end
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                      def self.icon_names(names = [])
         
     | 
| 
      
 84 
     | 
    
         
            +
                        array_value(names).map { |n| "wi-#{n}" }
         
     | 
| 
      
 85 
     | 
    
         
            +
                      end
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
                      def self.array_value(value = [])
         
     | 
| 
      
 88 
     | 
    
         
            +
                        value.is_a?(Array) ? value : value.to_s.split(/\s+/)
         
     | 
| 
      
 89 
     | 
    
         
            +
                      end
         
     | 
| 
      
 90 
     | 
    
         
            +
                    end
         
     | 
| 
      
 91 
     | 
    
         
            +
                  end
         
     | 
| 
      
 92 
     | 
    
         
            +
                end
         
     | 
| 
      
 93 
     | 
    
         
            +
              end
         
     | 
| 
      
 94 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "weather-icons/rails/rails/helpers"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module WeatherIcons
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Rails
         
     | 
| 
      
 5 
     | 
    
         
            +
                module Rails
         
     | 
| 
      
 6 
     | 
    
         
            +
                  class Railtie < ::Rails::Railtie
         
     | 
| 
      
 7 
     | 
    
         
            +
                   initializer "weather-icons-rails.view_helpers" do
         
     | 
| 
      
 8 
     | 
    
         
            +
                      ActionView::Base.send :include, IconHelpers
         
     | 
| 
      
 9 
     | 
    
         
            +
                    end
         
     | 
| 
      
 10 
     | 
    
         
            +
                  end
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,58 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module WeatherIcons
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Rails
         
     | 
| 
      
 3 
     | 
    
         
            +
                class << self
         
     | 
| 
      
 4 
     | 
    
         
            +
                  def load!
         
     | 
| 
      
 5 
     | 
    
         
            +
                    if rails?
         
     | 
| 
      
 6 
     | 
    
         
            +
                      register_rails_engine
         
     | 
| 
      
 7 
     | 
    
         
            +
                    end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                    if compass?
         
     | 
| 
      
 10 
     | 
    
         
            +
                      register_compass_extension
         
     | 
| 
      
 11 
     | 
    
         
            +
                    end
         
     | 
| 
      
 12 
     | 
    
         
            +
                  end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  def gem_path
         
     | 
| 
      
 15 
     | 
    
         
            +
                    @gem_path ||= File.expand_path('..', File.dirname(__FILE__))
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                  def stylesheets_path
         
     | 
| 
      
 19 
     | 
    
         
            +
                    File.join(assets_path, 'stylesheets')
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  def fonts_path
         
     | 
| 
      
 23 
     | 
    
         
            +
                    File.join(assets_path, 'fonts')
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  def assets_path
         
     | 
| 
      
 27 
     | 
    
         
            +
                    @assets_path ||= File.join(gem_path, 'vendor', 'assets')
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  def compass?
         
     | 
| 
      
 31 
     | 
    
         
            +
                    defined?(::Compass)
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                  def rails?
         
     | 
| 
      
 35 
     | 
    
         
            +
                    defined?(::Rails)
         
     | 
| 
      
 36 
     | 
    
         
            +
                  end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                  private
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                  def register_compass_extension
         
     | 
| 
      
 41 
     | 
    
         
            +
                    ::Compass::Frameworks.register(
         
     | 
| 
      
 42 
     | 
    
         
            +
                      'weather-icons',
         
     | 
| 
      
 43 
     | 
    
         
            +
                      path: gem_path,
         
     | 
| 
      
 44 
     | 
    
         
            +
                      stylesheets_directory: stylesheets_path,
         
     | 
| 
      
 45 
     | 
    
         
            +
                      templates_directory: File.join(gem_path, 'templates')
         
     | 
| 
      
 46 
     | 
    
         
            +
                    )
         
     | 
| 
      
 47 
     | 
    
         
            +
                  end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                  def register_rails_engine
         
     | 
| 
      
 50 
     | 
    
         
            +
                    require 'sass-rails'
         
     | 
| 
      
 51 
     | 
    
         
            +
                    require 'weather-icons/rails/rails/engine'
         
     | 
| 
      
 52 
     | 
    
         
            +
                    require 'weather-icons/rails/rails/railtie'
         
     | 
| 
      
 53 
     | 
    
         
            +
                  end
         
     | 
| 
      
 54 
     | 
    
         
            +
                end
         
     | 
| 
      
 55 
     | 
    
         
            +
              end
         
     | 
| 
      
 56 
     | 
    
         
            +
            end
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            WeatherIcons::Rails.load!
         
     | 
    
        data/lib/weather-icons-rails.rb
    CHANGED
    
    | 
         @@ -1,4 +1,3 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require  
     | 
| 
       2 
     | 
    
         
            -
            require "weather-icons-rails/ 
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            end
         
     | 
| 
      
 1 
     | 
    
         
            +
            require 'weather-icons/rails'
         
     | 
| 
      
 2 
     | 
    
         
            +
            # require "weather-icons-rails/version"
         
     | 
| 
      
 3 
     | 
    
         
            +
            # require "weather-icons-rails/engine" if defined?(::Rails)
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            @import font-awesome
         
     | 
| 
      
 1 
     | 
    
         
            +
            // @import font-awesome
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            @import "font-awesome";
         
     | 
| 
      
 1 
     | 
    
         
            +
            // @import "font-awesome";
         
     | 
| 
         @@ -1,3 +1,3 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            /*
         
     | 
| 
       2 
     | 
    
         
            -
              
     | 
| 
       3 
     | 
    
         
            -
             */
         
     | 
| 
      
 2 
     | 
    
         
            +
             **= require font-awesome
         
     | 
| 
      
 3 
     | 
    
         
            +
             */
         
     | 
| 
         @@ -1,2 +1,2 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            class PagesController < ActionController::Base
         
     | 
| 
       2 
     | 
    
         
            -
            end
         
     | 
| 
      
 1 
     | 
    
         
            +
            # class PagesController < ActionController::Base
         
     | 
| 
      
 2 
     | 
    
         
            +
            # end
         
     | 
| 
         @@ -1,3 +1,3 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            <%= fa_icon "flag" %>
         
     | 
| 
      
 1 
     | 
    
         
            +
            <!-- <%= fa_icon "flag" %>
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            <%= fa_stacked_icon "twitter", :base => "check-empty" %>
         
     | 
| 
      
 3 
     | 
    
         
            +
            <%= fa_stacked_icon "twitter", :base => "check-empty" %> -->
         
     | 
| 
         @@ -1,18 +1,18 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require File.expand_path('../boot', __FILE__)
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            # require "rails/all"
         
     | 
| 
       4 
     | 
    
         
            -
            require "sprockets/railtie"
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
            Bundler.require(:default, :development)
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
            module Dummy
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
            end
         
     | 
| 
      
 1 
     | 
    
         
            +
            # require File.expand_path('../boot', __FILE__)
         
     | 
| 
      
 2 
     | 
    
         
            +
            #
         
     | 
| 
      
 3 
     | 
    
         
            +
            # # require "rails/all"
         
     | 
| 
      
 4 
     | 
    
         
            +
            # require "sprockets/railtie"
         
     | 
| 
      
 5 
     | 
    
         
            +
            #
         
     | 
| 
      
 6 
     | 
    
         
            +
            # Bundler.require(:default, :development)
         
     | 
| 
      
 7 
     | 
    
         
            +
            #
         
     | 
| 
      
 8 
     | 
    
         
            +
            # module Dummy
         
     | 
| 
      
 9 
     | 
    
         
            +
            #   class Application < Rails::Application
         
     | 
| 
      
 10 
     | 
    
         
            +
            #     config.encoding = "utf-8"
         
     | 
| 
      
 11 
     | 
    
         
            +
            #     config.assets.enabled = true
         
     | 
| 
      
 12 
     | 
    
         
            +
            #     config.assets.version = '1.0'
         
     | 
| 
      
 13 
     | 
    
         
            +
            #
         
     | 
| 
      
 14 
     | 
    
         
            +
            #     # replacement for environments/*.rb
         
     | 
| 
      
 15 
     | 
    
         
            +
            #     config.active_support.deprecation = :stderr
         
     | 
| 
      
 16 
     | 
    
         
            +
            #     config.eager_load = false
         
     | 
| 
      
 17 
     | 
    
         
            +
            #   end
         
     | 
| 
      
 18 
     | 
    
         
            +
            # end
         
     | 
    
        data/test/dummy/config/boot.rb
    CHANGED
    
    | 
         @@ -1,10 +1,10 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'rubygems'
         
     | 
| 
       2 
     | 
    
         
            -
            gemfile = File.expand_path('../../../../Gemfile', __FILE__)
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            if File.exist?(gemfile)
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
            end
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            $:.unshift File.expand_path('../../../../lib', __FILE__)
         
     | 
| 
      
 1 
     | 
    
         
            +
            # require 'rubygems'
         
     | 
| 
      
 2 
     | 
    
         
            +
            # gemfile = File.expand_path('../../../../Gemfile', __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            #
         
     | 
| 
      
 4 
     | 
    
         
            +
            # if File.exist?(gemfile)
         
     | 
| 
      
 5 
     | 
    
         
            +
            #   ENV['BUNDLE_GEMFILE'] = gemfile
         
     | 
| 
      
 6 
     | 
    
         
            +
            #   require 'bundler'
         
     | 
| 
      
 7 
     | 
    
         
            +
            #   Bundler.setup
         
     | 
| 
      
 8 
     | 
    
         
            +
            # end
         
     | 
| 
      
 9 
     | 
    
         
            +
            #
         
     | 
| 
      
 10 
     | 
    
         
            +
            # $:.unshift File.expand_path('../../../../lib', __FILE__)
         
     | 
| 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # Load the rails application
         
     | 
| 
       2 
     | 
    
         
            -
            require File.expand_path('../application', __FILE__)
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            # Initialize the rails application
         
     | 
| 
       5 
     | 
    
         
            -
            Dummy::Application.initialize!
         
     | 
| 
      
 1 
     | 
    
         
            +
            # # Load the rails application
         
     | 
| 
      
 2 
     | 
    
         
            +
            # require File.expand_path('../application', __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            #
         
     | 
| 
      
 4 
     | 
    
         
            +
            # # Initialize the rails application
         
     | 
| 
      
 5 
     | 
    
         
            +
            # Dummy::Application.initialize!
         
     | 
| 
         @@ -1,8 +1,8 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # Be sure to restart your server when you modify this file.
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            # Your secret key for verifying the integrity of signed cookies.
         
     | 
| 
       4 
     | 
    
         
            -
            # If you change this key, all old signed cookies will become invalid!
         
     | 
| 
       5 
     | 
    
         
            -
            # Make sure the secret is at least 30 characters and all random,
         
     | 
| 
       6 
     | 
    
         
            -
            # no regular words or you'll be exposed to dictionary attacks.
         
     | 
| 
       7 
     | 
    
         
            -
            Dummy::Application.config.secret_token    = 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef'
         
     | 
| 
       8 
     | 
    
         
            -
            Dummy::Application.config.secret_key_base = 'deadbeef' if Dummy::Application.config.respond_to?(:secret_key_base)
         
     | 
| 
      
 1 
     | 
    
         
            +
            # # Be sure to restart your server when you modify this file.
         
     | 
| 
      
 2 
     | 
    
         
            +
            #
         
     | 
| 
      
 3 
     | 
    
         
            +
            # # Your secret key for verifying the integrity of signed cookies.
         
     | 
| 
      
 4 
     | 
    
         
            +
            # # If you change this key, all old signed cookies will become invalid!
         
     | 
| 
      
 5 
     | 
    
         
            +
            # # Make sure the secret is at least 30 characters and all random,
         
     | 
| 
      
 6 
     | 
    
         
            +
            # # no regular words or you'll be exposed to dictionary attacks.
         
     | 
| 
      
 7 
     | 
    
         
            +
            # Dummy::Application.config.secret_token    = 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef'
         
     | 
| 
      
 8 
     | 
    
         
            +
            # Dummy::Application.config.secret_key_base = 'deadbeef' if Dummy::Application.config.respond_to?(:secret_key_base)
         
     | 
    
        data/test/dummy/config/routes.rb
    CHANGED
    
    | 
         @@ -1,3 +1,3 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            Dummy::Application.routes.draw do
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            end
         
     | 
| 
      
 1 
     | 
    
         
            +
            # Dummy::Application.routes.draw do
         
     | 
| 
      
 2 
     | 
    
         
            +
            #   get "/icons", :to => "pages#icons"
         
     | 
| 
      
 3 
     | 
    
         
            +
            # end
         
     | 
    
        data/test/dummy/config.ru
    CHANGED
    
    | 
         @@ -1,4 +1,4 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # This file is used by Rack-based servers to start the application.
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            require ::File.expand_path('../config/environment',  __FILE__)
         
     | 
| 
       4 
     | 
    
         
            -
            run Dummy::Application
         
     | 
| 
      
 1 
     | 
    
         
            +
            # # This file is used by Rack-based servers to start the application.
         
     | 
| 
      
 2 
     | 
    
         
            +
            #
         
     | 
| 
      
 3 
     | 
    
         
            +
            # require ::File.expand_path('../config/environment',  __FILE__)
         
     | 
| 
      
 4 
     | 
    
         
            +
            # run Dummy::Application
         
     | 
| 
         @@ -1,65 +1,65 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'test_helper'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            class FontAwesomeRailsTest < ActionDispatch::IntegrationTest
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
            end
         
     | 
| 
      
 1 
     | 
    
         
            +
            # require 'test_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
            #
         
     | 
| 
      
 3 
     | 
    
         
            +
            # class FontAwesomeRailsTest < ActionDispatch::IntegrationTest
         
     | 
| 
      
 4 
     | 
    
         
            +
            #   teardown { clean_sprockets_cache }
         
     | 
| 
      
 5 
     | 
    
         
            +
            #
         
     | 
| 
      
 6 
     | 
    
         
            +
            #   test "engine is loaded" do
         
     | 
| 
      
 7 
     | 
    
         
            +
            #     assert_equal ::Rails::Engine, FontAwesome::Rails::Engine.superclass
         
     | 
| 
      
 8 
     | 
    
         
            +
            #   end
         
     | 
| 
      
 9 
     | 
    
         
            +
            #
         
     | 
| 
      
 10 
     | 
    
         
            +
            #   test "fonts are served" do
         
     | 
| 
      
 11 
     | 
    
         
            +
            #     get "/assets/fontawesome-webfont.eot"
         
     | 
| 
      
 12 
     | 
    
         
            +
            #     assert_response :success
         
     | 
| 
      
 13 
     | 
    
         
            +
            #     get "/assets/fontawesome-webfont.ttf"
         
     | 
| 
      
 14 
     | 
    
         
            +
            #     assert_response :success
         
     | 
| 
      
 15 
     | 
    
         
            +
            #     get "/assets/fontawesome-webfont.woff"
         
     | 
| 
      
 16 
     | 
    
         
            +
            #     assert_response :success
         
     | 
| 
      
 17 
     | 
    
         
            +
            #   end
         
     | 
| 
      
 18 
     | 
    
         
            +
            #
         
     | 
| 
      
 19 
     | 
    
         
            +
            #   test "stylesheets are served" do
         
     | 
| 
      
 20 
     | 
    
         
            +
            #     get "/assets/font-awesome.css"
         
     | 
| 
      
 21 
     | 
    
         
            +
            #     assert_font_awesome(response)
         
     | 
| 
      
 22 
     | 
    
         
            +
            #   end
         
     | 
| 
      
 23 
     | 
    
         
            +
            #
         
     | 
| 
      
 24 
     | 
    
         
            +
            #   test "stylesheets contain asset pipeline references to fonts" do
         
     | 
| 
      
 25 
     | 
    
         
            +
            #     get "/assets/font-awesome.css"
         
     | 
| 
      
 26 
     | 
    
         
            +
            #     assert_match "/assets/fontawesome-webfont.eot",  response.body
         
     | 
| 
      
 27 
     | 
    
         
            +
            #     assert_match "/assets/fontawesome-webfont.eot?#iefix", response.body
         
     | 
| 
      
 28 
     | 
    
         
            +
            #     assert_match "/assets/fontawesome-webfont.woff", response.body
         
     | 
| 
      
 29 
     | 
    
         
            +
            #     assert_match "/assets/fontawesome-webfont.ttf",  response.body
         
     | 
| 
      
 30 
     | 
    
         
            +
            #     assert_match "/assets/fontawesome-webfont.svg#fontawesomeregular", response.body
         
     | 
| 
      
 31 
     | 
    
         
            +
            #   end
         
     | 
| 
      
 32 
     | 
    
         
            +
            #
         
     | 
| 
      
 33 
     | 
    
         
            +
            #   test "stylesheet is available in a css sprockets require" do
         
     | 
| 
      
 34 
     | 
    
         
            +
            #     get "/assets/sprockets-require.css"
         
     | 
| 
      
 35 
     | 
    
         
            +
            #     assert_font_awesome(response)
         
     | 
| 
      
 36 
     | 
    
         
            +
            #   end
         
     | 
| 
      
 37 
     | 
    
         
            +
            #
         
     | 
| 
      
 38 
     | 
    
         
            +
            #   test "stylesheet is available in a sass import" do
         
     | 
| 
      
 39 
     | 
    
         
            +
            #     get "/assets/sass-import.css"
         
     | 
| 
      
 40 
     | 
    
         
            +
            #     assert_font_awesome(response)
         
     | 
| 
      
 41 
     | 
    
         
            +
            #   end
         
     | 
| 
      
 42 
     | 
    
         
            +
            #
         
     | 
| 
      
 43 
     | 
    
         
            +
            #   test "stylesheet is available in a scss import" do
         
     | 
| 
      
 44 
     | 
    
         
            +
            #     get "/assets/scss-import.css"
         
     | 
| 
      
 45 
     | 
    
         
            +
            #     assert_font_awesome(response)
         
     | 
| 
      
 46 
     | 
    
         
            +
            #   end
         
     | 
| 
      
 47 
     | 
    
         
            +
            #
         
     | 
| 
      
 48 
     | 
    
         
            +
            #   test "helpers should be available in the view" do
         
     | 
| 
      
 49 
     | 
    
         
            +
            #     get "/icons"
         
     | 
| 
      
 50 
     | 
    
         
            +
            #     assert_response :success
         
     | 
| 
      
 51 
     | 
    
         
            +
            #     assert_select "i.fa.fa-flag"
         
     | 
| 
      
 52 
     | 
    
         
            +
            #     assert_select "span.fa-stack"
         
     | 
| 
      
 53 
     | 
    
         
            +
            #   end
         
     | 
| 
      
 54 
     | 
    
         
            +
            #
         
     | 
| 
      
 55 
     | 
    
         
            +
            #   private
         
     | 
| 
      
 56 
     | 
    
         
            +
            #
         
     | 
| 
      
 57 
     | 
    
         
            +
            #   def clean_sprockets_cache
         
     | 
| 
      
 58 
     | 
    
         
            +
            #     FileUtils.rm_rf File.expand_path("../dummy/tmp",  __FILE__)
         
     | 
| 
      
 59 
     | 
    
         
            +
            #   end
         
     | 
| 
      
 60 
     | 
    
         
            +
            #
         
     | 
| 
      
 61 
     | 
    
         
            +
            #   def assert_font_awesome(response)
         
     | 
| 
      
 62 
     | 
    
         
            +
            #     assert_response :success
         
     | 
| 
      
 63 
     | 
    
         
            +
            #     assert_match(/font-family:\s*'FontAwesome';/, response.body)
         
     | 
| 
      
 64 
     | 
    
         
            +
            #   end
         
     | 
| 
      
 65 
     | 
    
         
            +
            # end
         
     |