wasko 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +44 -0
- data/Gemfile +17 -8
- data/Gemfile.lock +35 -17
- data/README.mdown +10 -14
- data/Rakefile +11 -48
- data/bin/wasko +6 -45
- data/lib/wasko.rb +12 -6
- data/lib/wasko/iterm.rb +8 -0
- data/lib/wasko/palette.rb +9 -0
- data/lib/wasko/terminal.rb +149 -0
- data/lib/wasko/version.rb +3 -0
- data/test/test_wasko.rb +3 -2
- data/wasko.gemspec +18 -106
- metadata +96 -201
data/.gitignore
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# rcov generated
|
2
|
+
coverage
|
3
|
+
|
4
|
+
# rdoc generated
|
5
|
+
rdoc
|
6
|
+
|
7
|
+
# yard generated
|
8
|
+
doc
|
9
|
+
.yardoc
|
10
|
+
|
11
|
+
# bundler
|
12
|
+
.bundle
|
13
|
+
|
14
|
+
# jeweler generated
|
15
|
+
pkg
|
16
|
+
|
17
|
+
# Don't show generated pallet html
|
18
|
+
samples.html
|
19
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
20
|
+
#
|
21
|
+
# * Create a file at ~/.gitignore
|
22
|
+
# * Include files you want ignored
|
23
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
24
|
+
#
|
25
|
+
# After doing this, these files will be ignored in all your git projects,
|
26
|
+
# saving you from having to 'pollute' every project you touch with them
|
27
|
+
#
|
28
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
29
|
+
#
|
30
|
+
# For MacOS:
|
31
|
+
#
|
32
|
+
#.DS_Store
|
33
|
+
#
|
34
|
+
# For TextMate
|
35
|
+
#*.tmproj
|
36
|
+
#tmtags
|
37
|
+
#
|
38
|
+
# For emacs:
|
39
|
+
#*~
|
40
|
+
#\#*
|
41
|
+
#.\#*
|
42
|
+
#
|
43
|
+
# For vim:
|
44
|
+
#*.swp
|
data/Gemfile
CHANGED
@@ -1,13 +1,22 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
-
|
4
|
-
gem "color"
|
5
|
-
gem "rake","0.8.7"
|
3
|
+
gemspec
|
6
4
|
|
7
5
|
group :development do
|
8
|
-
|
9
|
-
|
10
|
-
gem
|
11
|
-
|
12
|
-
|
6
|
+
# An IRB alternative and runtime developer console
|
7
|
+
# [pry](http://pry.github.com)
|
8
|
+
gem 'pry', '~> 0.9.10'
|
9
|
+
end
|
10
|
+
|
11
|
+
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'
|
13
22
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,27 +1,45 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
wasko (0.2.0)
|
5
|
+
color
|
6
|
+
thor
|
7
|
+
thor (~> 0.15.4)
|
8
|
+
|
1
9
|
GEM
|
2
10
|
remote: http://rubygems.org/
|
3
11
|
specs:
|
12
|
+
activesupport (3.2.8)
|
13
|
+
i18n (~> 0.6)
|
14
|
+
multi_json (~> 1.0)
|
15
|
+
coderay (1.0.7)
|
4
16
|
color (1.4.1)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
17
|
+
i18n (0.6.1)
|
18
|
+
metaclass (0.0.1)
|
19
|
+
method_source (0.8)
|
20
|
+
mocha (0.12.4)
|
21
|
+
metaclass (~> 0.0.1)
|
22
|
+
multi_json (1.3.6)
|
23
|
+
pry (0.9.10)
|
24
|
+
coderay (~> 1.0.5)
|
25
|
+
method_source (~> 0.8)
|
26
|
+
slop (~> 3.3.1)
|
11
27
|
rake (0.8.7)
|
12
|
-
|
13
|
-
|
14
|
-
|
28
|
+
shoulda (3.1.1)
|
29
|
+
shoulda-context (~> 1.0)
|
30
|
+
shoulda-matchers (~> 1.2)
|
31
|
+
shoulda-context (1.0.0)
|
32
|
+
shoulda-matchers (1.2.0)
|
33
|
+
activesupport (>= 3.0.0)
|
34
|
+
slop (3.3.3)
|
35
|
+
thor (0.15.4)
|
15
36
|
|
16
37
|
PLATFORMS
|
17
38
|
ruby
|
18
39
|
|
19
40
|
DEPENDENCIES
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
rcov
|
26
|
-
shoulda
|
27
|
-
thor
|
41
|
+
mocha (~> 0.12.4)
|
42
|
+
pry (~> 0.9.10)
|
43
|
+
rake
|
44
|
+
shoulda (~> 3.1.1)
|
45
|
+
wasko!
|
data/README.mdown
CHANGED
@@ -1,29 +1,25 @@
|
|
1
|
-
#
|
1
|
+
# Wasko
|
2
2
|
|
3
3
|
_The quickest way to set your Terminal palette._
|
4
4
|
|
5
5
|
## What is it?
|
6
6
|
|
7
|
-
I
|
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
|
+
|
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).
|
8
10
|
|
9
11
|
## How does it work?
|
10
12
|
|
11
13
|
If you just enter `wasko` it'll show you all available options (thanks to [thor](https://github.com/wycats/thor/))
|
12
14
|
|
13
|
-
The
|
15
|
+
The one I use most is:
|
14
16
|
|
15
|
-
* `wasko
|
16
|
-
* `wasko background yellow` which sets the background color
|
17
|
-
* `wasko save myawesomecomicsanstheme` which saves the theme to `~/.wasko/myawesomecomicsanstheme.color`
|
18
|
-
* `wasko font 48` is for all the presentation junkies.
|
19
|
-
* `wasko font 14 DejaVuSansMono` makes your Terminal web 2.0-y
|
17
|
+
* `wasko -b red` which will update the background color. You can enter any valid css color, the world is your coloured oyster.
|
20
18
|
|
21
|
-
|
19
|
+
You can also change the font etc, see the help for more:
|
22
20
|
|
23
|
-
*
|
24
|
-
*
|
25
|
-
* LSCOLORS, figure out how to set them for all terminals
|
26
|
-
* Add default Apple themes to default install
|
21
|
+
* `wasko font 48` is for all the presentation junkies.
|
22
|
+
* `wasko font 14 DejaVuSansMono` makes your Terminal web 2.0-y
|
27
23
|
|
28
24
|
## Contributing to wasko
|
29
25
|
|
@@ -37,6 +33,6 @@ The main ones are:
|
|
37
33
|
|
38
34
|
#@ Copyright
|
39
35
|
|
36
|
+
|
40
37
|
Copyright (c) 2011 pjaspers. See LICENSE.txt for
|
41
38
|
further details.
|
42
|
-
|
data/Rakefile
CHANGED
@@ -1,55 +1,18 @@
|
|
1
|
-
|
2
|
-
require
|
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 'rake'
|
11
|
-
|
12
|
-
require 'jeweler'
|
13
|
-
Jeweler::Tasks.new do |gem|
|
14
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
-
gem.name = "wasko"
|
16
|
-
gem.homepage = "http://github.com/pjaspers/wasko"
|
17
|
-
gem.license = "MIT"
|
18
|
-
gem.summary = %Q{Set your (OS X) terminal background from the command line}
|
19
|
-
gem.description = %Q{Quick tool to set a color palette to your Terminal}
|
20
|
-
gem.email = "piet@10to1.be"
|
21
|
-
gem.authors = ["pjaspers"]
|
22
|
-
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
|
-
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
|
-
gem.add_runtime_dependency 'color'
|
25
|
-
gem.add_runtime_dependency 'thor'
|
26
|
-
gem.add_development_dependency 'should'
|
27
|
-
gem.add_development_dependency 'mocha'
|
28
|
-
end
|
29
|
-
Jeweler::RubygemsDotOrgTasks.new
|
30
|
-
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require "bundler/gem_tasks"
|
31
3
|
require 'rake/testtask'
|
32
|
-
Rake::TestTask.new(:test) do |test|
|
33
|
-
test.libs << 'lib' << 'test'
|
34
|
-
test.pattern = 'test/**/test_*.rb'
|
35
|
-
test.verbose = true
|
36
|
-
end
|
37
4
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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
|
43
11
|
end
|
44
12
|
|
45
13
|
task :default => :test
|
46
14
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
rdoc.rdoc_dir = 'rdoc'
|
52
|
-
rdoc.title = "wasko #{version}"
|
53
|
-
rdoc.rdoc_files.include('README*')
|
54
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
desc "Open an pry session with Gasoline loaded"
|
16
|
+
task :console do
|
17
|
+
sh "pry -I lib -r wasko.rb"
|
55
18
|
end
|
data/bin/wasko
CHANGED
@@ -6,33 +6,17 @@ require "wasko"
|
|
6
6
|
require "thor"
|
7
7
|
|
8
8
|
module Wasko
|
9
|
+
# [thor](http://github.com/wycats/thor)
|
9
10
|
class CLI < Thor
|
10
11
|
include Thor::Actions
|
11
12
|
|
12
|
-
map "-p" => :palette
|
13
13
|
map "-b" => :background
|
14
14
|
map "-c" => :cursor
|
15
15
|
map "-t" => :text
|
16
16
|
map "-f" => :font
|
17
17
|
map "-s" => :strong
|
18
18
|
|
19
|
-
|
20
|
-
map "-r" => :load
|
21
|
-
|
22
|
-
desc "palette COLOR", "Gets/sets both back and foreground color adjusted to supplied"
|
23
|
-
def palette(color = "")
|
24
|
-
if color.empty?
|
25
|
-
say Wasko.palette
|
26
|
-
else
|
27
|
-
if Wasko::Color.color_from_string(color)
|
28
|
-
Wasko.set_palette color
|
29
|
-
else
|
30
|
-
say "Sorry, please use a valid CSS color."
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
desc "text COLOR", "Gets/sets text color"
|
19
|
+
desc "text COLOR", "-t, Gets/sets text color"
|
36
20
|
def text(color_name="")
|
37
21
|
if color_name.empty?
|
38
22
|
say Wasko.foreground_color
|
@@ -41,7 +25,7 @@ module Wasko
|
|
41
25
|
end
|
42
26
|
end
|
43
27
|
|
44
|
-
desc "strong COLOR", "Gets/sets the bold text color"
|
28
|
+
desc "strong COLOR", "-s, Gets/sets the bold text color"
|
45
29
|
def strong(color_name="")
|
46
30
|
if color_name.empty?
|
47
31
|
say Wasko.bold_color
|
@@ -50,7 +34,7 @@ module Wasko
|
|
50
34
|
end
|
51
35
|
end
|
52
36
|
|
53
|
-
desc "background COLOR", "Gets/sets background color"
|
37
|
+
desc "background COLOR", "-b, Gets/sets background color"
|
54
38
|
def background(color_name="")
|
55
39
|
if color_name.empty?
|
56
40
|
say Wasko.background_color
|
@@ -59,7 +43,7 @@ module Wasko
|
|
59
43
|
end
|
60
44
|
end
|
61
45
|
|
62
|
-
desc "cursor COLOR", "Gets/sets cursor color"
|
46
|
+
desc "cursor COLOR", "-c, Gets/sets cursor color"
|
63
47
|
def cursor(color_name="")
|
64
48
|
if color_name.empty?
|
65
49
|
say Wasko.cursor_color
|
@@ -68,7 +52,7 @@ module Wasko
|
|
68
52
|
end
|
69
53
|
end
|
70
54
|
|
71
|
-
desc "font NAME SIZE", "Gets/sets font"
|
55
|
+
desc "font NAME SIZE", "-f, Gets/sets font"
|
72
56
|
def font(font_name = "", font_size = 14)
|
73
57
|
if font_name.empty?
|
74
58
|
say Wasko.font
|
@@ -76,29 +60,6 @@ module Wasko
|
|
76
60
|
Wasko.set_font font_name, font_size
|
77
61
|
end
|
78
62
|
end
|
79
|
-
|
80
|
-
desc "load NAME", "Loads a stored theme"
|
81
|
-
def load(name="")
|
82
|
-
if name.empty?
|
83
|
-
say "Please pick a theme from: #{Wasko::Configuration.all_themes.join(", ")}"
|
84
|
-
return
|
85
|
-
end
|
86
|
-
|
87
|
-
if Wasko::Configuration.all_themes.include?(name)
|
88
|
-
Wasko::Configuration.load_colors!(name)
|
89
|
-
else
|
90
|
-
say "Please pick a theme from: [#{Wasko::Configuration.all_themes.join(", ")}]"
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
desc "save NAME", "Saves current scheme to ~/.wasko/"
|
95
|
-
def save(name)
|
96
|
-
if Wasko::Configuration.valid_name?(name)
|
97
|
-
Wasko::Configuration.save_colors!(name)
|
98
|
-
else
|
99
|
-
say "Invalid name, please use alphanumeric."
|
100
|
-
end
|
101
|
-
end
|
102
63
|
end
|
103
64
|
end
|
104
65
|
Wasko::CLI.start
|
data/lib/wasko.rb
CHANGED
@@ -22,7 +22,8 @@ module Wasko
|
|
22
22
|
def advanced_typing_apparatus
|
23
23
|
return Wasko::Terminal if current_application =~ /Terminal.app/
|
24
24
|
return Wasko::Iterm if current_application =~ /iTerm.app/
|
25
|
-
|
25
|
+
# Fall back to Terminal for CI
|
26
|
+
return Wasko::Terminal
|
26
27
|
end
|
27
28
|
|
28
29
|
# Gets the current active application
|
@@ -41,8 +42,17 @@ module Wasko
|
|
41
42
|
::Color::RGB.from_applescript(advanced_typing_apparatus.background_color).html
|
42
43
|
end
|
43
44
|
|
45
|
+
# Takes a color and mixes it with the original background color, so
|
46
|
+
# the newly generated color should look kinda like the other.
|
47
|
+
#
|
48
|
+
# color - A string with a css or hex color
|
49
|
+
#
|
50
|
+
# Sets the background color
|
44
51
|
def set_background_color(color)
|
45
|
-
|
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)
|
46
56
|
end
|
47
57
|
|
48
58
|
def foreground_color
|
@@ -160,10 +170,6 @@ module Wasko
|
|
160
170
|
set_cursor_color p.colors[:cursor].html
|
161
171
|
set_selected_text_color p.colors[:selected].html
|
162
172
|
set_selection_color p.colors[:selection].html
|
163
|
-
|
164
|
-
%w(black red green yellow blue magenta cyan white).each do |color|
|
165
|
-
eval "set_ansi_#{color}_color p.colors[:#{color}].html"
|
166
|
-
end
|
167
173
|
end
|
168
174
|
|
169
175
|
end
|
data/lib/wasko/iterm.rb
CHANGED
@@ -11,6 +11,14 @@ module Wasko
|
|
11
11
|
set_bold_color color
|
12
12
|
end
|
13
13
|
|
14
|
+
# iTerm doesn't have a way to get back the original color,
|
15
|
+
# falling back to black for now.
|
16
|
+
#
|
17
|
+
# Returns an applescript color
|
18
|
+
def self.startup_background_color
|
19
|
+
"{0,0,0}"
|
20
|
+
end
|
21
|
+
|
14
22
|
def self.method_missing(method_sym, *arguments, &block)
|
15
23
|
if method_sym.to_s =~ /^set_(.*)$/
|
16
24
|
self.set($1.gsub(/_/, " ") => arguments.first)
|
data/lib/wasko/palette.rb
CHANGED
@@ -31,6 +31,10 @@ module Wasko
|
|
31
31
|
Wasko::Color.color_from_string("black")
|
32
32
|
end
|
33
33
|
|
34
|
+
def ansi_colors?
|
35
|
+
p.colors[:yellow]
|
36
|
+
end
|
37
|
+
|
34
38
|
# Checks the brightness of the base color and
|
35
39
|
# returns the appropriate opposite color.
|
36
40
|
#
|
@@ -90,6 +94,11 @@ module Wasko
|
|
90
94
|
@base.mix_with(Wasko::Color.color_from_string(color_name), mix_value).adjust_brightness(brightness)
|
91
95
|
end
|
92
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
|
93
102
|
end
|
94
103
|
end
|
95
104
|
end
|
data/lib/wasko/terminal.rb
CHANGED
@@ -25,6 +25,155 @@ module Wasko
|
|
25
25
|
def self.set_ansi_cyan_color(color);end
|
26
26
|
def self.set_ansi_white_color(color);end
|
27
27
|
|
28
|
+
# If you don't like that option I've sent a pull request
|
29
|
+
# to iTerm2 which has ansi applescript support
|
30
|
+
def self.set_selected_text_color(color)
|
31
|
+
# Still no dice.
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.set_selection_color(color)
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
# The basic background color, since wasko never changes it,
|
39
|
+
# it can always be used as the baseline for creating new
|
40
|
+
# color mixes.
|
41
|
+
#
|
42
|
+
# Returns an applescript color
|
43
|
+
def self.startup_background_color
|
44
|
+
Wasko::Applescript.run do
|
45
|
+
<<SCRIPT
|
46
|
+
tell application "Terminal"
|
47
|
+
get background color of startup settings
|
48
|
+
end tell
|
49
|
+
SCRIPT
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
def self.set_color_via_gui(color_index, color)
|
55
|
+
Wasko::Applescript.run do
|
56
|
+
<<SCRIPT
|
57
|
+
tell application "Terminal"
|
58
|
+
activate
|
59
|
+
tell application "System Events"
|
60
|
+
# Open Preferences
|
61
|
+
keystroke "," using command down
|
62
|
+
tell process "Terminal"
|
63
|
+
click button 2 of tool bar 1 of window 1
|
64
|
+
# Make sure the default is selected
|
65
|
+
set srows to every row of table 1 of scroll area 1 of group 1 of window 1
|
66
|
+
repeat with a_row in srows
|
67
|
+
if value of text field 1 of a_row contains "#{get_selected_theme}" then
|
68
|
+
set selected of a_row to true
|
69
|
+
exit repeat
|
70
|
+
end if
|
71
|
+
end repeat
|
72
|
+
|
73
|
+
click color well #{color_index} of tab group 1 of group 1 of window "Settings"
|
74
|
+
click (every button whose description is "Hex Color Picker") of tool bar 1 of window "Colors"
|
75
|
+
set value of text field 1 of group 1 of window "Colors" to "#{color.html}"
|
76
|
+
# Close Colors
|
77
|
+
click button 1 of window "Colors"
|
78
|
+
# Close prefs
|
79
|
+
keystroke "w" using command down
|
80
|
+
end tell
|
81
|
+
end tell
|
82
|
+
end tell
|
83
|
+
SCRIPT
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.get_selected_theme
|
88
|
+
@selected_theme ||=
|
89
|
+
Wasko::Applescript.run do
|
90
|
+
<<SCRIPT
|
91
|
+
tell application "Terminal"
|
92
|
+
activate
|
93
|
+
tell application "System Events"
|
94
|
+
# Open Inspector
|
95
|
+
tell process "Terminal"
|
96
|
+
if window "Inspector" exists then
|
97
|
+
else
|
98
|
+
keystroke "I" using command down
|
99
|
+
end if
|
100
|
+
click radio button 2 of tab group 1 of window "Inspector"
|
101
|
+
set selected_theme to value of text field of item 1 of (every row whose selected is true) of table 1 of scroll area 1 of tab group 1 of window "Inspector"
|
102
|
+
click button 1 of window "Inspector"
|
103
|
+
return selected_theme
|
104
|
+
end tell
|
105
|
+
|
106
|
+
end tell
|
107
|
+
end tell
|
108
|
+
SCRIPT
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def self.set_selected_theme(theme_name)
|
113
|
+
output = Wasko::Applescript.run do
|
114
|
+
<<SCRIPT
|
115
|
+
tell application "Terminal"
|
116
|
+
activate
|
117
|
+
tell application "System Events"
|
118
|
+
# Open Inspector
|
119
|
+
tell process "Terminal"
|
120
|
+
if window "Inspector" exists then
|
121
|
+
else
|
122
|
+
keystroke "I" using command down
|
123
|
+
end if
|
124
|
+
click radio button 2 of tab group 1 of window "Inspector"
|
125
|
+
set srows to every row of table 1 of scroll area 1 of tab group 1 of window "Inspector"
|
126
|
+
set theme_found to false
|
127
|
+
repeat with a_row in srows
|
128
|
+
if value of text field of a_row contains "#{theme_name}" then
|
129
|
+
set theme_found to true
|
130
|
+
set selected of a_row to true
|
131
|
+
end if
|
132
|
+
end repeat
|
133
|
+
|
134
|
+
if theme_found then
|
135
|
+
# Theme selected
|
136
|
+
# Close inspector window
|
137
|
+
keystroke "w" using command down
|
138
|
+
else
|
139
|
+
keystroke "w" using command down
|
140
|
+
#{add_theme_script(theme_name)}
|
141
|
+
# Cleanup
|
142
|
+
keystroke "w" using command down
|
143
|
+
return "NOT_FOUND"
|
144
|
+
end if
|
145
|
+
end tell
|
146
|
+
end tell
|
147
|
+
end tell
|
148
|
+
SCRIPT
|
149
|
+
end
|
150
|
+
|
151
|
+
# Doing this in Ruby because Applescript is that much
|
152
|
+
# teh suck combined.
|
153
|
+
set_selected_theme(theme_name) if output == "NOT_FOUND"
|
154
|
+
end
|
155
|
+
|
156
|
+
# This string will add a new theme to the Terminal's preferences
|
157
|
+
# if evaluated by Applescript
|
158
|
+
def self.add_theme_script(theme_name)
|
159
|
+
<<SCRIPT
|
160
|
+
tell application "Terminal"
|
161
|
+
activate
|
162
|
+
tell application "System Events"
|
163
|
+
# Open Preferences
|
164
|
+
keystroke "," using command down
|
165
|
+
tell process "Terminal"
|
166
|
+
# Create the wasko theme placeholder
|
167
|
+
click button 2 of tool bar 1 of window 1
|
168
|
+
click (every button whose description is "Add") of group 1 of window 1
|
169
|
+
keystroke "#{theme_name}"
|
170
|
+
key code 36 # hits return
|
171
|
+
end tell
|
172
|
+
end tell
|
173
|
+
end tell
|
174
|
+
SCRIPT
|
175
|
+
end
|
176
|
+
|
28
177
|
# # Getters And Setters
|
29
178
|
#
|
30
179
|
# This supports the following
|
data/test/test_wasko.rb
CHANGED
@@ -6,8 +6,9 @@ class TestWasko < Test::Unit::TestCase
|
|
6
6
|
setup do
|
7
7
|
@color = Wasko::Color.color_from_string("white")
|
8
8
|
palette = mock()
|
9
|
-
palette.expects(:colors).returns({:base => @color, :foreground => @color, :bold => @color, :cursor => @color}).at_least_once
|
9
|
+
palette.expects(:colors).returns({:base => @color, :foreground => @color, :bold => @color, :cursor => @color, :selected => @color, :selection => @color}).at_least_once
|
10
10
|
Wasko::Palette::TheOriginal.expects(:new).with("white").returns(palette)
|
11
|
+
|
11
12
|
end
|
12
13
|
|
13
14
|
should "draw a palette" do
|
@@ -82,7 +83,7 @@ class TestWasko < Test::Unit::TestCase
|
|
82
83
|
|
83
84
|
# Test all getter/setter colors
|
84
85
|
context "getting/setting regular colors" do
|
85
|
-
%w(
|
86
|
+
%w(cursor_color foreground_color bold_color).each do |method|
|
86
87
|
|
87
88
|
setup do
|
88
89
|
@color = Wasko::Color.color_from_string("white")
|
data/wasko.gemspec
CHANGED
@@ -1,112 +1,24 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/wasko/version', __FILE__)
|
5
3
|
|
6
|
-
Gem::Specification.new do |
|
7
|
-
|
8
|
-
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["pjaspers"]
|
6
|
+
gem.email = ["piet@jaspe.rs"]
|
7
|
+
gem.description = %q{Wasko colors your day/terminal}
|
8
|
+
gem.summary = %q{Wasko will allow you to quickly set a new background color for your terminal}
|
9
|
+
gem.homepage = ""
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
s.executables = ["wasko"]
|
17
|
-
s.extra_rdoc_files = [
|
18
|
-
"LICENSE.txt",
|
19
|
-
"README.mdown"
|
20
|
-
]
|
21
|
-
s.files = [
|
22
|
-
".document",
|
23
|
-
"Gemfile",
|
24
|
-
"Gemfile.lock",
|
25
|
-
"LICENSE.txt",
|
26
|
-
"README.mdown",
|
27
|
-
"Rakefile",
|
28
|
-
"VERSION",
|
29
|
-
"bin/wasko",
|
30
|
-
"docs/applescript.html",
|
31
|
-
"docs/color.html",
|
32
|
-
"docs/configuration.html",
|
33
|
-
"docs/docco.css",
|
34
|
-
"docs/palette.html",
|
35
|
-
"docs/terminal.html",
|
36
|
-
"docs/wasko.html",
|
37
|
-
"lib/wasko.rb",
|
38
|
-
"lib/wasko/applescript.rb",
|
39
|
-
"lib/wasko/color.rb",
|
40
|
-
"lib/wasko/configuration.rb",
|
41
|
-
"lib/wasko/iterm.rb",
|
42
|
-
"lib/wasko/palette.rb",
|
43
|
-
"lib/wasko/terminal.rb",
|
44
|
-
"sample_generator.rb",
|
45
|
-
"test/helper.rb",
|
46
|
-
"test/test_applescript.rb",
|
47
|
-
"test/test_color.rb",
|
48
|
-
"test/test_palette.rb",
|
49
|
-
"test/test_terminal.rb",
|
50
|
-
"test/test_wasko.rb",
|
51
|
-
"wasko.gemspec"
|
52
|
-
]
|
53
|
-
s.homepage = %q{http://github.com/pjaspers/wasko}
|
54
|
-
s.licenses = ["MIT"]
|
55
|
-
s.require_paths = ["lib"]
|
56
|
-
s.rubygems_version = %q{1.6.2}
|
57
|
-
s.summary = %q{Set your (OS X) terminal background from the command line}
|
58
|
-
s.test_files = [
|
59
|
-
"test/helper.rb",
|
60
|
-
"test/test_applescript.rb",
|
61
|
-
"test/test_color.rb",
|
62
|
-
"test/test_palette.rb",
|
63
|
-
"test/test_terminal.rb",
|
64
|
-
"test/test_wasko.rb"
|
65
|
-
]
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "wasko"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Wasko::VERSION
|
66
17
|
|
67
|
-
|
68
|
-
|
18
|
+
gem.add_runtime_dependency("thor", ["~> 0.15.4"])
|
19
|
+
gem.add_runtime_dependency 'color'
|
20
|
+
gem.add_runtime_dependency 'thor'
|
69
21
|
|
70
|
-
|
71
|
-
|
72
|
-
s.add_runtime_dependency(%q<color>, [">= 0"])
|
73
|
-
s.add_runtime_dependency(%q<rake>, ["= 0.8.7"])
|
74
|
-
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
75
|
-
s.add_development_dependency(%q<mocha>, [">= 0"])
|
76
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
77
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
78
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
79
|
-
s.add_runtime_dependency(%q<color>, [">= 0"])
|
80
|
-
s.add_runtime_dependency(%q<thor>, [">= 0"])
|
81
|
-
s.add_development_dependency(%q<should>, [">= 0"])
|
82
|
-
s.add_development_dependency(%q<mocha>, [">= 0"])
|
83
|
-
else
|
84
|
-
s.add_dependency(%q<thor>, [">= 0"])
|
85
|
-
s.add_dependency(%q<color>, [">= 0"])
|
86
|
-
s.add_dependency(%q<rake>, ["= 0.8.7"])
|
87
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
88
|
-
s.add_dependency(%q<mocha>, [">= 0"])
|
89
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
90
|
-
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
91
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
92
|
-
s.add_dependency(%q<color>, [">= 0"])
|
93
|
-
s.add_dependency(%q<thor>, [">= 0"])
|
94
|
-
s.add_dependency(%q<should>, [">= 0"])
|
95
|
-
s.add_dependency(%q<mocha>, [">= 0"])
|
96
|
-
end
|
97
|
-
else
|
98
|
-
s.add_dependency(%q<thor>, [">= 0"])
|
99
|
-
s.add_dependency(%q<color>, [">= 0"])
|
100
|
-
s.add_dependency(%q<rake>, ["= 0.8.7"])
|
101
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
102
|
-
s.add_dependency(%q<mocha>, [">= 0"])
|
103
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
104
|
-
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
105
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
106
|
-
s.add_dependency(%q<color>, [">= 0"])
|
107
|
-
s.add_dependency(%q<thor>, [">= 0"])
|
108
|
-
s.add_dependency(%q<should>, [">= 0"])
|
109
|
-
s.add_dependency(%q<mocha>, [">= 0"])
|
110
|
-
end
|
22
|
+
gem.add_development_dependency 'shoulda'
|
23
|
+
gem.add_development_dependency 'mocha'
|
111
24
|
end
|
112
|
-
|
metadata
CHANGED
@@ -1,208 +1,106 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: wasko
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 0
|
10
|
-
version: 0.1.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- pjaspers
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
22
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
-
none: false
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
hash: 3
|
28
|
-
segments:
|
29
|
-
- 0
|
30
|
-
version: "0"
|
12
|
+
date: 2012-09-24 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
31
15
|
name: thor
|
32
|
-
|
33
|
-
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.15.4
|
34
22
|
type: :runtime
|
35
|
-
|
36
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
25
|
none: false
|
38
|
-
requirements:
|
39
|
-
- -
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
|
42
|
-
|
43
|
-
- 0
|
44
|
-
version: "0"
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.15.4
|
30
|
+
- !ruby/object:Gem::Dependency
|
45
31
|
name: color
|
46
|
-
|
47
|
-
prerelease: false
|
48
|
-
type: :runtime
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
51
33
|
none: false
|
52
|
-
requirements:
|
53
|
-
- -
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
|
56
|
-
segments:
|
57
|
-
- 0
|
58
|
-
- 8
|
59
|
-
- 7
|
60
|
-
version: 0.8.7
|
61
|
-
name: rake
|
62
|
-
version_requirements: *id003
|
63
|
-
prerelease: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
64
38
|
type: :runtime
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
|
-
requirements:
|
69
|
-
- - ">="
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
hash: 3
|
72
|
-
segments:
|
73
|
-
- 0
|
74
|
-
version: "0"
|
75
|
-
name: shoulda
|
76
|
-
version_requirements: *id004
|
77
39
|
prerelease: false
|
78
|
-
|
79
|
-
- !ruby/object:Gem::Dependency
|
80
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
41
|
none: false
|
82
|
-
requirements:
|
83
|
-
- -
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
name: mocha
|
90
|
-
version_requirements: *id005
|
91
|
-
prerelease: false
|
92
|
-
type: :development
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: thor
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
95
49
|
none: false
|
96
|
-
requirements:
|
97
|
-
- -
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
|
100
|
-
|
101
|
-
- 1
|
102
|
-
- 0
|
103
|
-
- 0
|
104
|
-
version: 1.0.0
|
105
|
-
name: bundler
|
106
|
-
version_requirements: *id006
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
107
55
|
prerelease: false
|
108
|
-
|
109
|
-
- !ruby/object:Gem::Dependency
|
110
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
111
57
|
none: false
|
112
|
-
requirements:
|
113
|
-
- -
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
- 2
|
120
|
-
version: 1.5.2
|
121
|
-
name: jeweler
|
122
|
-
version_requirements: *id007
|
123
|
-
prerelease: false
|
124
|
-
type: :development
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
requirement: &id008 !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: shoulda
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
127
65
|
none: false
|
128
|
-
requirements:
|
129
|
-
- -
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
|
132
|
-
segments:
|
133
|
-
- 0
|
134
|
-
version: "0"
|
135
|
-
name: rcov
|
136
|
-
version_requirements: *id008
|
137
|
-
prerelease: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
138
70
|
type: :development
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
requirement: &id009 !ruby/object:Gem::Requirement
|
141
|
-
none: false
|
142
|
-
requirements:
|
143
|
-
- - ">="
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
hash: 3
|
146
|
-
segments:
|
147
|
-
- 0
|
148
|
-
version: "0"
|
149
|
-
name: color
|
150
|
-
version_requirements: *id009
|
151
71
|
prerelease: false
|
152
|
-
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
requirement: &id010 !ruby/object:Gem::Requirement
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
73
|
none: false
|
156
|
-
requirements:
|
157
|
-
- -
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
name: thor
|
164
|
-
version_requirements: *id010
|
165
|
-
prerelease: false
|
166
|
-
type: :runtime
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
requirement: &id011 !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: mocha
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
169
81
|
none: false
|
170
|
-
requirements:
|
171
|
-
- -
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
|
174
|
-
segments:
|
175
|
-
- 0
|
176
|
-
version: "0"
|
177
|
-
name: should
|
178
|
-
version_requirements: *id011
|
179
|
-
prerelease: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
180
86
|
type: :development
|
181
|
-
- !ruby/object:Gem::Dependency
|
182
|
-
requirement: &id012 !ruby/object:Gem::Requirement
|
183
|
-
none: false
|
184
|
-
requirements:
|
185
|
-
- - ">="
|
186
|
-
- !ruby/object:Gem::Version
|
187
|
-
hash: 3
|
188
|
-
segments:
|
189
|
-
- 0
|
190
|
-
version: "0"
|
191
|
-
name: mocha
|
192
|
-
version_requirements: *id012
|
193
87
|
prerelease: false
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
description: Wasko colors your day/terminal
|
95
|
+
email:
|
96
|
+
- piet@jaspe.rs
|
97
|
+
executables:
|
198
98
|
- wasko
|
199
99
|
extensions: []
|
200
|
-
|
201
|
-
|
202
|
-
- LICENSE.txt
|
203
|
-
- README.mdown
|
204
|
-
files:
|
100
|
+
extra_rdoc_files: []
|
101
|
+
files:
|
205
102
|
- .document
|
103
|
+
- .gitignore
|
206
104
|
- Gemfile
|
207
105
|
- Gemfile.lock
|
208
106
|
- LICENSE.txt
|
@@ -224,6 +122,7 @@ files:
|
|
224
122
|
- lib/wasko/iterm.rb
|
225
123
|
- lib/wasko/palette.rb
|
226
124
|
- lib/wasko/terminal.rb
|
125
|
+
- lib/wasko/version.rb
|
227
126
|
- sample_generator.rb
|
228
127
|
- test/helper.rb
|
229
128
|
- test/test_applescript.rb
|
@@ -232,41 +131,37 @@ files:
|
|
232
131
|
- test/test_terminal.rb
|
233
132
|
- test/test_wasko.rb
|
234
133
|
- wasko.gemspec
|
235
|
-
|
236
|
-
|
237
|
-
licenses:
|
238
|
-
- MIT
|
134
|
+
homepage: ''
|
135
|
+
licenses: []
|
239
136
|
post_install_message:
|
240
137
|
rdoc_options: []
|
241
|
-
|
242
|
-
require_paths:
|
138
|
+
require_paths:
|
243
139
|
- lib
|
244
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
140
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
245
141
|
none: false
|
246
|
-
requirements:
|
247
|
-
- -
|
248
|
-
- !ruby/object:Gem::Version
|
249
|
-
|
250
|
-
segments:
|
142
|
+
requirements:
|
143
|
+
- - ! '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
segments:
|
251
147
|
- 0
|
252
|
-
|
253
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
|
+
hash: -1096904852995831411
|
149
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
254
150
|
none: false
|
255
|
-
requirements:
|
256
|
-
- -
|
257
|
-
- !ruby/object:Gem::Version
|
258
|
-
|
259
|
-
segments:
|
151
|
+
requirements:
|
152
|
+
- - ! '>='
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
155
|
+
segments:
|
260
156
|
- 0
|
261
|
-
|
157
|
+
hash: -1096904852995831411
|
262
158
|
requirements: []
|
263
|
-
|
264
159
|
rubyforge_project:
|
265
|
-
rubygems_version: 1.
|
160
|
+
rubygems_version: 1.8.24
|
266
161
|
signing_key:
|
267
162
|
specification_version: 3
|
268
|
-
summary:
|
269
|
-
test_files:
|
163
|
+
summary: Wasko will allow you to quickly set a new background color for your terminal
|
164
|
+
test_files:
|
270
165
|
- test/helper.rb
|
271
166
|
- test/test_applescript.rb
|
272
167
|
- test/test_color.rb
|