pry-theme 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,6 +1,23 @@
1
1
  Pry Theme changelog
2
2
  ===================
3
3
 
4
+ ### v0.0.10 (July 07, 2012)
5
+
6
+ * Themes can use any color from 256-color palette as background color. Before
7
+ this release you could use only 8 colors;
8
+ * Changed command flag `--list --remote` to `--remote-list`. Now, to get a list
9
+ of themes from Pry Theme Collection, you type `pry-theme -r` or
10
+ `pry-theme --remote-list` instead of `pry-theme -lr`;
11
+ * Limited theme descriptions to 80 characters;
12
+ * Added "content" subparameter for "string" parameter (`.prytheme` syntax).
13
+ * Changed the appearance of output from `pry-theme --all-colors` command, so it
14
+ displays data in 3 columns instead of 1;
15
+ * Changed some colors of Railscasts and Tomorrow themes;
16
+ * Fixed bug when a user installs fresh gem and gets an improper warning, because
17
+ `Pry.config.theme` is not defined. Added a proper notification message for
18
+ such situations;
19
+ * Renamed default theme `charcoal-black` to `pry-cold` (they are not the same).
20
+
4
21
  ### v0.0.9 (July 05, 2012)
5
22
 
6
23
  * **HOT**: Added `--install` flag. Now, you can easily install Pry themes from
data/README.md CHANGED
@@ -9,6 +9,11 @@ Description
9
9
  Pry Theme is a plugin for [Pry][pry], which helps you to customize your Pry
10
10
  colors via `prytheme` files.
11
11
 
12
+ ![Railscasts](/kyrylo/pry-theme/raw/master/screenshots/railscasts.png)
13
+ ![Solarized](/kyrylo/pry-theme/raw/master/screenshots/solarized.png)
14
+ ![Tomorrow](/kyrylo/pry-theme/raw/master/screenshots/tomorrow.png)
15
+ ![Zenburn](/kyrylo/pry-theme/raw/master/screenshots/zenburn.png)
16
+
12
17
  Installation
13
18
  ------------
14
19
 
@@ -23,9 +28,8 @@ Synopsis
23
28
  ### Theme files
24
29
 
25
30
  Theme file is a valid YAML file, which has `.prytheme` extension (for example,
26
- `beautiful.prytheme`). Pry Theme ships only with two themes: `pry-classic` and
27
- `pry-modern`. In order to set up the desired theme, add the following line into
28
- your `.pryrc`:
31
+ `beautiful.prytheme`). In order to set up the desired theme, add the following
32
+ line into your `.pryrc`:
29
33
 
30
34
  Pry.config.theme = "theme-name"
31
35
 
@@ -101,7 +105,9 @@ Credits
101
105
  -------
102
106
 
103
107
  * Thanks to [banister][johndogg] for bringing the plugin in masses and
104
- contributing a bunch of themes.
108
+ contributing a bunch of themes;
109
+ * Thanks to Karandashev for "Puzzle" font;
110
+ * Thanks to Creatica for "Dited" font.
105
111
 
106
112
  License
107
113
  -------
data/lib/pry-theme.rb CHANGED
@@ -6,7 +6,6 @@ require 'pry-theme/theme'
6
6
  require 'pry-theme/when_started_hook'
7
7
  require 'pry-theme/uninstaller'
8
8
 
9
- require 'pry'
10
9
  require 'yaml'
11
10
 
12
11
  module PryTheme
@@ -15,7 +14,7 @@ module PryTheme
15
14
  ROOT = File.expand_path(File.dirname(__FILE__))
16
15
 
17
16
  # The root path for PryTheme examples.
18
- EXAMPLES_ROOT = File.join(ROOT, "..", "examples")
17
+ EXAMPLES_ROOT = File.join(ROOT, "..", "themes")
19
18
 
20
19
  # The root path for the directory with configuration files for OS you're using.
21
20
  CONFIG_DIR = case RbConfig::CONFIG["host_os"]
@@ -51,6 +50,10 @@ module PryTheme
51
50
  rescue NoThemeError => no_theme_error
52
51
  warn no_theme_error
53
52
  return
53
+ rescue ThemeDescriptionError => long_descr
54
+ Pry.output.puts long_descr
55
+ Pry.output.puts "Using #{DEFAULT_THEME_NAME} theme."
56
+ return
54
57
  end
55
58
 
56
59
  palette = Palette.new(theme.color_depth)
@@ -100,7 +103,7 @@ module PryTheme
100
103
  \s?
101
104
  on\s
102
105
  (
103
- [a-z]+(0[1-9])?
106
+ \w+(0[1-9])?
104
107
  )
105
108
  )?
106
109
 
@@ -110,17 +113,7 @@ module PryTheme
110
113
  if color
111
114
  m = color.match(color_pattern)
112
115
 
113
- color_fg = if $2
114
- c = palette.colors.find do |color|
115
- color.human == $2.to_sym
116
- end
117
-
118
- if c
119
- c.term
120
- else
121
- raise NoColorError
122
- end
123
- end
116
+ color_fg = find_color($2, palette) { |c| c.term }
124
117
 
125
118
  formatting = if $5
126
119
  formatting = $5.each_char.map do |ch|
@@ -128,8 +121,12 @@ module PryTheme
128
121
  end
129
122
  end
130
123
 
131
- color_bg = if $7
132
- Formatting::BACKGROUNDS[$7]
124
+ color_bg = find_color($7, palette) do |c|
125
+ if palette.color_depth == 256
126
+ "48;5;#{c.term}"
127
+ else
128
+ Formatting::BACKGROUNDS[c.human.to_s]
129
+ end
133
130
  end
134
131
 
135
132
  # Uh oh :(
@@ -149,7 +146,7 @@ module PryTheme
149
146
  "38;0;0"
150
147
  end
151
148
  rescue NoColorError => e
152
- Pry.output.puts "#{e}: wrong color value: `#{$2}`. Typo?"
149
+ Pry.output.puts "#{e}: wrong color value: `#{color}`. Typo?"
153
150
  end
154
151
 
155
152
  def self.install_gem_hooks
@@ -158,6 +155,20 @@ module PryTheme
158
155
  end
159
156
  end
160
157
 
158
+ def self.find_color(color, palette, &block)
159
+ if color
160
+ c = palette.colors.find do |palette_color|
161
+ palette_color.human == color.to_sym
162
+ end
163
+
164
+ if c
165
+ block.call(c)
166
+ else
167
+ raise NoColorError
168
+ end
169
+ end
170
+ end
171
+
161
172
  end
162
173
 
163
174
  # Apply a theme of a user from their theme file.
@@ -17,7 +17,7 @@ module PryTheme
17
17
 
18
18
  Show all themes from Pry Theme Collection.
19
19
 
20
- pry-theme -lr
20
+ pry-theme -r
21
21
 
22
22
  Install a theme from Pry Theme Collection.
23
23
 
@@ -31,12 +31,12 @@ module PryTheme
31
31
  BANNER
32
32
 
33
33
  def options(opt)
34
- opt.on :a, "all-colors", "Show all available 8/256 colors."
35
- opt.on :c, "color", "Show information about a specific color (256)."
36
- opt.on :t, "test", "Test your current theme", :argument => false
37
- opt.on :l, "list", "Show a list of installed themes", :argument => false
38
- opt.on :r, "remote", "Show a list of themes from Pry Theme Collection", :argument => false
39
- opt.on :i, "install", "Install a theme from Pry Theme Collection"
34
+ opt.on :a, "all-colors", "Show all available 8/256 colors."
35
+ opt.on :c, "color", "Show information about a specific color (256)."
36
+ opt.on :t, "test", "Test your current theme", :argument => false
37
+ opt.on :l, "list", "Show a list of installed themes", :argument => false
38
+ opt.on :r, "remote-list", "Show a list of themes from Pry Theme Collection", :argument => false
39
+ opt.on :i, "install", "Install a theme from Pry Theme Collection"
40
40
  end
41
41
 
42
42
  def process
@@ -47,7 +47,9 @@ module PryTheme
47
47
  elsif opts.t?
48
48
  test_theme
49
49
  elsif opts.l?
50
- opts.r? ? show_remote_list : show_list
50
+ show_list
51
+ elsif opts.r?
52
+ show_remote_list
51
53
  elsif opts.i?
52
54
  install_theme
53
55
  elsif args[0] =~ /\A\w+-?\w+\z/
@@ -69,7 +71,22 @@ module PryTheme
69
71
  end
70
72
 
71
73
  def show_palette_colors
72
- lputs Palette.new(args[0]).to_a.join("\n")
74
+ lputs in_columns(Palette.new(args[0]).to_a)
75
+ end
76
+
77
+ def in_columns(list, cols=3)
78
+ color_table = []
79
+
80
+ list.each_slice(cols) do |slice|
81
+ slice.each do |c|
82
+ color = c.scan(/(\e\[[[0-9];]+m)(\w+)(\e\[0m)(:)(\e\[[[0-9];]+m)(\w+)(\e\[0m)/).flatten
83
+ color[1] = color[1].ljust(3)
84
+ color[-2] = color[-2].ljust(22)
85
+ color_table << color
86
+ end
87
+ color_table << "\n"
88
+ end
89
+ color_table.join
73
90
  end
74
91
 
75
92
  def show_specific_color
@@ -117,7 +134,7 @@ module PryTheme
117
134
  end
118
135
  end
119
136
  end
120
- # Testing "#{PryTheme.current_theme}" theme complete.
137
+ # "#{PryTheme.current_theme}" theme.
121
138
  TEST
122
139
 
123
140
  lputs colorize_code(example)
@@ -17,7 +17,14 @@ module PryTheme
17
17
  @name = meta["theme-name"]
18
18
  @version = meta["version"]
19
19
  @color_depth = meta["color-depth"].to_i
20
- @description = meta["description"]
20
+
21
+ # Forbid too long descriptions.
22
+ if @description = meta["description"]
23
+ if (size = @description.size) > 80
24
+ raise ThemeDescriptionError, "Description of #{name} theme is too long (#{size}). Max size is 80 characters."
25
+ end
26
+ end
27
+
21
28
  @author = meta["author"]
22
29
  @scheme = theme["theme"]
23
30
  end
@@ -33,4 +40,5 @@ module PryTheme
33
40
  end
34
41
 
35
42
  class NoThemeError < StandardError; end
43
+ class ThemeDescriptionError < StandardError; end
36
44
  end
@@ -1,3 +1,3 @@
1
1
  module PryTheme
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
@@ -23,11 +23,15 @@ module PryTheme
23
23
  end
24
24
  end
25
25
 
26
- if Helper.installed?(Pry.config.theme)
27
- PryTheme.set_theme(Pry.config.theme)
26
+ if Pry.config.theme
27
+ if Helper.installed?(Pry.config.theme)
28
+ PryTheme.set_theme(Pry.config.theme)
29
+ else
30
+ _pry_.output.puts %{Can't find "#{Pry.config.theme}" theme. Using "#{DEFAULT_THEME_NAME}"}
31
+ PryTheme.set_theme(DEFAULT_THEME_NAME)
32
+ end
28
33
  else
29
- _pry_.output.puts %{Can't find "#{Pry.config.theme}" theme. Using "#{DEFAULT_THEME_NAME}"}
30
- PryTheme.set_theme(DEFAULT_THEME_NAME)
34
+ _pry_.output.puts %{Can't find `Pry.config.theme` definition in your `~/.pryrc`.\nUsing "pry-classic" theme now.}
31
35
  end
32
36
  end
33
37
 
data/pry-theme.gemspec CHANGED
@@ -1,5 +1,4 @@
1
1
  require './lib/pry-theme/version'
2
-
3
2
  Gem::Specification.new do |s|
4
3
  s.name = "pry-theme"
5
4
  s.version = PryTheme::VERSION
Binary file
Binary file
Binary file
Binary file
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  meta:
3
3
  theme-name : github
4
- version : 2
4
+ version : 3
5
5
  color-depth : 256
6
6
  description : Based on github theme
7
7
  author : John Mair
@@ -31,6 +31,7 @@ theme:
31
31
  delimiter : gray02
32
32
  string:
33
33
  self : alizarin
34
+ content : alizarin
34
35
  modifier : alizarin
35
36
  escape : alizarin
36
37
  delimiter : alizarin
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  meta:
3
3
  theme-name : monokai
4
- version : 1
4
+ version : 2
5
5
  color-depth : 256
6
6
  description : Based on Wimer Hazenberg's theme
7
7
  author : Kyrylo Silin <kyrylosilin@gmail.com>
@@ -31,6 +31,7 @@ theme:
31
31
  delimiter : flax
32
32
  string:
33
33
  self : flax
34
+ content : flax
34
35
  modifier : flax
35
36
  escape : flax
36
37
  delimiter : flax
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  meta:
3
3
  theme-name : pry-classic
4
- version : 3
4
+ version : 4
5
5
  color-depth : 8
6
6
  description : Default Pry theme
7
7
  author : Kyrylo Silin <kyrylosilin@gmail.com>, Kornelius Kalnbach
@@ -31,6 +31,7 @@ theme:
31
31
  delimiter : white
32
32
  string:
33
33
  self : green
34
+ content : green
34
35
  modifier : green (b)
35
36
  escape : cyan (b)
36
37
  delimiter : green (b)
@@ -1,17 +1,18 @@
1
1
  ---
2
2
  meta:
3
- theme-name : charcoal-black
4
- version : 3
3
+ theme-name : pry-cold
4
+ version : 1
5
5
  color-depth : 256
6
6
  description : Based on Charcoalblack theme from Emacs
7
- author : John Mair
7
+ author : John Mair,
8
+ Kyrylo Silin <kyrylosilin@gmail.com>
8
9
 
9
10
  theme:
10
11
  class : robin_egg_blue02 (b)
11
12
  class_variable : pale_blue03 (b)
12
13
  comment : light_grey03
13
14
  constant : robin_egg_blue02 (b)
14
- error : tenne (i)
15
+ error : robin_egg_blue02 (bi)
15
16
  float : silver01
16
17
  global_variable : robin_egg_blue02
17
18
  instance_variable : pale_blue03
@@ -20,17 +21,18 @@ theme:
20
21
  method : royal_blue05
21
22
  predefined_constant : robin_egg_blue02 (b)
22
23
  regexp:
23
- self : alizarin
24
- content : alizarin
25
- delimiter : alizarin
26
- modifier : alizarin
27
- function : alizarin
24
+ self : bluish03
25
+ content : bluish03
26
+ delimiter : gray02
27
+ modifier : gray02
28
+ function : gray02
28
29
  shell:
29
30
  self : puce01
30
31
  content : puce01
31
32
  delimiter : gray02
32
33
  string:
33
34
  self : bluish03
35
+ content : bluish03
34
36
  modifier : bluish03
35
37
  escape : bluish03
36
38
  delimiter : bluish03
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  meta:
3
3
  theme-name : pry-modern
4
- version : 2
4
+ version : 3
5
5
  color-depth : 256
6
6
  description : Nifty version of pry-classic
7
7
  author : Kyrylo Silin <kyrylosilin@gmail.com>
@@ -31,6 +31,7 @@ theme:
31
31
  delimiter : white
32
32
  string:
33
33
  self : malachite01
34
+ content : malachite01
34
35
  modifier : malachite01 (b)
35
36
  escape : cyan (b)
36
37
  delimiter : malachite01 (b)
@@ -0,0 +1,40 @@
1
+ ---
2
+ meta:
3
+ theme-name : railscasts
4
+ version : 6
5
+ color-depth : 256
6
+ description : RailsCasts theme
7
+ author : Ryan Fitzgerald,
8
+ John Mair,
9
+ Kyrylo Silin <kyrylosilin@gmail.com>
10
+
11
+ theme:
12
+ class : (d)
13
+ class_variable : robin_egg_blue03
14
+ comment : tan
15
+ constant : (d)
16
+ error : white on maroon
17
+ float : asparagus
18
+ global_variable : robin_egg_blue03
19
+ instance_variable : robin_egg_blue03
20
+ integer : asparagus
21
+ keyword : international_orange
22
+ method : mustard02
23
+ predefined_constant : robin_egg_blue03
24
+ regexp:
25
+ self : orange
26
+ content : asparagus
27
+ delimiter : asparagus
28
+ modifier : asparagus
29
+ function : asparagus
30
+ shell:
31
+ self : asparagus
32
+ content : asparagus
33
+ delimiter : asparagus
34
+ string:
35
+ self : asparagus
36
+ content : asparagus
37
+ modifier : asparagus
38
+ escape : asparagus
39
+ delimiter : asparagus
40
+ symbol : cornflower_blue01
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  meta:
3
3
  theme-name : saturday-night
4
- version : 4
4
+ version : 5
5
5
  color-depth : 256
6
6
  description : A modification of "tommorow night"
7
7
  author : John Mair (banisterfiend)
@@ -31,6 +31,7 @@ theme:
31
31
  delimiter : green
32
32
  string:
33
33
  self : old_gold
34
+ content : old_gold
34
35
  modifier : old_gold
35
36
  escape : old_gold
36
37
  delimiter : old_gold
@@ -1,10 +1,11 @@
1
1
  ---
2
2
  meta:
3
3
  theme-name : solarized
4
- version : 3
4
+ version : 4
5
5
  color-depth : 256
6
6
  description : Precision colors for machines and people
7
- author : Kyrylo Silin <kyrylosilin@gmail.com>, Ethan Schoonover
7
+ author : Kyrylo Silin <kyrylosilin@gmail.com>,
8
+ Ethan Schoonover
8
9
 
9
10
  theme:
10
11
  class : dark_goldenrod
@@ -26,12 +27,13 @@ theme:
26
27
  modifier : titian
27
28
  function : black
28
29
  shell:
29
- self :
30
+ self : robin_egg_blue01
30
31
  content : robin_egg_blue01
31
32
  delimiter : titian
32
33
  string:
33
34
  self : robin_egg_blue01
34
- modifier :
35
- escape :
35
+ content : robin_egg_blue01
36
+ modifier : robin_egg_blue01
37
+ escape : robin_egg_blue01
36
38
  delimiter : titian
37
39
  symbol : robin_egg_blue01
@@ -1,19 +1,20 @@
1
1
  ---
2
2
  meta:
3
3
  theme-name : tomorrow
4
- version : 2
4
+ version : 4
5
5
  color-depth : 256
6
- description : Based on Tomorrow by Chris Kempson
7
- author : John Mair
6
+ description : A theme should not get in your way
7
+ author : John Mair,
8
+ Chris Kempson
8
9
 
9
10
  theme:
10
11
  class : gold
11
- class_variable : flea_belly (b)
12
+ class_variable : alizarin
12
13
  comment : gray03
13
14
  constant : gold
14
- error : tenne (i)
15
- float : silver01
16
- global_variable : dark_peach
15
+ error : tangerine (i)
16
+ float : tangerine
17
+ global_variable : alizarin
17
18
  instance_variable : alizarin
18
19
  integer : tangerine
19
20
  keyword : heliotrope03
@@ -31,6 +32,7 @@ theme:
31
32
  delimiter : gray02
32
33
  string:
33
34
  self : old_gold
35
+ content : old_gold
34
36
  modifier : old_gold
35
37
  escape : old_gold
36
38
  delimiter : old_gold
@@ -31,6 +31,7 @@ theme:
31
31
  delimiter : moss_green
32
32
  string:
33
33
  self : moss_green
34
+ content : moss_green
34
35
  modifier : pale_cornflower_blue
35
36
  escape : moss_green
36
37
  delimiter : moss_green
@@ -1,10 +1,11 @@
1
1
  ---
2
2
  meta:
3
3
  theme-name : zenburn
4
- version : 3
4
+ version : 4
5
5
  color-depth : 256
6
6
  description : A low-contrast color scheme
7
- author : Kyrylo Silin <kyrylosilin@gmail.com>, Jani Nurminen
7
+ author : Kyrylo Silin <kyrylosilin@gmail.com>,
8
+ Jani Nurminen
8
9
 
9
10
  theme:
10
11
  class : dark_peach (b)
@@ -24,14 +25,15 @@ theme:
24
25
  content : puce01
25
26
  delimiter : gray02
26
27
  modifier : gray02
27
- function :
28
+ function : gray02
28
29
  shell:
29
- self :
30
+ self : puce01
30
31
  content : puce01
31
32
  delimiter : gray02
32
33
  string:
33
34
  self : puce01
34
- modifier :
35
- escape :
35
+ content : puce01
36
+ modifier : puce01
37
+ escape : puce01
36
38
  delimiter : gray02
37
39
  symbol : puce01 (b)
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.9
4
+ version: 0.0.10
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-07-05 00:00:00.000000000 Z
12
+ date: 2012-07-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pry
@@ -53,17 +53,6 @@ files:
53
53
  - CHANGELOG.md
54
54
  - LICENSE
55
55
  - README.md
56
- - examples/charcoal-black.prytheme
57
- - examples/github.prytheme
58
- - examples/monokai.prytheme
59
- - examples/pry-classic.prytheme
60
- - examples/pry-modern.prytheme
61
- - examples/railscasts.prytheme
62
- - examples/saturday.prytheme
63
- - examples/solarized.prytheme
64
- - examples/tomorrow.prytheme
65
- - examples/twilight.prytheme
66
- - examples/zenburn.prytheme
67
56
  - lib/pry-theme.rb
68
57
  - lib/pry-theme/commands.rb
69
58
  - lib/pry-theme/helper.rb
@@ -74,6 +63,21 @@ files:
74
63
  - lib/pry-theme/when_started_hook.rb
75
64
  - lib/rubygems_plugin.rb
76
65
  - pry-theme.gemspec
66
+ - screenshots/railscasts.png
67
+ - screenshots/solarized.png
68
+ - screenshots/tomorrow.png
69
+ - screenshots/zenburn.png
70
+ - themes/github.prytheme
71
+ - themes/monokai.prytheme
72
+ - themes/pry-classic.prytheme
73
+ - themes/pry-cold.prytheme
74
+ - themes/pry-modern.prytheme
75
+ - themes/railscasts.prytheme
76
+ - themes/saturday.prytheme
77
+ - themes/solarized.prytheme
78
+ - themes/tomorrow.prytheme
79
+ - themes/twilight.prytheme
80
+ - themes/zenburn.prytheme
77
81
  homepage: https://github.com/kyrylo/pry-theme
78
82
  licenses:
79
83
  - zlib
@@ -1,37 +0,0 @@
1
- ---
2
- meta:
3
- theme-name : railscasts
4
- version : 5
5
- color-depth : 256
6
- description : RailsCasts theme
7
- author : Ryan Fitzgerald, John Mair
8
-
9
- theme:
10
- class : red
11
- class_variable : periwinkle (b)
12
- comment : brass02
13
- constant : red
14
- error : green (u) on maroon
15
- float : lilac01
16
- global_variable : red
17
- instance_variable : periwinkle
18
- integer : cornflower_blue03
19
- keyword : international_orange (b)
20
- method : mustard02 (b)
21
- predefined_constant : sky02
22
- regexp:
23
- self : green
24
- content : green
25
- delimiter : green
26
- modifier : green
27
- function : green
28
- shell:
29
- self : toad_in_love
30
- content : green
31
- delimiter : green
32
- string:
33
- self : pistachio04
34
- modifier : robin_egg_blue01
35
- escape : old_gold
36
- delimiter : pistachio04
37
- symbol : sky02