colorant 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  pkg/*
2
2
  *.gem
3
3
  .bundle
4
+ coverage
data/Gemfile.lock CHANGED
@@ -1,89 +1,55 @@
1
- GIT
2
- remote: git://github.com/aslakhellesoy/aruba.git
3
- revision: 1cca0f2433b418e7e3a4a3d5671c2531bf5a7101
4
- specs:
5
- aruba (0.2.4)
6
- background_process
7
- cucumber (~> 0.9.3)
8
-
9
- GIT
10
- remote: git://github.com/aslakhellesoy/cucumber.git
11
- revision: 19a87c14098afb7ed418b234b22a9e5b91eda5f4
12
- specs:
13
- cucumber (0.9.4)
14
- builder (~> 2.1.2)
15
- diff-lcs (~> 1.1.2)
16
- gherkin (~> 2.2.9)
17
- json (~> 1.4.6)
18
- term-ansicolor (~> 1.0.5)
19
-
20
- GIT
21
- remote: git://github.com/retro/color-namer.git
22
- revision: e5ba1bd142ecc4c22ece12784decd5e9ce1ba43e
23
- specs:
24
- color_namer (0.1.0)
25
- color (>= 1.4.1)
26
-
27
- GIT
28
- remote: git://github.com/rspec/rspec-core.git
29
- revision: 62402739a3e2f0e29ca025e60c600c1100f21424
30
- specs:
31
- rspec-core (2.2.pre)
32
-
33
- GIT
34
- remote: git://github.com/rspec/rspec-expectations.git
35
- revision: 8729e9adbb2e1b50b8db2877afefd2e61ba18ad5
36
- specs:
37
- rspec-expectations (2.2.pre)
38
- diff-lcs (~> 1.1.2)
39
-
40
- GIT
41
- remote: git://github.com/rspec/rspec-mocks.git
42
- revision: ed672c6a2b943eac5b537d1f2c5beef71bb3aee9
43
- specs:
44
- rspec-mocks (2.2.pre)
45
-
46
- GIT
47
- remote: git://github.com/rspec/rspec.git
48
- revision: 79447df6d32ec9e9eb3194bd1897293d824ca298
49
- specs:
50
- rspec (2.2.pre)
51
- rspec-core (~> 2.2)
52
- rspec-expectations (~> 2.2)
53
- rspec-mocks (~> 2.2)
54
-
55
1
  PATH
56
2
  remote: .
57
3
  specs:
58
4
  colorant (0.1.2)
5
+ color_namer
6
+ trollop
59
7
 
60
8
  GEM
61
9
  remote: http://rubygems.org/
62
10
  specs:
11
+ aruba (0.2.4)
12
+ background_process
13
+ cucumber (~> 0.9.3)
63
14
  background_process (1.2)
64
15
  builder (2.1.2)
65
16
  color (1.4.1)
17
+ color_namer (0.1.0)
18
+ color (>= 1.4.1)
19
+ cucumber (0.9.4)
20
+ builder (~> 2.1.2)
21
+ diff-lcs (~> 1.1.2)
22
+ gherkin (~> 2.2.9)
23
+ json (~> 1.4.6)
24
+ term-ansicolor (~> 1.0.5)
66
25
  diff-lcs (1.1.2)
67
26
  gherkin (2.2.9)
68
27
  json (~> 1.4.6)
69
28
  term-ansicolor (~> 1.0.5)
70
29
  json (1.4.6)
30
+ rspec (2.1.0)
31
+ rspec-core (~> 2.1.0)
32
+ rspec-expectations (~> 2.1.0)
33
+ rspec-mocks (~> 2.1.0)
34
+ rspec-core (2.1.0)
35
+ rspec-expectations (2.1.0)
36
+ diff-lcs (~> 1.1.2)
37
+ rspec-mocks (2.1.0)
38
+ simplecov (0.3.7)
39
+ simplecov-html (>= 0.3.7)
40
+ simplecov-html (0.3.9)
71
41
  term-ansicolor (1.0.5)
72
42
  trollop (1.16.2)
73
- watchr (0.7)
74
43
 
75
44
  PLATFORMS
76
45
  ruby
77
46
 
78
47
  DEPENDENCIES
79
- aruba!
80
- bundler
81
- color_namer!
48
+ aruba
49
+ bundler (>= 1.0.3)
50
+ color_namer
82
51
  colorant!
83
- cucumber!
84
- rspec!
85
- rspec-core!
86
- rspec-expectations!
87
- rspec-mocks!
52
+ cucumber
53
+ rspec
54
+ simplecov
88
55
  trollop
89
- watchr
data/Rakefile CHANGED
@@ -1,6 +1,11 @@
1
1
  require 'bundler'
2
2
  Bundler::GemHelper.install_tasks
3
3
 
4
+ require 'simplecov'
5
+ SimpleCov.start do
6
+ add_group "Lib", 'lib'
7
+ end
8
+
4
9
  require 'rspec/core'
5
10
  require 'rspec/core/rake_task'
6
11
  RSpec::Core::RakeTask.new(:spec) do |spec|
data/Readme.md CHANGED
@@ -13,12 +13,12 @@ Just put it in your Gemfile:
13
13
  And wherever you want, you only need a filename, and you get an array of color
14
14
  percentual frequencies of your image.
15
15
 
16
- colorant.process "path/to/my/leaves.jpg"
16
+ Colorant.process "path/to/my/leaves.jpg"
17
17
  # => [["Brown", 78.95], ["Green", 3.85], ...]
18
18
 
19
19
  These are other options you can specify:
20
20
 
21
- colorant.process "file", :colors => 5, # Default is 8
21
+ Colorant.process "file", :colors => 5, # Default is 8
22
22
  :depth => 24, # Default is 16
23
23
  :extended => true # Use more accurate color names
24
24
 
data/bin/colorant CHANGED
@@ -5,7 +5,7 @@ require 'trollop'
5
5
  require 'colorant'
6
6
 
7
7
  opts = Trollop::options do
8
- version "colorant 0.1.0 (c) 2010 Codegram"
8
+ version "colorant 0.1.3 (c) 2010 Codegram"
9
9
  banner <<-EOS
10
10
  Colorant is a simple utility to extract the colors present in an image.
11
11
 
data/colorant.gemspec CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.add_development_dependency 'rspec'
22
22
  s.add_development_dependency 'cucumber'
23
23
  s.add_development_dependency 'aruba'
24
+ s.add_development_dependency 'simplecov'
24
25
 
25
26
  s.files = `git ls-files`.split("\n")
26
27
  s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
data/features/cli.feature CHANGED
@@ -1,6 +1,6 @@
1
1
  Feature: Command line interpreter
2
2
 
3
- You can use Colorist from the command line as well.
3
+ You can use Colorant from the command line as well.
4
4
 
5
5
  Scenario: get the most relevant colors out of the Arnolfini Portrait
6
6
  When I run "colorant arnolfini.jpg --colors 8 --depth 24"
@@ -1,3 +1,8 @@
1
+ require 'simplecov'
2
+ SimpleCov.start do
3
+ add_group "Lib", "lib"
4
+ end
5
+
1
6
  require 'aruba'
2
7
  require 'fileutils'
3
8
 
@@ -29,33 +29,5 @@ module Colorant
29
29
  end
30
30
  end
31
31
 
32
- private
33
-
34
- def parse(raw_data)
35
- collection = []
36
- raw_data.split("\n").map(&:strip).each do |line|
37
- line.match /^(\d+):.*rgb\((.*)%,(.*)%,(.*)%\)$/
38
- freq = $1.to_i
39
- red, green, blue = [$2,$3,$4].map do |color|
40
- color.to_f / 100.to_f
41
- end
42
- collection << { :freq => freq,
43
- :red => percent_to_number(red),
44
- :green => percent_to_number(green),
45
- :blue => percent_to_number(blue) }
46
- end
47
- total = collection.map{|element| element[:freq]}.inject(:+)
48
- collection.each{|element| element[:freq] = number_to_percent(element[:freq], total)}
49
- collection
50
- end
51
-
52
- def percent_to_number(percent)
53
- ("%.2f" % (255 * percent)).to_f
54
- end
55
-
56
- def number_to_percent(number, total)
57
- ("%.2f" % ((number * 100.to_f) / total)).to_f
58
- end
59
-
60
32
  end
61
33
  end
@@ -1,3 +1,3 @@
1
1
  module Colorant
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -60,16 +60,16 @@ module Colorant
60
60
 
61
61
  it 'outputs a simple ordered array with the image color composition' do
62
62
  subject.report(arnolfini_data, :reporter => :stdout)
63
- @out.string.should include "\tBrown\t\t-- 70.65 %\n"
64
- @out.string.should include "\tBrown\t\t-- 29.35 %\n"
63
+ @out.string.should include "\tBrown\t\t\t\t\t\t-- 70.65 %\n"
64
+ @out.string.should include "\tBrown\t\t\t\t\t\t-- 29.35 %\n"
65
65
  end
66
66
 
67
67
  context "when called with :extended => true" do
68
68
 
69
69
  it 'outputs more accurate info about the color' do
70
70
  subject.report(arnolfini_data, :extended => true, :reporter => :stdout)
71
- @out.string.should include "\tBistre Brown\t\t-- 70.65 %\n"
72
- @out.string.should include "\tAu Chico Brown\t\t-- 29.35 %\n"
71
+ @out.string.should include "\tBistre Brown\t\t\t\t\t\t-- 70.65 %\n"
72
+ @out.string.should include "\tAu Chico Brown\t\t\t\t\t\t-- 29.35 %\n"
73
73
  end
74
74
 
75
75
  it 'removes duplication to keep the color name nice' do
@@ -77,8 +77,8 @@ module Colorant
77
77
  ["FFFF00", "Yellow", "Yellow"])
78
78
 
79
79
  subject.report(arnolfini_data, :extended => true, :reporter => :stdout)
80
- @out.string.should include "\tBrown Derby\t\t-- 70.65 %\n"
81
- @out.string.should include "\tYellow\t\t-- 29.35 %\n"
80
+ @out.string.should include "\tBrown Derby\t\t\t\t\t\t-- 70.65 %\n"
81
+ @out.string.should include "\tYellow\t\t\t\t\t\t-- 29.35 %\n"
82
82
  end
83
83
  end
84
84
 
data/spec/spec_helper.rb CHANGED
@@ -1,8 +1,10 @@
1
1
  require 'bundler'
2
- # require 'simplecov'
3
- # SimpleCov.start do
4
- # add_group "Lib", "lib"
5
- # end
2
+ require 'simplecov'
3
+ SimpleCov.start do
4
+ add_group "Lib", "lib"
5
+ end
6
+
7
+
6
8
  begin
7
9
  Bundler.setup(:default, :development)
8
10
  rescue Bundler::BundlerError => e
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Josep M. Bach
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-10 00:00:00 +01:00
19
+ date: 2010-11-11 00:00:00 +01:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -99,6 +99,19 @@ dependencies:
99
99
  version: "0"
100
100
  type: :development
101
101
  version_requirements: *id006
102
+ - !ruby/object:Gem::Dependency
103
+ name: simplecov
104
+ prerelease: false
105
+ requirement: &id007 !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ segments:
111
+ - 0
112
+ version: "0"
113
+ type: :development
114
+ version_requirements: *id007
102
115
  description: Easily extract the colors of any image file!
103
116
  email:
104
117
  - info@codegram.com