Class: PremailerApp
- Inherits:
-
Object
- Object
- PremailerApp
- Defined in:
- bin/premailer_plus
Constant Summary collapse
- BANNER =
<<-END Premailer Plus ----------------- Usage: FILE [options] inputfile outputfile "inputfile" can be either a local file or a URL Options: END
Instance Method Summary collapse
-
#initialize(args) ⇒ PremailerApp
constructor
A new instance of PremailerApp.
- #run ⇒ Object
Constructor Details
#initialize(args) ⇒ PremailerApp
Returns a new instance of PremailerApp.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'bin/premailer_plus', line 25 def initialize(args) @args = args @config = OpenStruct.new({ :plaintext => false, :shorten_urls => false, :base_url => '', :infile => nil, :outfile => '', :querystring => '', :warnings => false, :verbose => true }) end |
Instance Method Details
#run ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'bin/premailer_plus', line 39 def run if and get_arguments @pm_opts = {} @pm_opts.merge!({:base_url => @config.base_url}) unless @config.base_url.empty? @pm_opts.merge!({:link_query_string => @config.querystring}) unless @config.querystring.empty? @pm_opts.merge!({:shorten_urls => true}) if @config.shorten_urls @premailer = Premailer.new(@config.infile.to_s, @pm_opts) write_premail_html write_plain_text if @config.plaintext show_warnings if @config.warnings else puts "Invalid options/arguments!" exit 1 end end |