Module: WebifyRuby

Defined in:
lib/webify_ruby.rb,
lib/webify_ruby/css.rb,
lib/webify_ruby/html.rb,
lib/webify_ruby/tasks.rb,
lib/webify_ruby/errors.rb,
lib/webify_ruby/convert.rb,
lib/webify_ruby/railtie.rb,
lib/webify_ruby/version.rb

Overview

Public: Main module that you should be using to use this library. You will be mainly using Convert class that lives here. You can use module’s Css class too if customization is required.

Examples

WebifyRuby::Css.new('name', 'file.ttf', :svg, :woff)
# => #<WebifyRuby::Css:0x007ff9e31dcf60>

Defined Under Namespace

Classes: Convert, Css, Error, Html, Railtie

Constant Summary collapse

EXT =

Internal: File extensions that are allowed to be processed

%w(.ttf .otf)
TEMPLATE =

Internal: Template which is according to what a CSS Styles will be generated. This might change in future versions, so that you will be able to pass in your own template definitions.

"@font-face {\n  font-family: '<%= @name %>';\n  <% if has_eot %>src: url('<%= @url %>.eot'); <% end %>\n  <% if has_eot %>src: url('<%= @url %>.eot?#iefix') format('embedded-opentype')<%if has_ttf or has_woff or has_svg %>,<%end%><%else%>src:<% end %>\n      <% if has_svg %>     url('<%= @url %>.svg#<%= @name %>') format('svg')<%if has_ttf or has_woff %>,<%end%><% end %>\n      <% if has_woff %>     url('<%= @url %>.woff') format('woff')<%if has_ttf%>,<%end%><% end %>\n      <% if has_ttf %>     url('<%= @url %>.ttf') format('truetype')<% end %>;\n  font-weight: normal;\n  font-style: normal;\n}\n".gsub /^\s*/, ''
VERSION =

Public: WebifyRuby version

"0.1.0"

Class Method Summary collapse

Class Method Details

.html_docObject

Public: You can get a current HTML template that is used by the module.



12
13
14
15
# File 'lib/webify_ruby/html.rb', line 12

def self.html_doc
  return @html_doc if @html_doc
  @html_doc = WebifyRuby::html_doc_default
end

.html_doc=(str) ⇒ Object

Public: You can set a custom HTML template by using this method.



7
8
9
# File 'lib/webify_ruby/html.rb', line 7

def self.html_doc=(str)
  @html_doc = str
end

.load_tasksObject

Internal: Loads rake tasks

Returns nothing



5
6
7
# File 'lib/webify_ruby/tasks.rb', line 5

def self.load_tasks
  Dir[File.join(File.dirname(__FILE__),'../tasks/*.rake')].each { |f| load f; }
end

.loggerObject

Internal: Gets a Logger object to use for logging

Returns the Logger object



43
44
45
46
47
48
# File 'lib/webify_ruby.rb', line 43

def self.logger
  return @logger if @logger
  logger = Logger.new(STDOUT)
  logger.level = Logger::INFO
  @logger = logger
end

.logger=(log) ⇒ Object

Public: Set your own logger if wanted

log - The Logger object.

Examples

WebifyRuby::logger = Logger.new(STDOUT)
# => #<Logger:0x007fd740837ec0

Returns the set logger



36
37
38
# File 'lib/webify_ruby.rb', line 36

def self.logger=(log)
  @logger = log
end

.webify_binaryObject

Internal: Gets a String object pointing to the binary

Returns the String of executable



67
68
69
# File 'lib/webify_ruby.rb', line 67

def self.webify_binary
  @webify_binary || 'webify'
end

.webify_binary=(bin) ⇒ Object

Public: Set a correct webify binary path to use

bin - The String object with path to binary file. (default: ‘webify’)

Examples

WebifyRuby::webify_binary = '/usr/bin/webify'
# => "/usr/bin/webify"

Returns the given binary path



60
61
62
# File 'lib/webify_ruby.rb', line 60

def self.webify_binary=(bin)
  @webify_binary = bin
end