miro 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 269d3bca169bf72e9496cf0b019b2f39d844f05b
4
- data.tar.gz: 7ca804e24f8f4433fb01064c98477b3c56ac8804
3
+ metadata.gz: c5adccda17b31cfe4ffc944c691e22de53ab0f54
4
+ data.tar.gz: ecb1cadaa5fb53b9bd9a5ffa32a72c277cbd447d
5
5
  SHA512:
6
- metadata.gz: c2391941d1a5fe148ca76c0807fa78db23ac7b86ff00df2a95b5d420217c06aecc354242dc8b1ae49162cb9cdf3f185b5b50a84d3c46ee44d8c8ee976b077801
7
- data.tar.gz: 4f9ac4fb9fccf3ad157411175860a62c1dc935ea5b6b8df1e754204d6b58fa730802d4500c4a7c90733b4dce90935eaa91fea27d74fead5817ac0b7d5a5a3c84
6
+ metadata.gz: dd7c0d005af2038c499d7c01da06d6f7ff5ecd2391732f2211141f0a8c29d5d4fea7932799fe2f432f806231b6f5d141b3c2cd07dca63c172b7a60e207e8b615
7
+ data.tar.gz: 7a2795bc17f4d35a5a2fac3f78a881b7fb8ad329bf62bc17c3faa9b4c8bf28e2288adaaed391a998a42878dee0e33ae89b823b73507c81694b9d92d26cb03e41
@@ -1,9 +1,18 @@
1
1
  # Miro Changelog
2
2
 
3
+ ## 0.4.0
4
+
5
+ * Enhancements
6
+ * Jruby Support [#24][]
7
+ * Add support for file paths with spaces in the name [#28][]
8
+ * Updated README
9
+
3
10
  ## 0.3.0
4
11
 
5
12
  * Enhancements
6
13
  * new `:histogram` option for improved performance [#19][]
7
14
  * Updated README
8
15
 
9
- [#19]: https://github.com/jonbuda/miro/pull/19
16
+ [#19]: https://github.com/jonbuda/miro/pull/19
17
+ [#24]: https://github.com/jonbuda/miro/pull/24
18
+ [#28]: https://github.com/jonbuda/miro/pull/28
data/README.md CHANGED
@@ -60,7 +60,7 @@ colors.to_rgb # => [[81, 51, 42], [44, 29, 24], [108, 73, 55], [101, 81, 74], [1
60
60
  # RGB with Alpha channels
61
61
  colors.to_rgba # => [[82, 37, 40, 255], [48, 17, 19, 255], [109, 70, 71, 255], [221, 158, 48, 255], [168, 103, 48, 255], [226, 178, 79, 255], [191, 146, 65, 255], [199, 165, 150, 255]]
62
62
  ```
63
- **Aditional methods only aviable when histogram method is enabled**
63
+ **Additional methods only available when histogram method is enabled**
64
64
 
65
65
  ```ruby
66
66
  # HSL
@@ -1,9 +1,9 @@
1
1
  require "miro/version"
2
- require "oily_png"
3
2
  require "cocaine"
4
3
  require "color"
5
4
  require "tempfile"
6
5
  require "open-uri"
6
+ require png_lib = (RUBY_ENGINE != "jruby" ? "oily_png" : "chunky_png") # Load the C extension oily_png unless jruby is the platform in use.
7
7
 
8
8
  require "miro/dominant_colors"
9
9
 
@@ -1,3 +1,5 @@
1
+ require 'shellwords'
2
+
1
3
  module Miro
2
4
  class DominantColors
3
5
  attr_accessor :src_image_path
@@ -46,14 +48,14 @@ module Miro
46
48
  end
47
49
 
48
50
  def histogram
49
- @histogram || downsample_and_histogram.sort_by { |item| item[0] }.reverse
51
+ @histogram ||= downsample_and_histogram.sort_by { |item| item[0] }.reverse
50
52
  end
51
53
  private
52
54
 
53
55
  def downsample_and_histogram
54
56
  @source_image = open_source_image
55
57
  hstring = Cocaine::CommandLine.new(Miro.options[:image_magick_path], image_magick_params).
56
- run(:in => File.expand_path(@source_image.path),
58
+ run(:in => Shellwords.escape(File.expand_path(@source_image.path)),
57
59
  :resolution => Miro.options[:resolution],
58
60
  :colors => Miro.options[:color_count].to_s,
59
61
  :quantize => Miro.options[:quantize])
@@ -63,7 +65,7 @@ module Miro
63
65
 
64
66
  def parse_result(hstring)
65
67
  hstring.scan(/(\d*):.*(#[0-9A-Fa-f]*)/).collect do |match|
66
- [match[0].to_i, Object.const_get("Color::#{Miro.options[:quantize].upcase}").from_html(match[1])]
68
+ [match[0].to_i, eval("Color::#{Miro.options[:quantize].upcase}").from_html(match[1])]
67
69
  end
68
70
  end
69
71
 
@@ -1,3 +1,3 @@
1
1
  module Miro
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -11,8 +11,9 @@ Gem::Specification.new do |gem|
11
11
  gem.requirements = 'ImageMagick'
12
12
 
13
13
  gem.add_dependency "cocaine"
14
- gem.add_dependency "oily_png"
15
14
  gem.add_dependency "color"
15
+ gem.add_dependency "chunky_png"
16
+ gem.add_dependency "oily_png" if RUBY_ENGINE != "jruby"
16
17
 
17
18
  gem.add_development_dependency "rspec"
18
19
  gem.add_development_dependency "fakeweb"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Buda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-15 00:00:00.000000000 Z
11
+ date: 2016-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocaine
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: oily_png
28
+ name: color
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,7 +39,21 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: color
42
+ name: chunky_png
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: oily_png
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - ">="
@@ -123,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
137
  requirements:
124
138
  - ImageMagick
125
139
  rubyforge_project:
126
- rubygems_version: 2.2.2
140
+ rubygems_version: 2.4.5.1
127
141
  signing_key:
128
142
  specification_version: 4
129
143
  summary: Extract the dominant colors from an image.