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*/, ''
- HTML_DOC_DEFAULT =
Internal: HTML template that is used in in generated .html file by default.
"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n <title><%=@font_name%> - WebifyRuby</title>\n <link rel=\"stylesheet\" type=\"text/css\" href=\"<%=@css_file%>\">\n <style>\n ::-moz-selection {\n background: #b3d4fc;\n text-shadow: none;\n }\n\n ::selection {\n background: #b3d4fc;\n text-shadow: none;\n }\n\n html {\n padding: 30px 10px;\n font-size: 20px;\n line-height: 1.4;\n color: #737373;\n -webkit-text-size-adjust: 100%;\n -ms-text-size-adjust: 100%;\n \n background-color: #fff; \n background-image: \n linear-gradient(90deg, transparent 79px, #737373 79px, #737373 81px, transparent 81px),\n linear-gradient(#eee .1em, transparent .1em);\n background-size: 100% 1.2em;\n \n font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n }\n\n a:link,a:visited,a:hover,a:active {\n color:inherit; \n text-decoration:none;\n }\n\n body {\n max-width: 750px;\n _width: 750px;\n padding: 30px 20px 50px;\n margin: 0 auto;\n }\n\n h1 {\n margin: 5px 10px;\n font-size: 40px;\n text-align: center;\n }\n\n h1 span {\n color: #bbb;\n }\n\n h3 {\n margin: 1.5em 0 0.5em;\n }\n\n p {\n margin: 0.5em 0;\n }\n\n ul {\n margin: 1em 0;\n list-style:none;\n font-family:<%=@font_name%>;\n border:1px solid #ccc;\n padding:15px;\n background: #fff;\n }\n\n ul li {\n display:inline-block;\n height:50px;\n width:50px;;\n text-align:center;\n line-height:50px;\n margin:10px;\n background: #fff;\n }\n\n .container {\n max-width: 700px;\n _width: 700px;\n margin: 0 auto;\n }\n\n input::-moz-focus-inner {\n padding: 0;\n border: 0;\n }\n </style>\n</head>\n<body>\n <a href=\"https://github.com/dachi-gh/webify_ruby\"><img style=\"position: absolute; top: 0; right: 0; border: 0;\" src=\"https://github-camo.global.ssl.fastly.net/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67\" alt=\"Fork me on GitHub\" data-canonical-src=\"https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png\"></a>\n \n <div class=\"container\">\n <h1><a href=\"https://github.com/dachi-gh/webify_ruby\">WebifyRuby <span>Gem</span></a></h1>\n <p>\n <strong><%=Time.now%></strong>\n </p>\n <p>\n <strong><%=@font_name%></strong>\n </p>\n <p>The result looks like this:</p>\n <ul>\n <%(\"a\"..\"z\").each do |l|%>\n <li><%=l.upcase%> <%=l%></li>\n <%end%>\n </ul>\n <p>\n <small>Github page: <a href=\"https://github.com/dachi-gh/webify_ruby\">https://github.com/dachi-gh/webify_ruby</a></small>\n </p>\n </div>\n</body>\n</html>\n".gsub /^\s*/, ''
- VERSION =
Public: WebifyRuby version
"0.1.3"
Class Method Summary collapse
-
.html_doc ⇒ Object
Public: You can get a current HTML template that is used by the module.
-
.html_doc=(str) ⇒ Object
Public: You can set a custom HTML template by using this method.
-
.load_tasks ⇒ Object
Internal: Loads rake tasks.
-
.logger ⇒ Object
Internal: Gets a Logger object to use for logging.
-
.logger=(log) ⇒ Object
Public: Set your own logger if wanted.
-
.webify_binary ⇒ Object
Internal: Gets a String object pointing to the binary.
-
.webify_binary=(bin) ⇒ Object
Public: Set a correct webify binary path to use.
Class Method Details
.html_doc ⇒ Object
Public: You can get a current HTML template that is used by the module.
134 135 136 137 |
# File 'lib/webify_ruby/html.rb', line 134 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.
129 130 131 |
# File 'lib/webify_ruby/html.rb', line 129 def self.html_doc=(str) @html_doc = str end |
.load_tasks ⇒ Object
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 |
.logger ⇒ Object
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_binary ⇒ Object
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 |