iterm2mintty 0.0.3 → 0.0.4.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -1
- data/Rakefile +1 -0
- data/bin/iterm2mintty +3 -11
- data/iterm2mintty.gemspec +2 -0
- data/lib/iterm2mintty/cli.rb +80 -0
- data/lib/iterm2mintty/converter.rb +18 -0
- data/lib/iterm2mintty/iterm2_theme.rb +12 -0
- data/lib/iterm2mintty/iterm2_theme_parser.rb +46 -0
- data/lib/iterm2mintty/mintty_theme.rb +43 -0
- data/lib/iterm2mintty/theme.rb +9 -0
- data/lib/iterm2mintty/theme_component.rb +44 -0
- data/lib/iterm2mintty/version.rb +2 -2
- data/lib/iterm2mintty.rb +4 -124
- data/test/{Hybrid.itermcolors → fixtures/Hybrid.itermcolors} +0 -0
- data/test/helper.rb +2 -0
- data/test/test_cli.rb +16 -0
- data/test/test_converter.rb +28 -0
- data/test/test_iterm2_theme.rb +53 -0
- data/test/test_iterm2mintty.rb +3 -23
- data/test/test_mintty_theme.rb +64 -0
- metadata +26 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 335b699de480a3940a7c7fec515461c382f08052
|
4
|
+
data.tar.gz: 24da084225bd5c636b816e92a993ec3ccde7bb4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6129285ba36bcc9d238c5184c779973196dc61462356c88bae879a4cd8c1005a8229dcf35f57d8c997390997f85572cf313e2bebc092ab95fbd4ad9d2319e58
|
7
|
+
data.tar.gz: 24a67fc639f6c534dd36ba0256dcd9703f14d151f2e2bf16fc2d0d0808f4ecc5ed3d0cca631c439e963ea1c88b1436f933b64e97fbfe84b4deb5de2ba945016a
|
data/README.md
CHANGED
@@ -21,11 +21,23 @@ Or install it yourself as:
|
|
21
21
|
|
22
22
|
## Usage
|
23
23
|
|
24
|
+
Iterm2mintty default writes to stdout. To use, try:
|
25
|
+
|
24
26
|
```
|
25
27
|
iterm2mintty somecolorscheme.itermcolors
|
26
28
|
```
|
27
29
|
|
28
|
-
|
30
|
+
Or maybe even:
|
31
|
+
|
32
|
+
```
|
33
|
+
iterm2mintty somecolorscheme.itermcolors > .minttyrc
|
34
|
+
```
|
35
|
+
|
36
|
+
If you'd like to write the output to a file, use the `-o` flag (defaults to .minttyrc)
|
37
|
+
|
38
|
+
```
|
39
|
+
iterm2mintty somecolorscheme.itermcolors -o some/path/to/.minttyrc
|
40
|
+
```
|
29
41
|
|
30
42
|
## Contributing
|
31
43
|
|
data/Rakefile
CHANGED
data/bin/iterm2mintty
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
$LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
|
3
|
+
Signal.trap("INT") { exit false }
|
5
4
|
|
6
|
-
|
5
|
+
require "iterm2mintty/cli"
|
7
6
|
|
8
|
-
|
9
|
-
require "pathname"
|
10
|
-
|
11
|
-
file = Pathname.new(ARGV[0])
|
12
|
-
|
13
|
-
File.open("./.minttyrc", "w") do |f|
|
14
|
-
f.write Iterm2mintty.new(pathname: file).convert
|
15
|
-
end
|
7
|
+
Iterm2mintty::CLI.run(ARGV.dup)
|
data/iterm2mintty.gemspec
CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
+
spec.required_ruby_version = "~> 2.1"
|
22
|
+
|
21
23
|
spec.add_development_dependency "bundler", "~> 1.7"
|
22
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
25
|
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require "optparse"
|
2
|
+
require "pathname"
|
3
|
+
require "iterm2mintty"
|
4
|
+
require "iterm2mintty/version"
|
5
|
+
|
6
|
+
module Iterm2mintty
|
7
|
+
class CLI
|
8
|
+
attr_reader :args, :io, :source
|
9
|
+
|
10
|
+
def self.run(args)
|
11
|
+
new(args).run
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(args, io: $stdout)
|
15
|
+
@args = args
|
16
|
+
@io = io
|
17
|
+
end
|
18
|
+
|
19
|
+
def run
|
20
|
+
parse_options
|
21
|
+
|
22
|
+
io.puts Iterm2mintty.convert(source)
|
23
|
+
|
24
|
+
if io.close_on_exec?
|
25
|
+
io.close
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def parse_options
|
30
|
+
parser = OptionParser.new do |opts|
|
31
|
+
opts.banner = "Usage: iterm2mintty <source filepath> [options]"
|
32
|
+
opts.separator ""
|
33
|
+
opts.separator "Options:"
|
34
|
+
|
35
|
+
opts.on(
|
36
|
+
"-o",
|
37
|
+
"--output [FILE]",
|
38
|
+
"FILE to output theme to (defaults to .minttyrc)"
|
39
|
+
) do |path|
|
40
|
+
path ||= ".minttyrc"
|
41
|
+
@io = File.new(path, "w")
|
42
|
+
end
|
43
|
+
|
44
|
+
opts.on("-v", "--version", "Prints version of Iterm2mintty") do
|
45
|
+
puts VERSION
|
46
|
+
exit true
|
47
|
+
end
|
48
|
+
|
49
|
+
opts.on("-h", "--help", "Prints this help :)") do
|
50
|
+
puts opts
|
51
|
+
|
52
|
+
if io.close_on_exec?
|
53
|
+
io.close
|
54
|
+
end
|
55
|
+
|
56
|
+
exit true
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
parser.parse!(args)
|
61
|
+
|
62
|
+
if args.empty?
|
63
|
+
puts parser
|
64
|
+
|
65
|
+
if io.close_on_exec?
|
66
|
+
io.close
|
67
|
+
end
|
68
|
+
|
69
|
+
exit false
|
70
|
+
else
|
71
|
+
@source = Pathname.new(args.pop)
|
72
|
+
|
73
|
+
unless @source.exist?
|
74
|
+
puts "Source file \"#{@source}\" does not exist."
|
75
|
+
exit false
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "iterm2mintty/mintty_theme"
|
2
|
+
require "iterm2mintty/iterm2_theme"
|
3
|
+
|
4
|
+
module Iterm2mintty
|
5
|
+
class Converter
|
6
|
+
attr_reader :to, :from
|
7
|
+
|
8
|
+
def initialize(to: MinttyTheme.new, from: Iterm2Theme.new)
|
9
|
+
@to = to
|
10
|
+
@from = from
|
11
|
+
end
|
12
|
+
|
13
|
+
def call(source)
|
14
|
+
to.components = from.from_source(source).components
|
15
|
+
to.output
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require "iterm2mintty/theme_component"
|
2
|
+
require "plist"
|
3
|
+
|
4
|
+
module Iterm2mintty
|
5
|
+
class Iterm2ThemeParser
|
6
|
+
attr_reader :itermcolors
|
7
|
+
|
8
|
+
def initialize(itermcolors)
|
9
|
+
@itermcolors = itermcolors
|
10
|
+
end
|
11
|
+
|
12
|
+
def build
|
13
|
+
parsed_theme.map do |k, v|
|
14
|
+
case k
|
15
|
+
when /Ansi (\d+) Color/
|
16
|
+
ThemeComponent.ansi(Integer($1))
|
17
|
+
when "Background Color"
|
18
|
+
BGColorComponent
|
19
|
+
when "Foreground Color"
|
20
|
+
FGColorComponent
|
21
|
+
when "Cursor Color"
|
22
|
+
CursorColorComponent
|
23
|
+
else
|
24
|
+
# TODO(bobcats): Probably good candidate for NullComponent
|
25
|
+
next
|
26
|
+
end.new(red(v), green(v), blue(v))
|
27
|
+
end.compact
|
28
|
+
end
|
29
|
+
|
30
|
+
def red(value)
|
31
|
+
Integer(value.fetch("Red Component").to_f * 255)
|
32
|
+
end
|
33
|
+
|
34
|
+
def green(value)
|
35
|
+
Integer(value.fetch("Green Component").to_f * 255)
|
36
|
+
end
|
37
|
+
|
38
|
+
def blue(value)
|
39
|
+
Integer(value.fetch("Blue Component").to_f * 255)
|
40
|
+
end
|
41
|
+
|
42
|
+
def parsed_theme
|
43
|
+
Plist.parse_xml(itermcolors)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require "iterm2mintty/theme"
|
2
|
+
|
3
|
+
module Iterm2mintty
|
4
|
+
class MinttyTheme < Theme
|
5
|
+
def output
|
6
|
+
output_lines.join("\n") + "\n"
|
7
|
+
end
|
8
|
+
|
9
|
+
def output_lines
|
10
|
+
components.map do |component|
|
11
|
+
component_to_config(component)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def component_to_config(component)
|
16
|
+
"#{key_for(component.class)}= #{component.red}, #{component.green}, #{component.blue}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def key_for(component_class)
|
20
|
+
{
|
21
|
+
BlackComponent => "Black",
|
22
|
+
RedComponent => "Red",
|
23
|
+
GreenComponent => "Green",
|
24
|
+
YellowComponent => "Yellow",
|
25
|
+
BlueComponent => "Blue",
|
26
|
+
MagentaComponent => "Magenta",
|
27
|
+
CyanComponent => "Cyan",
|
28
|
+
WhiteComponent => "White",
|
29
|
+
BoldBlackComponent => "BoldBlack",
|
30
|
+
BoldRedComponent => "BoldRed",
|
31
|
+
BoldGreenComponent => "BoldGreen",
|
32
|
+
BoldYellowComponent => "BoldYellow",
|
33
|
+
BoldBlueComponent => "BoldBlue",
|
34
|
+
BoldMagentaComponent => "BoldMagenta",
|
35
|
+
BoldCyanComponent => "BoldCyan",
|
36
|
+
BoldWhiteComponent => "BoldWhite",
|
37
|
+
BGColorComponent => "BackgroundColour",
|
38
|
+
FGColorComponent => "ForegroundColour",
|
39
|
+
CursorColorComponent => "CursorColour",
|
40
|
+
}[component_class]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Iterm2mintty
|
2
|
+
class ThemeComponent < Struct.new(:red, :green, :blue)
|
3
|
+
def self.ansi(index)
|
4
|
+
[
|
5
|
+
BlackComponent,
|
6
|
+
RedComponent,
|
7
|
+
GreenComponent,
|
8
|
+
YellowComponent,
|
9
|
+
BlueComponent,
|
10
|
+
MagentaComponent,
|
11
|
+
CyanComponent,
|
12
|
+
WhiteComponent,
|
13
|
+
BoldBlackComponent,
|
14
|
+
BoldRedComponent,
|
15
|
+
BoldGreenComponent,
|
16
|
+
BoldYellowComponent,
|
17
|
+
BoldBlueComponent,
|
18
|
+
BoldMagentaComponent,
|
19
|
+
BoldCyanComponent,
|
20
|
+
BoldWhiteComponent,
|
21
|
+
][index]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class BlackComponent < ThemeComponent; end
|
26
|
+
class RedComponent < ThemeComponent; end
|
27
|
+
class GreenComponent < ThemeComponent; end
|
28
|
+
class YellowComponent < ThemeComponent; end
|
29
|
+
class BlueComponent < ThemeComponent; end
|
30
|
+
class MagentaComponent < ThemeComponent; end
|
31
|
+
class CyanComponent < ThemeComponent; end
|
32
|
+
class WhiteComponent < ThemeComponent; end
|
33
|
+
class BoldBlackComponent < ThemeComponent; end
|
34
|
+
class BoldRedComponent < ThemeComponent; end
|
35
|
+
class BoldGreenComponent < ThemeComponent; end
|
36
|
+
class BoldYellowComponent < ThemeComponent; end
|
37
|
+
class BoldBlueComponent < ThemeComponent; end
|
38
|
+
class BoldMagentaComponent < ThemeComponent; end
|
39
|
+
class BoldCyanComponent < ThemeComponent; end
|
40
|
+
class BoldWhiteComponent < ThemeComponent; end
|
41
|
+
class BGColorComponent < ThemeComponent; end
|
42
|
+
class FGColorComponent < ThemeComponent; end
|
43
|
+
class CursorColorComponent < ThemeComponent; end
|
44
|
+
end
|
data/lib/iterm2mintty/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
VERSION = "0.0.
|
1
|
+
module Iterm2mintty
|
2
|
+
VERSION = "0.0.4.pre"
|
3
3
|
end
|
data/lib/iterm2mintty.rb
CHANGED
@@ -1,127 +1,7 @@
|
|
1
|
-
require "iterm2mintty/
|
2
|
-
require "plist"
|
1
|
+
require "iterm2mintty/converter"
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
def initialize(pathname:)
|
8
|
-
@pathname = pathname
|
9
|
-
end
|
10
|
-
|
11
|
-
def convert
|
12
|
-
ansi_colors.map do |color|
|
13
|
-
color.to_mintty + "\n"
|
14
|
-
end.join
|
15
|
-
end
|
16
|
-
|
17
|
-
def ansi_colors
|
18
|
-
parsed_theme.map do |k, v|
|
19
|
-
red = Integer(v["Red Component"] * 255)
|
20
|
-
green = Integer(v["Green Component"] * 255)
|
21
|
-
blue = Integer(v["Blue Component"] * 255)
|
22
|
-
color = Color.new(red, green, blue)
|
23
|
-
|
24
|
-
case k
|
25
|
-
when /Ansi/
|
26
|
-
number = Integer(k.match(/\d+/)[0])
|
27
|
-
ANSIColor.new(number: number, color: color)
|
28
|
-
when "Background Color"
|
29
|
-
BGColor.new(color: color)
|
30
|
-
when "Foreground Color"
|
31
|
-
FGColor.new(color: color)
|
32
|
-
when "Cursor Color"
|
33
|
-
CursorColor.new(color: color)
|
34
|
-
end
|
35
|
-
end.compact
|
36
|
-
end
|
37
|
-
|
38
|
-
def parsed_theme
|
39
|
-
Plist.parse_xml(pathname)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
module Iterm2mintty::MinttyColor
|
44
|
-
def to_mintty
|
45
|
-
"#{name}= #{red}, #{green}, #{blue}"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
module Iterm2mintty::Colorable
|
50
|
-
def red
|
51
|
-
color.r
|
52
|
-
end
|
53
|
-
|
54
|
-
def green
|
55
|
-
color.g
|
56
|
-
end
|
57
|
-
|
58
|
-
def blue
|
59
|
-
color.b
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
class Iterm2mintty::ANSIColor
|
64
|
-
include Iterm2mintty::MinttyColor
|
65
|
-
include Iterm2mintty::Colorable
|
66
|
-
|
67
|
-
attr_reader :number, :color
|
68
|
-
|
69
|
-
NAMES = %w(
|
70
|
-
Black Red Green Yellow Blue Magenta Cyan White
|
71
|
-
BoldBlack BoldRed BoldGreen BoldYellow BoldBlue BoldMagenta BoldCyan BoldWhite
|
72
|
-
)
|
73
|
-
|
74
|
-
def initialize(number:, color:)
|
75
|
-
@number = number
|
76
|
-
@color = color
|
77
|
-
end
|
78
|
-
|
79
|
-
def name
|
80
|
-
NAMES[number]
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
class Iterm2mintty::FGColor
|
85
|
-
include Iterm2mintty::MinttyColor
|
86
|
-
include Iterm2mintty::Colorable
|
87
|
-
attr_reader :color
|
88
|
-
|
89
|
-
def initialize(color:)
|
90
|
-
@color = color
|
91
|
-
end
|
92
|
-
|
93
|
-
def name
|
94
|
-
"ForegroundColour"
|
3
|
+
module Iterm2mintty
|
4
|
+
def self.convert(source)
|
5
|
+
Converter.new.call(source)
|
95
6
|
end
|
96
7
|
end
|
97
|
-
|
98
|
-
class Iterm2mintty::BGColor
|
99
|
-
include Iterm2mintty::MinttyColor
|
100
|
-
include Iterm2mintty::Colorable
|
101
|
-
attr_reader :color
|
102
|
-
|
103
|
-
def initialize(color:)
|
104
|
-
@color = color
|
105
|
-
end
|
106
|
-
|
107
|
-
def name
|
108
|
-
"BackgroundColour"
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
class Iterm2mintty::CursorColor
|
113
|
-
include Iterm2mintty::MinttyColor
|
114
|
-
include Iterm2mintty::Colorable
|
115
|
-
attr_reader :color
|
116
|
-
|
117
|
-
def initialize(color:)
|
118
|
-
@color = color
|
119
|
-
end
|
120
|
-
|
121
|
-
def name
|
122
|
-
"CursorColour"
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
class Iterm2mintty::Color < Struct.new(:r, :g, :b)
|
127
|
-
end
|
File without changes
|
data/test/helper.rb
ADDED
data/test/test_cli.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "helper"
|
2
|
+
require "iterm2mintty/cli"
|
3
|
+
|
4
|
+
module Iterm2mintty
|
5
|
+
class CLITest < MiniTest::Test
|
6
|
+
def test_run
|
7
|
+
io = MiniTest::Mock.new
|
8
|
+
args = ["test/fixtures/Hybrid.itermcolors"]
|
9
|
+
|
10
|
+
io.expect("puts", String.new, [String])
|
11
|
+
io.expect("close_on_exec?", false)
|
12
|
+
|
13
|
+
CLI.new(args, io: io).run
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "helper"
|
2
|
+
require "iterm2mintty/converter"
|
3
|
+
|
4
|
+
module Iterm2mintty
|
5
|
+
class ConverterTest < MiniTest::Test
|
6
|
+
def setup
|
7
|
+
@to = MiniTest::Mock.new
|
8
|
+
@from = MiniTest::Mock.new
|
9
|
+
@source = MiniTest::Mock.new
|
10
|
+
@theme_components = [ThemeComponent.new]
|
11
|
+
|
12
|
+
@converter = Converter.new(to: @to, from: @from)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_call
|
16
|
+
@to.expect(:output, String.new)
|
17
|
+
@to.expect(:components=, @to, [@theme_components])
|
18
|
+
|
19
|
+
@from.expect(:components, @theme_components)
|
20
|
+
@from.expect(:from_source, @from, [@source])
|
21
|
+
|
22
|
+
@converter.call(@source)
|
23
|
+
|
24
|
+
assert @to.verify
|
25
|
+
assert @from.verify
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require "helper"
|
2
|
+
require "iterm2mintty/iterm2_theme_parser"
|
3
|
+
|
4
|
+
module Iterm2mintty
|
5
|
+
class Iterm2ThemeParserTest < MiniTest::Test
|
6
|
+
def setup
|
7
|
+
itermcolors = Pathname.new("test/fixtures/Hybrid.itermcolors")
|
8
|
+
@parser = Iterm2ThemeParser.new(itermcolors)
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_build
|
12
|
+
built_components = @parser.build
|
13
|
+
components = [
|
14
|
+
BlackComponent.new(42, 46, 51),
|
15
|
+
RedComponent.new(183, 77, 80),
|
16
|
+
BoldGreenComponent.new(120, 131, 49),
|
17
|
+
BoldYellowComponent.new(229, 137, 79),
|
18
|
+
BoldBlueComponent.new(75, 107, 136),
|
19
|
+
BoldMagentaComponent.new(110, 79, 121),
|
20
|
+
BoldCyanComponent.new(77, 123, 115),
|
21
|
+
BoldWhiteComponent.new(90, 97, 105),
|
22
|
+
GreenComponent.new(179, 190, 90),
|
23
|
+
YellowComponent.new(227, 181, 94),
|
24
|
+
BlueComponent.new(109, 144, 176),
|
25
|
+
MagentaComponent.new(160, 126, 171),
|
26
|
+
CyanComponent.new(127, 190, 179),
|
27
|
+
WhiteComponent.new(181, 184, 182),
|
28
|
+
BoldBlackComponent.new(29, 30, 33),
|
29
|
+
BoldRedComponent.new(140, 45, 50),
|
30
|
+
BGColorComponent.new(22, 23, 24),
|
31
|
+
CursorColorComponent.new(183, 188, 185),
|
32
|
+
FGColorComponent.new(183, 188, 185),
|
33
|
+
]
|
34
|
+
|
35
|
+
assert_equal components, built_components
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_red
|
39
|
+
red = @parser.red({"Red Component" => "1.0"})
|
40
|
+
assert_equal red, 255
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_green
|
44
|
+
green = @parser.green({"Green Component" => "1.0"})
|
45
|
+
assert_equal green, 255
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_blue
|
49
|
+
blue = @parser.blue({"Blue Component" => "1.0"})
|
50
|
+
assert_equal blue, 255
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/test/test_iterm2mintty.rb
CHANGED
@@ -1,12 +1,8 @@
|
|
1
|
-
require "
|
2
|
-
require "iterm2mintty"
|
3
|
-
require "pathname"
|
1
|
+
require "helper"
|
4
2
|
|
5
3
|
class Iterm2minttyTest < MiniTest::Test
|
6
4
|
def setup
|
7
|
-
@
|
8
|
-
pathname: Pathname.new("test/Hybrid.itermcolors")
|
9
|
-
)
|
5
|
+
@path = Pathname.new("test/fixtures/Hybrid.itermcolors")
|
10
6
|
end
|
11
7
|
|
12
8
|
def test_convert
|
@@ -33,22 +29,6 @@ CursorColour= 183, 188, 185
|
|
33
29
|
ForegroundColour= 183, 188, 185
|
34
30
|
MINTTYRC
|
35
31
|
|
36
|
-
assert_equal minttyrc,
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
class Iterm2mintty
|
41
|
-
class ANSIColorTest < MiniTest::Test
|
42
|
-
def setup
|
43
|
-
@black = ANSIColor.new(number: 0, color: Color.new(0, 0, 0))
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_name
|
47
|
-
assert_equal "Black", @black.name
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_to_mintty
|
51
|
-
assert_equal "Black= 0, 0, 0", @black.to_mintty
|
52
|
-
end
|
32
|
+
assert_equal minttyrc, Iterm2mintty.convert(@path)
|
53
33
|
end
|
54
34
|
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require "helper"
|
2
|
+
require "iterm2mintty/mintty_theme"
|
3
|
+
|
4
|
+
module Iterm2mintty
|
5
|
+
class MinttyThemeTest < MiniTest::Test
|
6
|
+
def setup
|
7
|
+
@components = [
|
8
|
+
BlackComponent.new(0, 0, 0),
|
9
|
+
RedComponent.new(170, 0, 0),
|
10
|
+
GreenComponent.new(0, 170, 0),
|
11
|
+
YellowComponent.new(170, 85, 0),
|
12
|
+
BlueComponent.new(0, 0, 170),
|
13
|
+
MagentaComponent.new(170, 0, 170),
|
14
|
+
CyanComponent.new(0, 170, 170),
|
15
|
+
WhiteComponent.new(170, 170, 170),
|
16
|
+
BoldBlackComponent.new(85, 85, 85),
|
17
|
+
BoldRedComponent.new(255, 85, 85),
|
18
|
+
BoldGreenComponent.new(85, 255, 85),
|
19
|
+
BoldYellowComponent.new(255, 255, 85),
|
20
|
+
BoldBlueComponent.new(85, 85, 255),
|
21
|
+
BoldMagentaComponent.new(255, 85, 255),
|
22
|
+
BoldCyanComponent.new(85, 255, 255),
|
23
|
+
BoldWhiteComponent.new(255, 255, 255),
|
24
|
+
BGColorComponent.new(0, 0, 0),
|
25
|
+
FGColorComponent.new(255, 255, 255),
|
26
|
+
CursorColorComponent.new(255, 255, 255)
|
27
|
+
]
|
28
|
+
|
29
|
+
@mintty_theme = MinttyTheme.new(@components)
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_component_to_config
|
33
|
+
output_line = MinttyTheme.new.component_to_config(@components.first)
|
34
|
+
|
35
|
+
assert_equal output_line, "Black= 0, 0, 0"
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_output
|
39
|
+
output = <<-OUTPUT
|
40
|
+
Black= 0, 0, 0
|
41
|
+
Red= 170, 0, 0
|
42
|
+
Green= 0, 170, 0
|
43
|
+
Yellow= 170, 85, 0
|
44
|
+
Blue= 0, 0, 170
|
45
|
+
Magenta= 170, 0, 170
|
46
|
+
Cyan= 0, 170, 170
|
47
|
+
White= 170, 170, 170
|
48
|
+
BoldBlack= 85, 85, 85
|
49
|
+
BoldRed= 255, 85, 85
|
50
|
+
BoldGreen= 85, 255, 85
|
51
|
+
BoldYellow= 255, 255, 85
|
52
|
+
BoldBlue= 85, 85, 255
|
53
|
+
BoldMagenta= 255, 85, 255
|
54
|
+
BoldCyan= 85, 255, 255
|
55
|
+
BoldWhite= 255, 255, 255
|
56
|
+
BackgroundColour= 0, 0, 0
|
57
|
+
ForegroundColour= 255, 255, 255
|
58
|
+
CursorColour= 255, 255, 255
|
59
|
+
OUTPUT
|
60
|
+
|
61
|
+
assert_equal output, @mintty_theme.output
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iterm2mintty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Field
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -68,9 +68,21 @@ files:
|
|
68
68
|
- bin/iterm2mintty
|
69
69
|
- iterm2mintty.gemspec
|
70
70
|
- lib/iterm2mintty.rb
|
71
|
+
- lib/iterm2mintty/cli.rb
|
72
|
+
- lib/iterm2mintty/converter.rb
|
73
|
+
- lib/iterm2mintty/iterm2_theme.rb
|
74
|
+
- lib/iterm2mintty/iterm2_theme_parser.rb
|
75
|
+
- lib/iterm2mintty/mintty_theme.rb
|
76
|
+
- lib/iterm2mintty/theme.rb
|
77
|
+
- lib/iterm2mintty/theme_component.rb
|
71
78
|
- lib/iterm2mintty/version.rb
|
72
|
-
- test/Hybrid.itermcolors
|
79
|
+
- test/fixtures/Hybrid.itermcolors
|
80
|
+
- test/helper.rb
|
81
|
+
- test/test_cli.rb
|
82
|
+
- test/test_converter.rb
|
83
|
+
- test/test_iterm2_theme.rb
|
73
84
|
- test/test_iterm2mintty.rb
|
85
|
+
- test/test_mintty_theme.rb
|
74
86
|
homepage: http://www.github.com/bobcats/iterm2mintty
|
75
87
|
licenses:
|
76
88
|
- MIT
|
@@ -81,20 +93,25 @@ require_paths:
|
|
81
93
|
- lib
|
82
94
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
95
|
requirements:
|
84
|
-
- - "
|
96
|
+
- - "~>"
|
85
97
|
- !ruby/object:Gem::Version
|
86
|
-
version: '
|
98
|
+
version: '2.1'
|
87
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
100
|
requirements:
|
89
|
-
- - "
|
101
|
+
- - ">"
|
90
102
|
- !ruby/object:Gem::Version
|
91
|
-
version:
|
103
|
+
version: 1.3.1
|
92
104
|
requirements: []
|
93
105
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.
|
106
|
+
rubygems_version: 2.4.5
|
95
107
|
signing_key:
|
96
108
|
specification_version: 4
|
97
109
|
summary: Tool for converting terminal themes from iTerm2 to mintty
|
98
110
|
test_files:
|
99
|
-
- test/Hybrid.itermcolors
|
111
|
+
- test/fixtures/Hybrid.itermcolors
|
112
|
+
- test/helper.rb
|
113
|
+
- test/test_cli.rb
|
114
|
+
- test/test_converter.rb
|
115
|
+
- test/test_iterm2_theme.rb
|
100
116
|
- test/test_iterm2mintty.rb
|
117
|
+
- test/test_mintty_theme.rb
|