pry-theme 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,21 +1,30 @@
1
1
  Pry Theme changelog
2
2
  ===================
3
3
 
4
- ### v0.0.5.pre (June 29, 2012)
4
+ ### v0.0.6 (June 30, 2012)
5
5
 
6
- * Added Ruby 1.8.7, JRuby and Ruby Enterprise Edition support.
6
+ * Fixed bug when a `prytheme` attribute has no color value, but with attributes
7
+ (for example, `symbol : (b)`);
8
+ * Fixed bug when a `prytheme` has no color value at all (for example,
9
+ `symbol : `);
10
+ * Add basic checking for a valid color in `prytheme`.
11
+
12
+ ### v0.0.5 (June 29, 2012)
13
+
14
+ * No pre!
15
+ * Added Ruby 1.8.7, JRuby and Ruby Enterprise Edition support;
7
16
  * Fixed 8-color themes bug. We could not even use them in the previous version;
8
- * Added `--test` command, which allows to "test" your theme visually.
17
+ * Added `--test` command, which allows to "test" your theme visually;
9
18
  * Added uninstaller, which basically just asks a user if he or she wants to
10
19
  remove a directory with Pry themes (personally, I hate when software leave
11
- their crap).
12
- * Slightly improved `help` of `pry-theme` command
20
+ their crap);
21
+ * Slightly improved `help` of `pry-theme` command;
13
22
  * Made theme attributes optional. Now, if you are not sure about some parameter
14
23
  in a Pry Theme, you can leave it empty.
15
24
 
16
25
  Last but not least:
17
26
 
18
- * Check out new Wiki! (https://github.com/kyrylo/pry-theme/wiki)
27
+ * Check out new Wiki! (https://github.com/kyrylo/pry-theme/wiki).
19
28
 
20
29
  ### v0.0.4.pre (June 28, 2012)
21
30
 
@@ -7,36 +7,31 @@ meta:
7
7
  author : Kyrylo Silin <kyrylosilin@gmail.com>
8
8
 
9
9
  theme:
10
- binary : magenta (b)
11
- char:
12
- self : cyan
13
- delimiter : blue (b)
14
- class : magenta (b)
15
- class_variable : cyan
16
- comment : blue
17
- constant : blue (bu)
18
- doctype : black (b)
19
- error : yellow (b) on red
20
- float : magenta (b)
21
- global_variable : on green
22
- hex : cyan (b)
23
- integer : blue (b)
24
- keyword : red (b)
25
- method : blue (b)
10
+ class : magenta (b)
11
+ class_variable : cyan
12
+ comment : blue
13
+ constant : blue (bu)
14
+ error : yellow (b) on red
15
+ float : magenta (b)
16
+ global_variable : on green
17
+ instance_variable : (d)
18
+ integer : blue (b)
19
+ keyword : red (b)
20
+ method : blue (b)
26
21
  predefined_constant : cyan (b)
27
22
  regexp:
28
- self : red
29
- content : red
30
- delimiter : red (db)
31
- modifier : magenta (b)
32
- function : (db)
23
+ self : red
24
+ content : red
25
+ delimiter : red (db)
26
+ modifier : magenta (b)
27
+ function : (db)
33
28
  shell:
34
- self : on green
35
- content : (db)
36
- delimiter : white
29
+ self : on green
30
+ content : (db)
31
+ delimiter : white
37
32
  string:
38
- self : green
39
- modifier : green (b)
40
- escape : cyan (b)
41
- delimiter : green (b)
42
- symbol : green (b)
33
+ self : green
34
+ modifier : green (b)
35
+ escape : cyan (b)
36
+ delimite : green (b)
37
+ symbol : green (b)
@@ -7,36 +7,31 @@ meta:
7
7
  author : Kyrylo Silin <kyrylosilin@gmail.com>
8
8
 
9
9
  theme:
10
- binary : magenta (b)
11
- char:
12
- self : cyan
13
- delimiter : blue (b)
14
- class : fuchsia (b)
15
- class_variable : robin_egg_blue04
16
- comment : cerulean_grey01
17
- constant : klein_blue (bu)
18
- doctype : black (b)
19
- error : cerulean_grey02
20
- float : dark_pink01 (b)
21
- global_variable : gold
22
- hex : cyan (b)
23
- integer : robin_egg_blue01 (b)
24
- keyword : chestnut01 (b)
25
- method : grass01 (b)
10
+ class : fuchsia (b)
11
+ class_variable : robin_egg_blue04
12
+ comment : cerulean_grey01
13
+ constant : klein_blue (bu)
14
+ error : cerulean_grey02
15
+ float : dark_pink01 (b)
16
+ global_variable : gold
17
+ instance_variable : (d)
18
+ integer : robin_egg_blue01 (b)
19
+ keyword : chestnut01 (b)
20
+ method : grass01 (b)
26
21
  predefined_constant : cyan (b)
27
22
  regexp:
28
- self : tangerine
29
- content : violaceous03
30
- delimiter : tangerine (db)
31
- modifier : dark_pink01 (b)
32
- function : (db)
23
+ self : tangerine
24
+ content : violaceous03
25
+ delimiter : tangerine (db)
26
+ modifier : dark_pink01 (b)
27
+ function : (db)
33
28
  shell:
34
- self : on green
35
- content : grass01
36
- delimiter : white
29
+ self : on green
30
+ content : grass01
31
+ delimiter : white
37
32
  string:
38
- self : malachite01
39
- modifier : malachite01 (b)
40
- escape : cyan (b)
41
- delimiter : malachite01 (b)
42
- symbol : malachite02 (b)
33
+ self : malachite01
34
+ modifier : malachite01 (b)
35
+ escape : cyan (b)
36
+ delimiter : malachite01 (b)
37
+ symbol : malachite02 (b)
@@ -86,8 +86,10 @@ module PryTheme
86
86
  this_is_integer = 10_000
87
87
 
88
88
  "this_is_string"
89
- 'this is another string'
90
89
 
90
+ TRUE or FALSE or ARGV # <-- Predefined constants
91
+
92
+ @this_is_instance_variable
91
93
  @@this_is_class_variable
92
94
 
93
95
  `echo 'Hello, hi, from "system" call!'`
@@ -96,9 +98,6 @@ module PryTheme
96
98
 
97
99
  /[0-9]{1,3}this is regexp\\w+/xi
98
100
  $1 or $2 or $3333
99
-
100
- nil
101
- self
102
101
  end
103
102
 
104
103
  end
@@ -1,3 +1,3 @@
1
1
  module PryTheme
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/lib/pry-theme.rb CHANGED
@@ -103,7 +103,13 @@ module PryTheme
103
103
  color_fg = if $2
104
104
  palette.colors.find do |color|
105
105
  color.human == $2.to_sym
106
- end.term
106
+ end
107
+
108
+ if c
109
+ c.term
110
+ else
111
+ raise NoColorError unless c
112
+ end
107
113
  end
108
114
 
109
115
  formatting = if $5
@@ -116,9 +122,24 @@ module PryTheme
116
122
  Formatting::BACKGROUNDS[$7]
117
123
  end
118
124
 
119
- notation = palette.notation ? palette.notation[0..-2] : ""
125
+ # Uh oh :(
126
+ notation = if !color_fg
127
+ "38;0;"
128
+ elsif palette.notation
129
+ palette.notation[0..-2]
130
+ else
131
+ ""
132
+ end
133
+
120
134
  [notation, color_fg, formatting, color_bg].flatten.compact.join(";")
135
+ else
136
+ # In cases when a user decided not to provide an argument value in theme,
137
+ # use default color. Not handling this situation results in CodeRay's
138
+ # error ("can't convert nil into String" stuff).
139
+ "38;0;0"
121
140
  end
141
+ rescue NoColorError => e
142
+ Pry.output.puts "#{e}: wrong color value: `#{$2}`. Typo?"
122
143
  end
123
144
 
124
145
  def self.install_gem_hooks
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-29 00:00:00.000000000 Z
12
+ date: 2012-06-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pry