hansi 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1c99a2ac8ce470c64e37c42a2e94af03d80a0fe
4
- data.tar.gz: 8c8e39771a0a0c2fab16b746d937643655b3cdd7
3
+ metadata.gz: 0e5bd3afa496d114756e45864aecb904d1d5137d
4
+ data.tar.gz: d6443b78a92ca5bfdad880b1a611bf96f399f63e
5
5
  SHA512:
6
- metadata.gz: a394c636b3fd0e8d4456377ad2b2c79223374612f9c71cf3a4f24b5df325bca79c01ebd1a9f0057e3155ef428af796f7d70532eb52d7796a2ba1d185347c8cd9
7
- data.tar.gz: 64b7011cbd5a09b5aec138544197f86de4a703f773dcaba9c1c06ba99e6d55b1e54830fd54a0581a67aa039fb739f79f5fe85b801223ecafafcee11386619f4a
6
+ metadata.gz: 2929ffe924bd5c1a1dd7e2c0bc7e0fb0557c396eccac7814afb6805dc258814f5509c7a059ba079ef29c4d2dc1021e84e3244746aa27c89d55331e2254b27ce1
7
+ data.tar.gz: 29510590850dc6f444bcff2a33acc001467c53459199306a100ea2271c4a6cfc8607c20d17d6876ce821b109818c73c402f148cdbda0dbe61f00dd9d1a369e24
@@ -65,7 +65,7 @@ module Hansi
65
65
  else TERMS.keys.detect { |key| TERMS[key].include? term }
66
66
  end
67
67
  end
68
-
68
+
69
69
  def from_xterm
70
70
  terminal_command ? 256 : 16
71
71
  end
@@ -119,9 +119,10 @@ module Hansi
119
119
 
120
120
  def iterm_version
121
121
  @iterm_version ||= env['TERM_PROGRAM_VERSION']
122
- @iterm_version ||= if shell_out? and iterm_path = commands.detect { |c| c["/iTerm.app/Contents/MacOS/iTerm2"] }
123
- info_path = Shellwords.escape(File.expand_path('../../Info', iterm_path))
124
- `defaults read #{info_path} CFBundleVersion`.chomp if system 'which defaults >/dev/null'
122
+ @iterm_version ||= if shell_out? and iterm_path = commands.detect { |c| c["Contents/MacOS/iTerm"] }
123
+ iterm_path = iterm_path[/^(.*) [^ ]+$/, 1] while iterm_path and not File.exist?(iterm_path)
124
+ info_path = File.expand_path('../../Info.plist', iterm_path)
125
+ `defaults read #{Shellwords.escape(info_path)} CFBundleVersion`.chomp if File.exist?(info_path) and system 'which defaults >/dev/null'
125
126
  end
126
127
  rescue Errno::ENOENT
127
128
  end
@@ -41,7 +41,7 @@ module Hansi
41
41
 
42
42
  def merge(other)
43
43
  other_rules = self.class[other].rules
44
- self.class.new(**other_rules, **rules)
44
+ self.class.new(**rules.merge(other_rules))
45
45
  end
46
46
 
47
47
  def to_h
@@ -1,3 +1,3 @@
1
1
  module Hansi
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -40,7 +40,7 @@ describe Hansi::Color do
40
40
  specify { color.to_ansi(mode: Hansi::TRUE_COLOR) .should be == "\e[38;2;255;0;0m" }
41
41
 
42
42
  specify "unknown mode" do
43
- expect { color.to_ansi(mode: 99) }.to raise_error
43
+ expect { color.to_ansi(mode: 99) }.to raise_error(ArgumentError)
44
44
  end
45
45
  end
46
46
  end
@@ -17,6 +17,13 @@ describe Hansi::Theme do
17
17
  end
18
18
  end
19
19
 
20
+ describe :merge do
21
+ specify do
22
+ new_theme = theme.merge(foo: :baz)
23
+ expect(new_theme.rules).to include(foo: :baz)
24
+ end
25
+ end
26
+
20
27
  describe :hash do
21
28
  specify { Hansi::Theme[:default].hash.should be == Hansi::Theme[{}].hash }
22
29
  end
@@ -33,4 +40,4 @@ describe Hansi::Theme do
33
40
  specify { theme.to_css .should be == ".foo, .bar {\n color: #ff0000;\n}\n" }
34
41
  specify { theme.to_css { |name| "##{name}" } .should be == "#foo, #bar {\n color: #ff0000;\n}\n" }
35
42
  end
36
- end
43
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hansi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-23 00:00:00.000000000 Z
11
+ date: 2016-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tool
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  requirements: []
130
130
  rubyforge_project:
131
- rubygems_version: 2.4.3
131
+ rubygems_version: 2.4.4
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: Hipster ANSI color library