premailer-1.8.6/ 0000755 0001750 0001750 00000000000 12703352566 015005 5 ustar balasankarc balasankarc premailer-1.8.6/init.rb 0000644 0001750 0001750 00000000024 12703352566 016271 0 ustar balasankarc balasankarc require 'premailer' premailer-1.8.6/.jrubyrc 0000644 0001750 0001750 00000000022 12703352566 016460 0 ustar balasankarc balasankarc cext.enabled=true premailer-1.8.6/bin/ 0000755 0001750 0001750 00000000000 12703352566 015555 5 ustar balasankarc balasankarc premailer-1.8.6/bin/premailer 0000755 0001750 0001750 00000000220 12703352566 017455 0 ustar balasankarc balasankarc #!/usr/bin/env ruby # This binary used in rubygems environment only as part of installed gem require 'rubygems' require 'premailer/executor' premailer-1.8.6/local-premailer 0000755 0001750 0001750 00000000301 12703352566 017775 0 ustar balasankarc balasankarc #!/usr/bin/env ruby # This binary used only in development environment require 'rubygems' $LOAD_PATH.unshift(File.expand_path('./lib', File.dirname(__FILE__))) require 'premailer/executor' premailer-1.8.6/Gemfile 0000644 0001750 0001750 00000000673 12703352566 016306 0 ustar balasankarc balasankarc source "https://rubygems.org" gem 'css_parser', :git => 'git://github.com/premailer/css_parser.git' gem 'webmock', :group => [:development, :test] platforms :jruby do gem 'jruby-openssl' end gemspec gem "ripper", :group => :development, :platforms => :mri_18 gem "coveralls", :require => false, :platforms => [:mri_19, :mri_20], :group => :development gem 'test-unit', :group => [:development, :test], :platforms => [:mri_20, :mri_22] premailer-1.8.6/gemfiles/ 0000755 0001750 0001750 00000000000 12703352566 016600 5 ustar balasankarc balasankarc premailer-1.8.6/gemfiles/.ruby187.gemfile 0000644 0001750 0001750 00000001146 12703352566 021433 0 ustar balasankarc balasankarc source "https://rubygems.org" gem 'css_parser', '>= 1.3.5', :git => 'git://github.com/premailer/css_parser.git' gem 'webmock', :group => [:development, :test] gemspec :path => '..' gem "ripper", :group => :development, :platforms => :mri_18 gem "coveralls", :require => false, :platforms => [:mri_19, :mri_20], :group => :development # Gemspec dependencies gem 'htmlentities', [ '>= 4.0.0', '<= 4.3.1' ] gem 'bundler', '~> 1.3' gem 'rake', ['~> 0.8', '!= 0.9.0'] gem 'hpricot', '>= 0.8.3' gem 'nokogiri', '~> 1.5.10' gem 'yard', '~> 0.8.7' gem 'redcarpet', '~> 2.3.0' gem 'yard-redcarpet-ext', '~> 0.0.3' premailer-1.8.6/premailer.gemspec 0000644 0001750 0001750 00000002412 12703352566 020331 0 ustar balasankarc balasankarc GEM_ROOT = File.dirname(__FILE__).freeze unless defined?(GEM_ROOT) lib_path = File.expand_path('lib', GEM_ROOT) $LOAD_PATH.unshift(lib_path) unless $LOAD_PATH.include? lib_path require 'premailer/version' Gem::Specification.new do |s| s.name = "premailer" s.version = Premailer::VERSION.dup s.date = Time.now.strftime('%Y-%m-%d') s.summary = "Preflight for HTML e-mail." s.email = "code@dunae.ca" s.homepage = "http://premailer.dialect.ca/" s.description = "Improve the rendering of HTML emails by making CSS inline, converting links and warning about unsupported code." s.has_rdoc = true s.author = "Alex Dunae" s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } s.add_dependency('css_parser', '>= 1.3.6') s.add_dependency('htmlentities', ['>= 4.0.0']) s.add_development_dependency "bundler", "~> 1.3" s.add_development_dependency('rake', ['~> 0.8', '!= 0.9.0']) s.add_development_dependency('hpricot', '>= 0.8.3') s.add_development_dependency('nokogiri', '>= 1.4.4') s.add_development_dependency('yard', '~> 0.8.7.6') s.add_development_dependency('redcarpet', '~> 3.0') end premailer-1.8.6/LICENSE.md 0000644 0001750 0001750 00000002741 12703352566 016415 0 ustar balasankarc balasankarc # Premailer License Copyright (c) 2007-2012, Alex Dunae. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Premailer, Alex Dunae nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. premailer-1.8.6/test/ 0000755 0001750 0001750 00000000000 12703352566 015764 5 ustar balasankarc balasankarc premailer-1.8.6/test/test_adapter.rb 0000644 0001750 0001750 00000001512 12703352566 020767 0 ustar balasankarc balasankarc require File.expand_path(File.dirname(__FILE__)) + '/helper' class TestAdapter < Premailer::TestCase def test_default_to_best_available require 'hpricot' assert_equal 'Premailer::Adapter::Hpricot', Premailer::Adapter.use.name end def test_settable_via_symbol Premailer::Adapter.use = :hpricot assert_equal 'Premailer::Adapter::Hpricot', Premailer::Adapter.use.name end def test_adapters_are_findable_by_symbol assert_equal 'Premailer::Adapter::Hpricot', Premailer::Adapter.find(:hpricot).name end def test_adapters_are_findable_by_class assert_equal 'Premailer::Adapter::Hpricot', Premailer::Adapter.find(Premailer::Adapter::Hpricot).name end def test_raises_argument_error assert_raises(ArgumentError, "Invalid adapter: unknown") { Premailer::Adapter.find(:unknown) } end end premailer-1.8.6/test/helper.rb 0000644 0001750 0001750 00000002325 12703352566 017572 0 ustar balasankarc balasankarc # encoding: utf-8 $:.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib')) $:.unshift(File.expand_path(File.dirname(__FILE__) + '/../')) require 'rubygems' require 'test/unit' require 'webmock/test_unit' require 'premailer' class Premailer::TestCase < Test::Unit::TestCase BASE_URI = 'http://premailer.dev/' BASE_PATH = File.expand_path(File.dirname(__FILE__)) + '/files' def setup stub_request(:any, /premailer\.dev\/*/).to_return do |request| file_path = BASE_PATH + URI.parse(request.uri).path if File.exists?(file_path) { :status => 200, :body => File.open(file_path) } else { :status => 404, :body => "#{file_path} not found" } end end stub_request(:get, /my\.example\.com\:8080\/*/).to_return(:status => 200, :body => "", :headers => {}) end def default_test; end protected def local_setup(f = 'base.html', opts = {}) base_file = BASE_PATH + '/' + f premailer = Premailer.new(base_file, opts) premailer.to_inline_css @doc = premailer.processed_doc end def remote_setup(f = 'base.html', opts = {}) @premailer = Premailer.new(BASE_URI + "#{f}", opts) @premailer.to_inline_css @doc = @premailer.processed_doc end end premailer-1.8.6/test/test_links.rb 0000644 0001750 0001750 00000016627 12703352566 020504 0 ustar balasankarc balasankarc # encoding: UTF-8 require File.expand_path(File.dirname(__FILE__)) + '/helper' class TestLinks < Premailer::TestCase def test_empty_query_string assert_nothing_raised do premailer = Premailer.new('
Test
', :with_html_string => true, :link_query_string => ' ') premailer.to_inline_css end end def test_appending_link_query_string qs = 'utm_source=1234&tracking=good&doublescape' opts = {:base_url => 'http://example.com/', :link_query_string => qs, :with_html_string => true, :adapter => :hpricot} appendable = [ '/', opts[:base_url], 'https://example.com/tester', 'images/', "#{opts[:base_url]}test.html?cn=tf&c=20&ord=random", '?query=string' ] not_appendable = [ '%DONOTCONVERT%', '{DONOTCONVERT}', '[DONOTCONVERT]', 'Test
END_HTML premailer = Premailer.new(html, :with_html_string => true) premailer.to_inline_css assert_match /color\: red/i, premailer.processed_doc.at('p')['style'] end def test_commented_out_styles_in_the_body html = <Test