juicer 1.0.13 → 1.0.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/GPATH +0 -0
  2. data/GRTAGS +0 -0
  3. data/GSYMS +0 -0
  4. data/GTAGS +0 -0
  5. data/Gemfile +4 -0
  6. data/Gemfile.lock +33 -0
  7. data/History.txt +3 -0
  8. data/Rakefile +96 -0
  9. data/VERSION +1 -1
  10. data/lib/juicer.rb +1 -1
  11. data/lib/juicer/asset/path.rb +10 -10
  12. data/lib/juicer/asset/path_resolver.rb +2 -2
  13. data/lib/juicer/binary.rb +1 -1
  14. data/lib/juicer/cache_buster.rb +1 -1
  15. data/lib/juicer/command/merge.rb +10 -8
  16. data/lib/juicer/datafy/datafy.rb +2 -2
  17. data/lib/juicer/dependency_resolver/css_dependency_resolver.rb +29 -29
  18. data/lib/juicer/dependency_resolver/javascript_dependency_resolver.rb +23 -23
  19. data/lib/juicer/image_embed.rb +24 -18
  20. data/lib/juicer/install/closure_compiler_installer.rb +1 -1
  21. data/lib/juicer/install/rhino_installer.rb +1 -1
  22. data/lib/juicer/install/yui_compressor_installer.rb +1 -1
  23. data/lib/juicer/merger/javascript_merger.rb +29 -29
  24. data/lib/juicer/merger/stylesheet_merger.rb +111 -111
  25. data/lib/juicer/minifyer/java_base.rb +8 -1
  26. data/test/bin/jslint-1.0.js +523 -0
  27. data/test/bin/jslint.js +523 -0
  28. data/test/bin/rhino1_7R1.zip +0 -0
  29. data/test/bin/rhino1_7R2-RC1.jar +0 -0
  30. data/test/bin/rhino1_7R2-RC1.zip +0 -0
  31. data/test/bin/rhino1_7R3.jar +0 -0
  32. data/test/bin/rhino1_7R3.zip +0 -0
  33. data/test/bin/yuicompressor +0 -0
  34. data/test/bin/yuicompressor-2.3.5.zip +0 -0
  35. data/test/bin/yuicompressor-2.4.2.jar +0 -0
  36. data/test/bin/yuicompressor-2.4.2.zip +0 -0
  37. data/test/data/Changelog.txt +10 -0
  38. data/test/data/a.css +3 -0
  39. data/test/data/a.js +5 -0
  40. data/test/data/a1.css +5 -0
  41. data/test/data/b.css +1 -0
  42. data/test/data/b.js +5 -0
  43. data/test/data/b1.css +5 -0
  44. data/test/data/b2.css +5 -0
  45. data/test/data/c1.css +3 -0
  46. data/test/data/css/2.gif +1 -0
  47. data/test/data/css/test.css +15 -0
  48. data/test/data/css/test2.css +1 -0
  49. data/test/data/css/test3.css +12 -0
  50. data/test/data/d1.css +3 -0
  51. data/test/data/images/1.png +1 -0
  52. data/test/data/my_app.js +2 -0
  53. data/test/data/not-ok.js +2 -0
  54. data/test/data/ok.js +3 -0
  55. data/test/data/path_test.css +5 -0
  56. data/test/data/path_test2.css +14 -0
  57. data/test/data/pkg/module/moda.js +2 -0
  58. data/test/data/pkg/module/modb.js +3 -0
  59. data/test/data/pkg/pkg.js +1 -0
  60. data/test/fixtures/rhino-download.html +42 -0
  61. data/test/fixtures/yui-download.html +375 -0
  62. data/test/test_helper.rb +10 -7
  63. data/test/unit/juicer/cache_buster_test.rb +1 -1
  64. data/test/unit/juicer/command/install_test.rb +2 -2
  65. data/test/unit/juicer/command/merge_test.rb +3 -3
  66. data/test/unit/juicer/command/verify_test.rb +2 -2
  67. data/test/unit/juicer/css_cache_buster_test.rb +2 -2
  68. data/test/unit/juicer/datafy_test.rb +1 -1
  69. data/test/unit/juicer/image_embed_test.rb +39 -6
  70. data/test/unit/juicer/jslint_test.rb +3 -3
  71. data/test/unit/juicer/merger/stylesheet_merger_test.rb +1 -1
  72. data/test/unit/juicer/minifyer/closure_compressor_test.rb +4 -4
  73. data/test/unit/juicer/minifyer/yui_compressor_test.rb +21 -4
  74. data/test/unit/juicer_test.rb +1 -1
  75. metadata +180 -154
data/GPATH ADDED
Binary file
data/GRTAGS ADDED
Binary file
data/GSYMS ADDED
Binary file
data/GTAGS ADDED
Binary file
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify gem dependencies in juicer.gemspec
4
+ gemspec
@@ -0,0 +1,33 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ juicer (1.0.9)
5
+ cmdparse
6
+ nokogiri
7
+ rubyzip
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ cmdparse (2.0.3)
13
+ fakefs (0.3.2)
14
+ git (1.2.5)
15
+ jeweler (1.6.0)
16
+ bundler (~> 1.0.0)
17
+ git (>= 1.2.5)
18
+ rake
19
+ mocha (0.9.12)
20
+ nokogiri (1.4.4.1-x86-mingw32)
21
+ rake (0.9.0)
22
+ rubyzip (0.9.4)
23
+ shoulda (2.11.3)
24
+
25
+ PLATFORMS
26
+ x86-mingw32
27
+
28
+ DEPENDENCIES
29
+ fakefs (>= 0.2.1)
30
+ jeweler (>= 0.2.1)
31
+ juicer!
32
+ mocha (>= 0.9.8)
33
+ shoulda (>= 2.10.2)
@@ -1,3 +1,6 @@
1
+ == 1.0.14 / 2012-04-13
2
+ * Minor fix for closure compiler installation
3
+
1
4
  == 1.0.13 / 2011-08-30
2
5
  * Update YUI Compressor installer (new download page)
3
6
 
@@ -0,0 +1,96 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+ require 'rake/rdoctask'
5
+
6
+ begin
7
+ require 'jeweler'
8
+ Jeweler::Tasks.new do |gem|
9
+ gem.name = "juicer"
10
+ gem.summary = "Command line tool for CSS and JavaScript developers"
11
+ gem.description = "Resolve dependencies, merge and minify CSS and JavaScript files with Juicer - the command line tool for frontend engineers"
12
+ gem.email = "christian@cjohansen.no"
13
+ gem.homepage = "http://github.com/cjohansen/juicer"
14
+ gem.authors = ["Christian Johansen"]
15
+ gem.rubyforge_project = "juicer"
16
+ gem.add_development_dependency "shoulda", ">= 2.10.2"
17
+ gem.add_development_dependency "mocha", ">= 0.9.8"
18
+ gem.add_development_dependency "fakefs", ">= 0.2.1"
19
+ gem.add_development_dependency "jeweler", ">= 0.2.1"
20
+ gem.add_development_dependency "redgreen", ">= 1.2.2" if RUBY_VERSION < "1.9"
21
+ gem.add_dependency "cmdparse"
22
+ gem.add_dependency "nokogiri", ">= 1.5.0"
23
+ gem.add_dependency "rubyzip"
24
+ gem.executables = ["juicer"]
25
+ gem.post_install_message = <<-MSG
26
+ Juicer does not ship with third party libraries. You probably want to install
27
+ Yui Compressor and JsLint now:
28
+
29
+ juicer install yui_compressor
30
+ juicer install jslint
31
+
32
+ Happy juicing!
33
+ MSG
34
+ gem.files = FileList["[A-Z]*", "{bin,generators,lib,test}/**/*"]
35
+ end
36
+
37
+ Jeweler::GemcutterTasks.new
38
+ Jeweler::RubyforgeTasks.new do |rubyforge|
39
+ rubyforge.doc_task = "rdoc"
40
+ end
41
+ rescue LoadError => err
42
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
43
+ puts err.message
44
+ end
45
+
46
+ Rake::TestTask.new("test:units") do |test|
47
+ test.libs << 'test'
48
+ test.pattern = 'test/unit/**/*_test.rb'
49
+ test.verbose = true
50
+ end
51
+
52
+ Rake::TestTask.new("test:integration") do |test|
53
+ test.libs << 'test'
54
+ test.pattern = 'test/integration/**/*_test.rb'
55
+ test.verbose = true
56
+ end
57
+
58
+ task :test => ["check_dependencies:development", "test:units", "test:integration"]
59
+
60
+ task :default => "test:units"
61
+
62
+ # lib/tasks/cruise.rake
63
+ desc 'Continuous build target'
64
+ task :cruise do
65
+ out = ENV['CC_BUILD_ARTIFACTS']
66
+ mkdir_p out unless File.directory? out if out
67
+
68
+ Rake::Task["rcov"].invoke
69
+ mv 'coverage/', "#{out}/" if out
70
+ end
71
+
72
+ begin
73
+ require 'rcov/rcovtask'
74
+ Rcov::RcovTask.new do |test|
75
+ test.libs << 'test'
76
+ test.pattern = 'test/**/*_test.rb'
77
+ test.verbose = true
78
+ end
79
+ rescue LoadError
80
+ task :rcov do
81
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
82
+ end
83
+ end
84
+
85
+ Rake::RDocTask.new do |rdoc|
86
+ if File.exist?('VERSION')
87
+ version = File.read('VERSION')
88
+ else
89
+ version = ""
90
+ end
91
+
92
+ rdoc.rdoc_dir = 'rdoc'
93
+ rdoc.title = "jstdutil #{version}"
94
+ rdoc.rdoc_files.include('README*')
95
+ rdoc.rdoc_files.include('lib/**/*.rb')
96
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.13
1
+ 1.0.14
@@ -3,7 +3,7 @@ require "logger"
3
3
  module Juicer
4
4
 
5
5
  # :stopdoc:
6
- VERSION = '1.0.13'
6
+ VERSION = '1.0.14'
7
7
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
8
8
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
9
9
  LOGGER = Logger.new(STDOUT)
@@ -16,35 +16,35 @@ module Juicer
16
16
  #
17
17
  # Dir.pwd
18
18
  # #=> "/home/christian/projects/mysite/design/css"
19
- #
19
+ #
20
20
  # asset = Juicer::Asset::Path.new "../images/logo.png"
21
21
  # asset.path
22
22
  # #=> "../images/logo.png"
23
- #
23
+ #
24
24
  # asset.rebase("~/projects/mysite/design").path
25
25
  # #=> "images/logo.png"
26
- #
26
+ #
27
27
  # asset.filename
28
28
  # #=> "/home/christian/projects/mysite/design/images/logo.png"
29
- #
29
+ #
30
30
  # asset.path(:cache_buster_type => :soft)
31
31
  # #=> "../images/logo.png?jcb=1234567890"
32
- #
32
+ #
33
33
  # asset.path(:cache_buster_type => :soft, :cache_buster => nil)
34
34
  # #=> "../images/logo.png?1234567890"
35
- #
35
+ #
36
36
  # asset.path(:cache_buster => "bustIT")
37
37
  # #=> "../images/logo.png?bustIT=1234567890"
38
- #
38
+ #
39
39
  # asset = Juicer::Asset::Path.new "../images/logo.png", :document_root
40
40
  # #=> "/home/christian/projects/mysite"
41
- #
41
+ #
42
42
  # asset.absolute_path(:cache_buster_type => :hard)
43
43
  # #=> "/images/logo-jcb1234567890.png"
44
- #
44
+ #
45
45
  # asset.absolute_path(:host => "http://localhost")
46
46
  # #=> "http://localhost/images/logo.png"
47
- #
47
+ #
48
48
  # asset.absolute_path(:host => "http://localhost", :cache_buster_type => :hard)
49
49
  # #=> "http://localhost/images/logo-jcb1234567890.png"
50
50
  #
@@ -16,10 +16,10 @@ module Juicer
16
16
  # asset = path_resolver.resolve("../images/logo.png")
17
17
  # asset.document_root
18
18
  # #=> "/var/www"
19
- #
19
+ #
20
20
  # asset.absolute_path(path_resolver.cycle_hosts)
21
21
  # #=> "http://assets1.mysite.com/images/logo.png"
22
- #
22
+ #
23
23
  # asset = path_resolver.resolve("/favicon.ico")
24
24
  # asset.absolute_path(path_resolver.cycle_hosts)
25
25
  # #=> "http://assets2.mysite.com/favicon.ico"
@@ -129,7 +129,7 @@ module Juicer
129
129
  #
130
130
  def locate(bin_glob, env = nil)
131
131
  path << ENV[env] if env && ENV.key?(env) && File.exist?(ENV[env])
132
-
132
+
133
133
  (path << Dir.pwd).each do |path|
134
134
  files = Dir.glob(File.expand_path(File.join(path, bin_glob)))
135
135
  return files unless files.empty?
@@ -127,7 +127,7 @@ module Juicer
127
127
  def self.rails(file)
128
128
  self.path(file, :rails)
129
129
  end
130
-
130
+
131
131
  #
132
132
  # Remove cache buster from a URL for a given parameter name. Parameter name is
133
133
  # "cb" by default.
@@ -30,7 +30,8 @@ module Juicer
30
30
  @absolute_urls = false # Make the merger use absolute URLs
31
31
  @local_hosts = [] # Host names that are served from :document_root
32
32
  @verify = true # Verify js files with JsLint
33
- @image_embed_type = :none # Embed images in css files, options are :none, :data_uri
33
+ @image_embed_type = :none # Embed images in css files, options are :none, :data_uri
34
+ @force_image_embed = false
34
35
 
35
36
  @log = log || Logger.new(STDOUT)
36
37
 
@@ -75,7 +76,7 @@ the compressor the path should be the path to where the jar file is found.
75
76
  (" " * 37) + "Works with cycled asset hosts. Only valid for CSS files") { |t| @absolute_urls = true }
76
77
  opt.on("-d", "--document-root dir", "Path to resolve absolute URLs relative to") { |path| @document_root = path }
77
78
  opt.on("-c", "--cache-buster type", "none, soft, rails, or hard. Default is soft, which adds timestamps to\n" +
78
- (" " * 37) + "reference URLs as query parameters. None leaves URLs untouched, rails adds\n" +
79
+ (" " * 37) + "reference URLs as query parameters. None leaves URLs untouched, rails adds\n" +
79
80
  (" " * 37) + "timestamps in the same format as Rails' image_tag helper, and hard alters\n" +
80
81
  (" " * 37) + "file names") do |type|
81
82
  @cache_buster = [:soft, :hard, :rails].include?(type.to_sym) ? type.to_sym : nil
@@ -84,6 +85,7 @@ the compressor the path should be the path to where the jar file is found.
84
85
  (" " * 37) + "None leaves URLs untouched. Candiate images must be flagged with '?embed=true to be considered") do |embed|
85
86
  @image_embed_type = [:none, :data_uri].include?(embed.to_sym) ? embed.to_sym : nil
86
87
  end
88
+ opt.on("", "--force-image-embed", "Will force all images to embed without having to tag with embed parameter") { @force_image_embed = true }
87
89
  end
88
90
  end
89
91
 
@@ -188,13 +190,13 @@ the compressor the path should be the path to where the jar file is found.
188
190
  Juicer::CssCacheBuster.new(:document_root => @document_root, :type => @cache_buster, :hosts => @local_hosts)
189
191
  end
190
192
 
191
- #
192
- # Load image embed, only available for CSS files
193
- #
194
- def image_embed(file)
193
+ #
194
+ # Load image embed, only available for CSS files
195
+ #
196
+ def image_embed(file)
195
197
  return nil if !file || file !~ /\.css$/ || @image_embed_type.nil?
196
- Juicer::ImageEmbed.new(:document_root => @document_root, :type => @image_embed_type )
197
- end
198
+ Juicer::ImageEmbed.new(:document_root => @document_root, :type => @image_embed_type, :force => @force_image_embed )
199
+ end
198
200
 
199
201
  #
200
202
  # Generate output file name. Optional argument is a filename to base the new
@@ -16,5 +16,5 @@ module Datafy
16
16
  end
17
17
  outuri += ",#{content}"
18
18
  end
19
-
20
- end
19
+
20
+ end
@@ -1,29 +1,29 @@
1
- require "juicer/dependency_resolver/dependency_resolver"
2
-
3
- module Juicer
4
-
5
- # Resolves @import statements in CSS files and builds a list of all
6
- # files, in order.
7
- #
8
- class CssDependencyResolver < DependencyResolver
9
- # Regexp borrowed from similar project:
10
- # http://github.com/cgriego/front-end-blender/tree/master/lib/front_end_architect/blender.rb
11
- @@import_pattern = /^\s*@import(?:\surl\(|\s)(['"]?)([^\?'"\)\s]+)(\?(?:[^'"\)]*))?\1\)?(?:[^?;]*);?/im
12
-
13
- private
14
- def parse(line, imported_file = nil)
15
- return $2 if line =~ @@import_pattern
16
-
17
- # At first sight of actual CSS rules we abort (TODO: This does not take
18
- # into account the fact that rules may be commented out and that more
19
- # imports may follow)
20
- throw :done if imported_file && line =~ %r{/*}
21
- throw :done if line =~ /^[\.\#a-zA-Z\:]/
22
- end
23
-
24
- def extension
25
- ".css"
26
- end
27
- end
28
-
29
- end
1
+ require "juicer/dependency_resolver/dependency_resolver"
2
+
3
+ module Juicer
4
+
5
+ # Resolves @import statements in CSS files and builds a list of all
6
+ # files, in order.
7
+ #
8
+ class CssDependencyResolver < DependencyResolver
9
+ # Regexp borrowed from similar project:
10
+ # http://github.com/cgriego/front-end-blender/tree/master/lib/front_end_architect/blender.rb
11
+ @@import_pattern = /^\s*@import(?:\surl\(|\s)(['"]?)([^\?'"\)\s]+)(\?(?:[^'"\)]*))?\1\)?(?:[^?;]*);?/im
12
+
13
+ private
14
+ def parse(line, imported_file = nil)
15
+ return $2 if line =~ @@import_pattern
16
+
17
+ # At first sight of actual CSS rules we abort (TODO: This does not take
18
+ # into account the fact that rules may be commented out and that more
19
+ # imports may follow)
20
+ throw :done if imported_file && line =~ %r{/*}
21
+ throw :done if line =~ /^[\.\#a-zA-Z\:]/
22
+ end
23
+
24
+ def extension
25
+ ".css"
26
+ end
27
+ end
28
+
29
+ end
@@ -1,23 +1,23 @@
1
- require "juicer/dependency_resolver/dependency_resolver"
2
-
3
- module Juicer
4
- # Resolves @depends and @depend statements in comments in JavaScript files.
5
- # Only the first comment in a JavaScript file is parsed
6
- #
7
- class JavaScriptDependencyResolver < DependencyResolver
8
- @@depends_pattern = /\@depends?\s+([^\s\'\"\;]+)/
9
-
10
- private
11
- def parse(line, imported_file = nil)
12
- return $1 if line =~ @@depends_pattern
13
-
14
- # If we have already skimmed through some @depend/@depends or a
15
- # closing comment we're done.
16
- throw :done unless imported_file.nil? || !(line =~ /\*\//)
17
- end
18
-
19
- def extension
20
- ".js"
21
- end
22
- end
23
- end
1
+ require "juicer/dependency_resolver/dependency_resolver"
2
+
3
+ module Juicer
4
+ # Resolves @depends and @depend statements in comments in JavaScript files.
5
+ # Only the first comment in a JavaScript file is parsed
6
+ #
7
+ class JavaScriptDependencyResolver < DependencyResolver
8
+ @@depends_pattern = /\@depends?\s+([^\s\'\"\;]+)/
9
+
10
+ private
11
+ def parse(line, imported_file = nil)
12
+ return $1 if line =~ @@depends_pattern
13
+
14
+ # If we have already skimmed through some @depend/@depends or a
15
+ # closing comment we're done.
16
+ throw :done unless imported_file.nil? || !(line =~ /\*\//)
17
+ end
18
+
19
+ def extension
20
+ ".js"
21
+ end
22
+ end
23
+ end
@@ -6,18 +6,18 @@ module Juicer
6
6
  #
7
7
  # The ImageEmbed is a tool that can parse a CSS file and substitute all
8
8
  # referenced URLs by a data uri
9
- #
9
+ #
10
10
  # - data uri (http://en.wikipedia.org/wiki/Data_URI_scheme)
11
- #
11
+ #
12
12
  # Only local resources will be processed this way, external resources referenced
13
13
  # by absolute urls will be left alone
14
- #
14
+ #
15
15
  class ImageEmbed
16
16
  include Juicer::Chainable
17
17
 
18
18
  # The maximum supported limit for modern browsers, See the Readme.rdoc for details
19
19
  SIZE_LIMIT = 32768
20
-
20
+
21
21
  #
22
22
  # Returns the size limit
23
23
  #
@@ -33,6 +33,7 @@ module Juicer
33
33
  @hosts = options[:hosts]
34
34
  @path_resolver = Juicer::Asset::PathResolver.new(:document_root => options[:document_root],
35
35
  :hosts => options[:hosts])
36
+ @force = options[:force]
36
37
  end
37
38
 
38
39
  #
@@ -55,22 +56,22 @@ module Juicer
55
56
  duplicates = duplicate_urls(assets)
56
57
 
57
58
  if duplicates.length > 0
58
- Juicer::LOGGER.warn("Duplicate image urls detected, these images will not be embedded: #{duplicates.collect { |v| v.gsub('?embed=true', '') }.inspect}")
59
+ Juicer::LOGGER.warn("Duplicate image urls detected, these images will not be embedded: #{duplicates.collect { |v| v.gsub('?embed=true', '') }.inspect}")
59
60
  end
60
61
 
61
62
  assets.each do |asset|
62
63
  begin
63
64
  next if used.include?(asset) || duplicates.include?(asset.path)
64
65
  used << asset
65
-
66
+
66
67
  # make sure we do not exceed SIZE_LIMIT
67
68
  new_path = embed_data_uri(asset.filename)
68
69
 
69
70
  if new_path.length < SIZE_LIMIT
70
71
  # replace the url in the css file with the data uri
71
- @contents.gsub!(asset.path, embed_data_uri(asset.filename)) if asset.filename.match( /\?embed=true$/ )
72
+ @contents.gsub!(asset.path, embed_data_uri(asset.filename)) if @force || asset.filename.match( /\?embed=true$/ )
72
73
  else
73
- Juicer::LOGGER.warn("The final data uri for the image located at #{asset.path.gsub('?embed=true', '')} exceeds #{SIZE_LIMIT} and will not be embedded to maintain compatability.")
74
+ Juicer::LOGGER.warn("The final data uri for the image located at #{asset.path.gsub('?embed=true', '')} exceeds #{SIZE_LIMIT} and will not be embedded to maintain compatability.")
74
75
  end
75
76
  rescue Errno::ENOENT
76
77
  puts "Unable to locate file #{asset.path}, skipping image embedding"
@@ -82,23 +83,28 @@ module Juicer
82
83
  end
83
84
 
84
85
  chain_method :save
85
-
86
+
86
87
  def embed_data_uri( path )
87
88
  new_path = path
88
-
89
- supported_file_matches = path.match( /(?:\.)(png|gif|jpg|jpeg)(?:\?embed=true)$/i )
89
+
90
+ if @force
91
+ supported_file_matches = path.match( /(?:\.)(png|gif|jpg|jpeg)$/i )
92
+ else
93
+ supported_file_matches = path.match( /(?:\.)(png|gif|jpg|jpeg)(?:\?embed=true)$/i )
94
+ end
95
+
90
96
  filetype = supported_file_matches[1] if supported_file_matches
91
-
92
- if ( filetype )
93
- filename = path.gsub('?embed=true','')
94
-
97
+
98
+ if ( filetype )
99
+ filename = path.gsub('?embed=true','')
100
+
95
101
  # check if file exists, throw an error if it doesn't exist
96
102
  if File.exist?( filename )
97
-
98
- # read contents of file into memory
103
+
104
+ # read contents of file into memory
99
105
  content = File.read( filename )
100
106
  content_type = "image/#{filetype}"
101
-
107
+
102
108
  # encode the url
103
109
  new_path = Datafy::make_data_uri( content, content_type )
104
110
  else