wasko 0.2.1 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 924d61c3075d832882f4c08739c045b22c7e7703
4
+ data.tar.gz: 160ed9c759529743fa1305cf1084d0f5a1daecae
5
+ SHA512:
6
+ metadata.gz: 1866d1d6eae3df475422d734152f2214ed8410c91e4aecf82efbb7ef4b42dcd5890c8d0ea3e6ed8ad4c3b841d56ef4b9dd25c90ba2709b14d8e71cfa3ab269de
7
+ data.tar.gz: 168c0498c57f392d0fc195981295deea2574248e3cb3f5ef1580d104798af2279be3da50c4243d7053c35c7c2cc0baf4b1e398fa8b05cc9abb700967813204e6
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ ## 0.2.3
2
+
3
+ The I-messed-up-with-bundler-and-now-need-to-push-another-version edition.
4
+
5
+ ## 0.2.2
6
+
7
+ Instead of keeping track of your previous color, setting a palette with a color now just sets the color.
8
+
9
+ ## 0.2.1
10
+
11
+ One of the earlier version of Wasko
data/Gemfile CHANGED
@@ -6,17 +6,12 @@ group :development do
6
6
  # An IRB alternative and runtime developer console
7
7
  # [pry](http://pry.github.com)
8
8
  gem 'pry', '~> 0.9.10'
9
+ # Rake is a Make-like program implemented in Ruby. Tasks and dependenci...
10
+ # [rake](https://github.com/jimweirich/rake)
11
+ gem 'rake', '~> 10.3.2'
9
12
  end
10
13
 
11
14
  group :test do
12
- # Adding rake for Travis.
13
- gem 'rake'
14
-
15
- # Making tests easy on the fingers and eyes
16
- # [shoulda](https://github.com/thoughtbot/shoulda)
17
- gem 'shoulda', '~> 3.1.1'
18
-
19
- # Mocking and stubbing library
20
- # [mocha](http://gofreerange.com/mocha/docs)
21
- gem 'mocha', '~> 0.12.4'
15
+ gem 'minitest', '~> 5.3.2'
16
+ gem 'mocha', '~> 1.0.0'
22
17
  end
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- wasko (0.2.1)
4
+ wasko (0.2.3)
5
5
  color
6
+ rake
6
7
  thor
7
- thor (~> 0.15.4)
8
8
 
9
9
  GEM
10
10
  remote: http://rubygems.org/
@@ -13,18 +13,19 @@ GEM
13
13
  i18n (~> 0.6)
14
14
  multi_json (~> 1.0)
15
15
  coderay (1.0.7)
16
- color (1.4.1)
16
+ color (1.7)
17
17
  i18n (0.6.1)
18
- metaclass (0.0.1)
18
+ metaclass (0.0.4)
19
19
  method_source (0.8)
20
- mocha (0.12.4)
20
+ minitest (5.3.4)
21
+ mocha (1.0.0)
21
22
  metaclass (~> 0.0.1)
22
23
  multi_json (1.3.6)
23
24
  pry (0.9.10)
24
25
  coderay (~> 1.0.5)
25
26
  method_source (~> 0.8)
26
27
  slop (~> 3.3.1)
27
- rake (0.8.7)
28
+ rake (10.3.2)
28
29
  shoulda (3.1.1)
29
30
  shoulda-context (~> 1.0)
30
31
  shoulda-matchers (~> 1.2)
@@ -38,8 +39,9 @@ PLATFORMS
38
39
  ruby
39
40
 
40
41
  DEPENDENCIES
41
- mocha (~> 0.12.4)
42
+ minitest (~> 5.3.2)
43
+ mocha (~> 1.0.0)
42
44
  pry (~> 0.9.10)
43
- rake
44
- shoulda (~> 3.1.1)
45
+ rake (~> 10.3.2)
46
+ shoulda
45
47
  wasko!
data/README.mdown CHANGED
@@ -6,7 +6,7 @@ _The quickest way to set your Terminal palette._
6
6
 
7
7
  I have a weird habit of having open too many Terminal windows that all look the same, so I needed a way to quickly make them different. Enter: Wasko.
8
8
 
9
- With wasko you can quickly change the background color of an open Terminal window, it does this by taking your desired color and mixing it with your default background color. So it doesn't look completely like someone vomited and then made a color scheme out of it (although if it does, try a different color).
9
+ With wasko you can quickly change the background color of an open Terminal window, it does this by taking your desired color and trying to get other colors that kinda match it. So it shouldn't look like someone vomited and then made a color scheme out of it (although if it does, try a different color).
10
10
 
11
11
  ## How does it work?
12
12
 
@@ -14,7 +14,7 @@ If you just enter `wasko` it'll show you all available options (thanks to [thor]
14
14
 
15
15
  The one I use most is:
16
16
 
17
- * `wasko -b red` which will update the background color. You can enter any valid css color, the world is your coloured oyster.
17
+ * `wasko -p red` which will update the background color, and font colors. You can enter any valid css color, the world is your coloured oyster.
18
18
 
19
19
  You can also change the font etc, see the help for more:
20
20
 
@@ -33,6 +33,4 @@ You can also change the font etc, see the help for more:
33
33
 
34
34
  #@ Copyright
35
35
 
36
-
37
- Copyright (c) 2011 pjaspers. See LICENSE.txt for
38
- further details.
36
+ Copyright (c) 201[0-9] pjaspers. See LICENSE.txt for further details.
data/Rakefile CHANGED
@@ -1,18 +1,17 @@
1
1
  #!/usr/bin/env rake
2
2
  require "bundler/gem_tasks"
3
- require 'rake/testtask'
4
3
 
5
- desc 'Run Devise unit tests.'
6
- Rake::TestTask.new(:test) do |t|
7
- t.libs << 'lib'
8
- t.libs << 'test'
9
- t.pattern = 'test/**/test_*.rb'
10
- t.verbose = true
4
+ task :test do
5
+ $LOAD_PATH.unshift('lib', 'test')
6
+ Dir.glob('./test/**/test_*.rb') { |f| require f }
11
7
  end
12
8
 
13
9
  task :default => :test
14
10
 
15
11
  desc "Open an pry session with Gasoline loaded"
16
12
  task :console do
17
- sh "pry -I lib -r wasko.rb"
13
+ require 'pry'
14
+ require './lib/wasko'
15
+ ARGV.clear
16
+ Pry.start Wasko
18
17
  end
data/bin/wasko CHANGED
@@ -15,6 +15,7 @@ module Wasko
15
15
  map "-t" => :text
16
16
  map "-f" => :font
17
17
  map "-s" => :strong
18
+ map "-p" => :palette
18
19
 
19
20
  desc "text COLOR", "-t, Gets/sets text color"
20
21
  def text(color_name="")
@@ -47,6 +48,19 @@ module Wasko
47
48
  end
48
49
  end
49
50
 
51
+ desc "palette COLOR", "-p, Gets/sets background color"
52
+ def palette(color_name="")
53
+ if color_name.empty?
54
+ say Wasko.palette
55
+ else
56
+ if Wasko::Color.color_from_string(color_name)
57
+ Wasko.set_palette color_name
58
+ else
59
+ error "#{color_name} is not a color."
60
+ end
61
+ end
62
+ end
63
+
50
64
  desc "cursor COLOR", "-c, Gets/sets cursor color"
51
65
  def cursor(color_name="")
52
66
  if color_name.empty?
data/lib/wasko.rb CHANGED
@@ -1,5 +1,10 @@
1
+ # coding: utf-8
2
+
1
3
  require "color/palette/monocontrast"
2
4
  require "yaml"
5
+
6
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
7
+
3
8
  # [Applescript: Small wrapper for running applescript](applescript.html)
4
9
  require "wasko/applescript"
5
10
  # [Terminal: Support for Terminal.app](terminal.html)
@@ -10,6 +15,7 @@ require "wasko/iterm"
10
15
  require "wasko/color"
11
16
  # [Palette: Generates a color scheme](palette.html)
12
17
  require "wasko/palette"
18
+ require "wasko/palettes/original"
13
19
  # [Configuration: Loading and saving themes](configuration.html)
14
20
  require "wasko/configuration"
15
21
 
@@ -23,7 +29,7 @@ module Wasko
23
29
  return Wasko::Terminal if current_application =~ /Terminal.app/
24
30
  return Wasko::Iterm if current_application =~ /iTerm.app/
25
31
  # Fall back to Terminal for CI
26
- return Wasko::Terminal
32
+ Wasko::Terminal
27
33
  end
28
34
 
29
35
  # Gets the current active application
@@ -49,10 +55,8 @@ module Wasko
49
55
  #
50
56
  # Sets the background color
51
57
  def set_background_color(color)
52
- original_background = ::Color::RGB.from_applescript(advanced_typing_apparatus.startup_background_color).html
53
- palette = Wasko::Palette::TheOriginal.new(original_background)
54
- new_color = palette.base_color_with_tint(color)
55
- advanced_typing_apparatus.set_background_color(new_color.to_applescript)
58
+ color = Wasko::Color.color_from_string(color)
59
+ advanced_typing_apparatus.set_background_color(color.to_applescript)
56
60
  end
57
61
 
58
62
  def foreground_color
@@ -162,7 +166,7 @@ module Wasko
162
166
 
163
167
  # Try to set a sensible palette from a base color
164
168
  def set_palette(color_string)
165
- p = Wasko::Palette::TheOriginal.new(color_string)
169
+ p = Wasko::Palette::Original.new(color_string)
166
170
 
167
171
  set_background_color p.colors[:base].html
168
172
  set_foreground_color p.colors[:foreground].html
data/lib/wasko/iterm.rb CHANGED
@@ -2,6 +2,22 @@ module Wasko
2
2
  # Adds support for [iTerm2](http://code.google.com/p/iterm2/)
3
3
  class Iterm
4
4
 
5
+ def self.normal_text_color
6
+ foreground_color
7
+ end
8
+
9
+ def self.font_name
10
+ 'Not supported'
11
+ end
12
+
13
+ def self.font_size
14
+ 'Not supported'
15
+ end
16
+
17
+ def self.bold_text_color
18
+ bold_color
19
+ end
20
+
5
21
  # Terminal.app uses a slightly different terminology
6
22
  def self.set_normal_text_color(color)
7
23
  set_foreground_color color
data/lib/wasko/palette.rb CHANGED
@@ -2,10 +2,7 @@ module Wasko
2
2
  # A module aimed at creating color schemes for terminals
3
3
  # Pretty straightforward, no?
4
4
  module Palette
5
- # Since I change my mind pretty frequently on
6
- # color schemes etc. Putting the actual logic in
7
- # a class so it's easier to extend.
8
- class TheOriginal
5
+ class Base
9
6
  # Takes a valid css color string and an optional
10
7
  # contrast argument. The contrast is useful to tweak
11
8
  # the output of things.
@@ -35,70 +32,6 @@ module Wasko
35
32
  p.colors[:yellow]
36
33
  end
37
34
 
38
- # Checks the brightness of the base color and
39
- # returns the appropriate opposite color.
40
- #
41
- # For example black will return white, white will
42
- # return black.
43
- def opposite_color
44
- @base.brightness > 0.5 ? black : white
45
- end
46
-
47
- # To calculate colors that will fit our base color
48
- # we need to find out to brighten them, or darken
49
- # them
50
- def inverse_brightness
51
- @base.brightness > 0.5 ? -1 : 1
52
- end
53
-
54
- def dark_base_color?
55
- @base.brightness < 0.5
56
- end
57
-
58
- # Hash of the color palette
59
- # TODO: attr_accessible
60
- def colors
61
- @colors
62
- end
63
-
64
- # Creates a palette based on the `@base`-color. This
65
- # generates a color palette which has taken a good
66
- # look at [Solarized](http://ethanschoonover.com/solarized)
67
- # The plus side is you can use any base color, the
68
- # downside is, the colors won't be picked as well as
69
- # when using [Solarized](http://ethanschoonover.com/solarized) so if that's what you need, check it out.
70
- def colors!
71
- p = {}
72
- p[:base] = @base
73
- p[:foreground] = @base.mix_with(opposite_color, @contrast + 18)
74
- p[:bold] = @base.mix_with(opposite_color, @contrast + 19.5)
75
- p[:selection] = @base.adjust_brightness inverse_brightness * @contrast
76
- p[:selected] = p[:bold]
77
- p[:cursor] = p[:foreground]
78
-
79
- # ANSI Colors
80
- p[:red] = mix_base_with("red", 50, inverse_brightness * @contrast)
81
- p[:green] = mix_base_with("green", 50, inverse_brightness * @contrast)
82
- p[:yellow] = mix_base_with("yellow", 50, inverse_brightness * @contrast)
83
- p[:white] = mix_base_with("white", 35, inverse_brightness * @contrast)
84
- p[:black] = mix_base_with("black", 35, inverse_brightness * @contrast)
85
- p[:blue] = mix_base_with("blue", 50, inverse_brightness * (@contrast))
86
- p[:magenta] = mix_base_with("#CA1F7B", 35, inverse_brightness * @contrast)
87
- p[:cyan] = mix_base_with("#00FFFF", 50, inverse_brightness * (@contrast - 20))
88
- @colors = p
89
- end
90
-
91
- # Just a utility method that mixes colors, for more
92
- # info on this check the docs of the `color`-gem.
93
- def mix_base_with(color_name, mix_value = 50, brightness = 30)
94
- @base.mix_with(Wasko::Color.color_from_string(color_name), mix_value).adjust_brightness(brightness)
95
- end
96
-
97
-
98
- def base_color_with_tint(color_name)
99
- brightness = inverse_brightness * @contrast
100
- mix_base_with(color_name, 80, brightness)
101
- end
102
35
  end
103
36
  end
104
37
  end
@@ -0,0 +1,90 @@
1
+ module Wasko
2
+ # A module aimed at creating color schemes for terminals
3
+ # Pretty straightforward, no?
4
+ module Palette
5
+ # Since I change my mind pretty frequently on
6
+ # color schemes etc. Putting the actual logic in
7
+ # a class so it's easier to extend.
8
+ class Original < Base
9
+
10
+ # Returns a `color`-instance of white
11
+ def white
12
+ Wasko::Color.color_from_string("white")
13
+ end
14
+
15
+ # Returns a `color`-instance of black
16
+ def black
17
+ Wasko::Color.color_from_string("black")
18
+ end
19
+
20
+ def ansi_colors?
21
+ p.colors[:yellow]
22
+ end
23
+
24
+ # Checks the brightness of the base color and
25
+ # returns the appropriate opposite color.
26
+ #
27
+ # For example black will return white, white will
28
+ # return black.
29
+ def opposite_color
30
+ @base.brightness > 0.5 ? black : white
31
+ end
32
+
33
+ # To calculate colors that will fit our base color
34
+ # we need to find out to brighten them, or darken
35
+ # them
36
+ def inverse_brightness
37
+ @base.brightness > 0.5 ? -1 : 1
38
+ end
39
+
40
+ def dark_base_color?
41
+ @base.brightness < 0.5
42
+ end
43
+
44
+ # Hash of the color palette
45
+ # TODO: attr_accessible
46
+ def colors
47
+ @colors
48
+ end
49
+
50
+ # Creates a palette based on the `@base`-color. This
51
+ # generates a color palette which has taken a good
52
+ # look at [Solarized](http://ethanschoonover.com/solarized)
53
+ # The plus side is you can use any base color, the
54
+ # downside is, the colors won't be picked as well as
55
+ # when using [Solarized](http://ethanschoonover.com/solarized) so if that's what you need, check it out.
56
+ def colors!
57
+ p = {}
58
+ p[:base] = @base
59
+ p[:foreground] = @base.mix_with(opposite_color, @contrast + 0)
60
+ p[:bold] = @base.mix_with(opposite_color, @contrast + 5)
61
+ p[:selection] = @base.adjust_brightness inverse_brightness * @contrast
62
+ p[:selected] = p[:bold]
63
+ p[:cursor] = p[:foreground]
64
+
65
+ # ANSI Colors
66
+ p[:red] = mix_base_with("red", 50, inverse_brightness * @contrast)
67
+ p[:green] = mix_base_with("green", 50, inverse_brightness * @contrast)
68
+ p[:yellow] = mix_base_with("yellow", 50, inverse_brightness * @contrast)
69
+ p[:white] = mix_base_with("white", 35, inverse_brightness * @contrast)
70
+ p[:black] = mix_base_with("black", 35, inverse_brightness * @contrast)
71
+ p[:blue] = mix_base_with("blue", 50, inverse_brightness * (@contrast))
72
+ p[:magenta] = mix_base_with("#CA1F7B", 35, inverse_brightness * @contrast)
73
+ p[:cyan] = mix_base_with("#00FFFF", 50, inverse_brightness * (@contrast - 20))
74
+ @colors = p
75
+ end
76
+
77
+ # Just a utility method that mixes colors, for more
78
+ # info on this check the docs of the `color`-gem.
79
+ def mix_base_with(color_name, mix_value = 50, brightness = 30)
80
+ @base.mix_with(Wasko::Color.color_from_string(color_name), mix_value).adjust_brightness(brightness)
81
+ end
82
+
83
+
84
+ def base_color_with_tint(color_name)
85
+ brightness = inverse_brightness * @contrast
86
+ mix_base_with(color_name, 80, brightness)
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,40 @@
1
+ module Wasko
2
+ module Palette
3
+ class Plain < Base
4
+
5
+ # Hash of the color palette
6
+ # TODO: attr_accessible
7
+ def colors
8
+ @colors
9
+ end
10
+
11
+ # Creates a palette based on the `@base`-color. This
12
+ # generates a color palette which has taken a good
13
+ # look at [Solarized](http://ethanschoonover.com/solarized)
14
+ # The plus side is you can use any base color, the
15
+ # downside is, the colors won't be picked as well as
16
+ # when using [Solarized](http://ethanschoonover.com/solarized) so if that's what you need, check it out.
17
+ def colors!
18
+ p = {}
19
+ p[:base] = @base
20
+ p[:foreground] = @base.mix_with(opposite_color, @contrast + 18)
21
+ p[:bold] = @base.mix_with(opposite_color, @contrast + 19.5)
22
+ p[:selection] = @base.adjust_brightness inverse_brightness * @contrast
23
+ p[:selected] = p[:bold]
24
+ p[:cursor] = p[:foreground]
25
+
26
+ # ANSI Colors
27
+ p[:red] = mix_base_with("red", 50, inverse_brightness * @contrast)
28
+ p[:green] = mix_base_with("green", 50, inverse_brightness * @contrast)
29
+ p[:yellow] = mix_base_with("yellow", 50, inverse_brightness * @contrast)
30
+ p[:white] = mix_base_with("white", 35, inverse_brightness * @contrast)
31
+ p[:black] = mix_base_with("black", 35, inverse_brightness * @contrast)
32
+ p[:blue] = mix_base_with("blue", 50, inverse_brightness * (@contrast))
33
+ p[:magenta] = mix_base_with("#CA1F7B", 35, inverse_brightness * @contrast)
34
+ p[:cyan] = mix_base_with("#00FFFF", 50, inverse_brightness * (@contrast - 20))
35
+ @colors = p
36
+ end
37
+
38
+ end
39
+ end
40
+ end
data/lib/wasko/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Wasko
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.3"
3
3
  end
data/test/helper.rb CHANGED
@@ -1,19 +1,12 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'test/unit'
11
- require 'shoulda'
12
- require 'mocha'
1
+ # coding: utf-8
2
+
3
+ require 'minitest'
4
+ require 'minitest/autorun'
5
+ require 'minitest/pride'
6
+ require 'mocha/setup'
13
7
 
14
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
15
8
  $LOAD_PATH.unshift(File.dirname(__FILE__))
16
- require 'wasko'
9
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
17
10
 
18
- class Test::Unit::TestCase
19
- end
11
+ require 'wasko'
12
+ include Wasko
@@ -1,7 +1,7 @@
1
1
  require 'helper'
2
2
 
3
- class TestWaskoApplescript < Test::Unit::TestCase
4
- should "run an applescript and catch its return value" do
3
+ describe Wasko::Applescript do
4
+ it "run an applescript and catch its return value" do
5
5
  value = Wasko::Applescript.run {"set ten_and_ten to 10 + 10"}
6
6
  assert_equal 20.to_s, value
7
7
  end
data/test/test_color.rb CHANGED
@@ -1,32 +1,32 @@
1
1
  require 'helper'
2
2
 
3
- class TestWaskoColor < Test::Unit::TestCase
3
+ describe Wasko::Color do
4
4
 
5
- should "convert from applescript" do
5
+ it "convert from applescript" do
6
6
  assert_equal ::Color::RGB.from_html("#fff"), ::Color::RGB.from_applescript("{65535,65535,65535}")
7
7
  end
8
8
 
9
- should "convert to applescript" do
9
+ it "convert to applescript" do
10
10
  assert_equal "{65535, 65535, 65535}", ::Color::RGB.from_html("#fff").to_applescript
11
11
  end
12
12
 
13
- should "convert #fff to Color" do
13
+ it "convert #fff to Color" do
14
14
  assert_equal ::Color::RGB.from_html("#fff"), Wasko::Color.color_from_string("#fff")
15
15
  end
16
16
 
17
- should "convert #cccccc to Color" do
17
+ it "convert #cccccc to Color" do
18
18
  assert_equal ::Color::RGB.from_html("#cccccc"), Wasko::Color.color_from_string("#cccccc")
19
19
  end
20
20
 
21
- should "convert aliceblue to Color" do
21
+ it "convert aliceblue to Color" do
22
22
  assert_equal ::Color::RGB.from_html("#f0f8ff"), Wasko::Color.color_from_string("aliceblue")
23
23
  end
24
24
 
25
- should "handle upcased css names to Color" do
25
+ it "handle upcased css names to Color" do
26
26
  assert_equal ::Color::RGB.from_html("#ff0000"), Wasko::Color.color_from_string("RED")
27
27
  end
28
28
 
29
- should "gracefully handle bogus input names" do
29
+ it "gracefully handle bogus input names" do
30
30
  assert_nil Wasko::Color.color_from_string("poppycock")
31
31
  end
32
32
  end
data/test/test_palette.rb CHANGED
@@ -1,36 +1,40 @@
1
1
  require 'helper'
2
2
 
3
- class TestWaskoPalette < Test::Unit::TestCase
3
+ describe Wasko::Palette::Original do
4
+ it "is" do
5
+ assert true
6
+ end
7
+ end
8
+ describe Wasko::Palette do
4
9
 
5
10
  %w(white black blue green red 001e26 pink).each do |color_string|
6
- context "creating a palette for #{color_string}" do
11
+ describe "creating a palette for #{color_string}" do
7
12
 
8
- setup do
13
+ before do
9
14
  @base_color = Wasko::Color.color_from_string("white")
10
- @palette = Wasko::Palette::TheOriginal.new("white")
15
+ @palette = Wasko::Palette::Original.new("white")
11
16
  end
12
17
 
13
- should "have a foreground color with a high contrast" do
18
+ it "have a foreground color with a high contrast" do
14
19
  assert 0.5 < (@palette.colors[:foreground].brightness - @base_color.brightness).abs
15
20
  end
16
21
 
17
- should "set its base color as the background color" do
22
+ it "set its base color as the background color" do
18
23
  assert_equal @base_color, @palette.colors[:base]
19
24
  end
20
25
  end
21
26
  end
22
27
 
23
- should "generate all colors in its hash" do
24
- palette = Wasko::Palette::TheOriginal.new("white")
28
+ it "generate all colors in its hash" do
29
+ palette = Wasko::Palette::Original.new("white")
25
30
  colors = %w(base foreground bold selection selected cursor red green yellow white black blue magenta cyan)
26
31
 
27
32
  assert_equal [],palette.colors.keys - colors.map(&:to_sym)
28
33
  end
29
34
 
30
- should "generate a white colorscheme on faulty input" do
31
- palette = Wasko::Palette::TheOriginal.new("fokdajong")
35
+ it "generate a white colorscheme on faulty input" do
36
+ palette = Wasko::Palette::Original.new("fokdajong")
32
37
  palette.colors[:base] = palette.white
33
38
  end
34
39
 
35
40
  end
36
-
@@ -1,17 +1,17 @@
1
1
  require 'helper'
2
2
 
3
- class TestTerminal < Test::Unit::TestCase
4
- context "defining dynamic methods" do
5
- setup do
3
+ describe Wasko::Terminal do
4
+ describe "defining dynamic methods" do
5
+ before do
6
6
  @terminal = Wasko::Terminal
7
7
  end
8
8
 
9
9
  %w(background_color normal_text_color font_size font_name cursor_color).each do |method|
10
- should "support getter #{method}" do
10
+ it "support getter #{method}" do
11
11
  assert @terminal.respond_to? method.to_sym
12
12
  end
13
13
 
14
- should "support setter set_#{method}" do
14
+ it "support setter set_#{method}" do
15
15
  assert @terminal.respond_to? "set_#{method}".to_sym
16
16
  end
17
17
  end
data/test/test_wasko.rb CHANGED
@@ -1,25 +1,24 @@
1
1
  require 'helper'
2
2
 
3
- class TestWasko < Test::Unit::TestCase
3
+ describe Wasko do
4
4
 
5
- should "set background color to tint" do
5
+ it "set background color to tint" do
6
6
  ata = mock()
7
- ata.expects(:startup_background_color).returns("{0,0,0}")
8
- ata.expects(:set_background_color).with("{16962, 0, 0}").returns(nil)
7
+ ata.expects(:set_background_color).with("{65535, 0, 0}").returns(nil)
9
8
  Wasko.stubs(:advanced_typing_apparatus).returns(ata)
10
9
  Wasko.set_background_color("red")
11
10
  end
12
11
 
13
- context "setting palette" do
14
- setup do
12
+ describe "setting palette" do
13
+ before do
15
14
  @color = Wasko::Color.color_from_string("white")
16
15
  palette = mock()
17
16
  palette.expects(:colors).returns({:base => @color, :foreground => @color, :bold => @color, :cursor => @color, :selected => @color, :selection => @color}).at_least_once
18
- Wasko::Palette::TheOriginal.expects(:new).with("white").returns(palette)
17
+ Wasko::Palette::Original.expects(:new).with("white").returns(palette)
19
18
 
20
19
  end
21
20
 
22
- should "draw a palette" do
21
+ it "draw a palette" do
23
22
  Wasko.expects(:set_background_color).with(@color.html)
24
23
  Wasko.expects(:set_foreground_color).with(@color.html)
25
24
  Wasko.expects(:set_bold_color).with(@color.html)
@@ -29,39 +28,39 @@ class TestWasko < Test::Unit::TestCase
29
28
 
30
29
  end
31
30
 
32
- should "set palette" do
31
+ it "set palette" do
33
32
 
34
33
  end
35
34
 
36
- should "get font size" do
35
+ it "get font size" do
37
36
  ata = mock()
38
37
  ata.expects(:font_size).returns("14")
39
38
  Wasko.expects(:advanced_typing_apparatus).returns(ata)
40
39
  assert_equal Wasko.font_size, "14"
41
40
  end
42
41
 
43
- should "set font size" do
42
+ it "set font size" do
44
43
  ata = mock()
45
44
  ata.expects(:set_font_size).with("14")
46
45
  Wasko.expects(:advanced_typing_apparatus).returns(ata)
47
46
  Wasko.set_font_size "14"
48
47
  end
49
48
 
50
- should "get font name" do
49
+ it "get font name" do
51
50
  ata = mock()
52
51
  ata.expects(:font_name).returns("SomeFont")
53
52
  Wasko.expects(:advanced_typing_apparatus).returns(ata)
54
53
  assert_equal Wasko.font_name, "SomeFont"
55
54
  end
56
55
 
57
- should "set font name" do
56
+ it "set font name" do
58
57
  ata = mock()
59
58
  ata.expects(:set_font_name).with("SomeFont")
60
59
  Wasko.expects(:advanced_typing_apparatus).returns(ata)
61
60
  Wasko.set_font_name("SomeFont")
62
61
  end
63
62
 
64
- should "get font" do
63
+ it "get font" do
65
64
  ata = mock()
66
65
  ata.expects(:font_name).returns("SomeFont")
67
66
  ata.expects(:font_size).returns("14")
@@ -69,7 +68,7 @@ class TestWasko < Test::Unit::TestCase
69
68
  assert_equal Wasko.font, "SomeFont, 14"
70
69
  end
71
70
 
72
- should "set font" do
71
+ it "set font" do
73
72
  ata = mock()
74
73
  ata.expects(:set_font_name).with("SomeFont")
75
74
  ata.expects(:set_font_size).with(14)
@@ -90,21 +89,21 @@ class TestWasko < Test::Unit::TestCase
90
89
  end
91
90
 
92
91
  # Test all getter/setter colors
93
- context "getting/setting regular colors" do
92
+ describe "getting/setting regular colors" do
94
93
  %w(cursor_color foreground_color bold_color).each do |method|
95
94
 
96
- setup do
95
+ before do
97
96
  @color = Wasko::Color.color_from_string("white")
98
97
  end
99
98
 
100
- should "get the #{method} of the advanced typing apparatus" do
99
+ it "get the #{method} of the advanced typing apparatus" do
101
100
  ata = mock()
102
101
  ata.expects(method_to_expect(method).to_sym).returns(@color.to_applescript)
103
102
  Wasko.expects(:advanced_typing_apparatus).returns(ata)
104
103
  assert_equal @color.html, Wasko.send(method)
105
104
  end
106
105
 
107
- should "set the #{method} of the advanced typing apparatus" do
106
+ it "set the #{method} of the advanced typing apparatus" do
108
107
 
109
108
  ata = mock()
110
109
  ata.expects("set_#{method_to_expect(method)}".to_sym).with(@color.to_applescript)
data/wasko.gemspec CHANGED
@@ -15,10 +15,9 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Wasko::VERSION
17
17
 
18
- gem.add_runtime_dependency("thor", ["~> 0.15.4"])
19
18
  gem.add_runtime_dependency 'color'
20
19
  gem.add_runtime_dependency 'thor'
21
-
20
+ gem.add_runtime_dependency 'rake'
22
21
  gem.add_development_dependency 'shoulda'
23
22
  gem.add_development_dependency 'mocha'
24
23
  end
metadata CHANGED
@@ -1,94 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wasko
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
5
- prerelease:
4
+ version: 0.2.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - pjaspers
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-10-04 00:00:00.000000000 Z
11
+ date: 2015-02-01 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: thor
14
+ name: color
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
- version: 0.15.4
19
+ version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: 0.15.4
26
+ version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
- name: color
28
+ name: thor
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
- name: thor
42
+ name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: shoulda
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: mocha
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  description: Wasko colors your day/terminal
@@ -99,8 +88,9 @@ executables:
99
88
  extensions: []
100
89
  extra_rdoc_files: []
101
90
  files:
102
- - .document
103
- - .gitignore
91
+ - ".document"
92
+ - ".gitignore"
93
+ - CHANGELOG.md
104
94
  - Gemfile
105
95
  - Gemfile.lock
106
96
  - LICENSE.txt
@@ -121,6 +111,8 @@ files:
121
111
  - lib/wasko/configuration.rb
122
112
  - lib/wasko/iterm.rb
123
113
  - lib/wasko/palette.rb
114
+ - lib/wasko/palettes/original.rb
115
+ - lib/wasko/palettes/plain.rb
124
116
  - lib/wasko/terminal.rb
125
117
  - lib/wasko/version.rb
126
118
  - sample_generator.rb
@@ -133,33 +125,26 @@ files:
133
125
  - wasko.gemspec
134
126
  homepage: ''
135
127
  licenses: []
128
+ metadata: {}
136
129
  post_install_message:
137
130
  rdoc_options: []
138
131
  require_paths:
139
132
  - lib
140
133
  required_ruby_version: !ruby/object:Gem::Requirement
141
- none: false
142
134
  requirements:
143
- - - ! '>='
135
+ - - ">="
144
136
  - !ruby/object:Gem::Version
145
137
  version: '0'
146
- segments:
147
- - 0
148
- hash: -2167249535749031942
149
138
  required_rubygems_version: !ruby/object:Gem::Requirement
150
- none: false
151
139
  requirements:
152
- - - ! '>='
140
+ - - ">="
153
141
  - !ruby/object:Gem::Version
154
142
  version: '0'
155
- segments:
156
- - 0
157
- hash: -2167249535749031942
158
143
  requirements: []
159
144
  rubyforge_project:
160
- rubygems_version: 1.8.24
145
+ rubygems_version: 2.2.2
161
146
  signing_key:
162
- specification_version: 3
147
+ specification_version: 4
163
148
  summary: Wasko will allow you to quickly set a new background color for your terminal
164
149
  test_files:
165
150
  - test/helper.rb