pry-theme 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +17 -0
- data/README.md +2 -6
- data/examples/pry-classic.prytheme +2 -2
- data/lib/pry-theme/commands.rb +32 -0
- data/lib/pry-theme/helper.rb +14 -0
- data/lib/pry-theme/version.rb +1 -1
- data/lib/pry-theme/when_started_hook.rb +6 -6
- data/lib/pry-theme.rb +19 -10
- data/lib/rubygems_plugin.rb +8 -3
- data/pry-theme.gemspec +1 -1
- metadata +4 -3
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,23 @@
|
|
1
1
|
Pry Theme changelog
|
2
2
|
===================
|
3
3
|
|
4
|
+
### v0.0.8 (July 02, 2012)
|
5
|
+
|
6
|
+
* **IMPORTANT**: Changed directory where to store themes! Themes now live in
|
7
|
+
`$HOME/.pry/themes` directory on Mac OS and GNU/Linux, both. Do not forget
|
8
|
+
to delete or move your themes form the old path (On Mac OS it is
|
9
|
+
`$HOME/Library/Application Support/pry-theme` and on GNU/Linux it is
|
10
|
+
`$HOME/.pry/themes`).
|
11
|
+
* On some operating systems Pry Theme was failing to detect correct config path.
|
12
|
+
Fixed.
|
13
|
+
* Fixed wrong behaviour, when uninstalling an unrelated gem. Pry Theme asked to
|
14
|
+
uninstall themes every time you wanted to uninstall _any_ gem.
|
15
|
+
* Fixed a typo in `pry-classic` theme, which was preventing to set `delimiter`
|
16
|
+
parameter to a string.
|
17
|
+
* Fixed wrong convertation of theme files.
|
18
|
+
* Implemented `--list` (`-l`) option, which displays a list of all installed
|
19
|
+
themes.
|
20
|
+
|
4
21
|
### v0.0.7 (June 30, 2012)
|
5
22
|
|
6
23
|
* **HOTFIX**: v0.0.6 is broken (because of my inattentiveness).
|
data/README.md
CHANGED
@@ -58,13 +58,9 @@ Creating new themes isn't hard. [Check out Pry Theme Wiki article on that][new_t
|
|
58
58
|
Theme files must have `.prytheme` extension. Check out [Pry Theme Collection][ptc],
|
59
59
|
if you want to find some themes other than default ones.
|
60
60
|
|
61
|
-
* On GNU/Linux
|
61
|
+
* On GNU/Linux and Mac OS
|
62
62
|
|
63
|
-
Put your theme file in `$
|
64
|
-
|
65
|
-
* On Mac OS
|
66
|
-
|
67
|
-
Put your theme file in `$HOME/Library/Application Support/pry-theme` directory.
|
63
|
+
Put your theme file in `$HOME/.pry/themes` directory.
|
68
64
|
|
69
65
|
And don't forget to adjust your `.pryrc`!
|
70
66
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
meta:
|
3
3
|
theme-name : pry-classic
|
4
|
-
version :
|
4
|
+
version : 2
|
5
5
|
color-depth : 8
|
6
6
|
description : Based on Kornelius Kalnbach's default CodeRay's color theme.
|
7
7
|
author : Kyrylo Silin <kyrylosilin@gmail.com>
|
@@ -33,5 +33,5 @@ theme:
|
|
33
33
|
self : green
|
34
34
|
modifier : green (b)
|
35
35
|
escape : cyan (b)
|
36
|
-
|
36
|
+
delimiter : green (b)
|
37
37
|
symbol : green (b)
|
data/lib/pry-theme/commands.rb
CHANGED
@@ -2,6 +2,7 @@ module PryTheme
|
|
2
2
|
Commands = Pry::CommandSet.new do
|
3
3
|
|
4
4
|
create_command "pry-theme", "Manage your Pry themes." do
|
5
|
+
include PryTheme::Helper
|
5
6
|
|
6
7
|
banner <<-BANNER
|
7
8
|
Usage: pry-theme [OPTIONS] [--help]
|
@@ -22,6 +23,10 @@ module PryTheme
|
|
22
23
|
|
23
24
|
pry-theme -t
|
24
25
|
|
26
|
+
Show a list with currently installed themes
|
27
|
+
|
28
|
+
pry-theme --list
|
29
|
+
|
25
30
|
Wiki: https://github.com/kyrylo/pry-theme/wiki/Pry-Theme-CLI
|
26
31
|
BANNER
|
27
32
|
|
@@ -29,6 +34,7 @@ module PryTheme
|
|
29
34
|
opt.on :a, "all-colors", "Show all available 8/256 colors."
|
30
35
|
opt.on :c, "color", "Show information about a specific color (256)."
|
31
36
|
opt.on :t, "test", "Test your current theme", :argument => false
|
37
|
+
opt.on :l, "list", "Show a list with all available themes", :argument => false
|
32
38
|
end
|
33
39
|
|
34
40
|
def process
|
@@ -38,6 +44,8 @@ module PryTheme
|
|
38
44
|
show_specific_color
|
39
45
|
elsif opts.t?
|
40
46
|
test_theme
|
47
|
+
elsif opts.l?
|
48
|
+
show_list
|
41
49
|
elsif args[0] =~ /\A\w+-?\w+\z/
|
42
50
|
switch_to_theme
|
43
51
|
end
|
@@ -108,6 +116,30 @@ end
|
|
108
116
|
|
109
117
|
output.puts colorize_code(example)
|
110
118
|
end
|
119
|
+
|
120
|
+
def show_list
|
121
|
+
old_theme = PryTheme.current_theme.dup
|
122
|
+
|
123
|
+
each_theme_in(THEME_DIR) do |theme, index, all_themes_num|
|
124
|
+
theme.sub!(/\.prytheme\z/, "")
|
125
|
+
PryTheme.set_theme(theme)
|
126
|
+
|
127
|
+
chunk = <<-CHUNK
|
128
|
+
class PickMe
|
129
|
+
def please
|
130
|
+
@i, @@beg, you = 10_000, 400.00, "please!"
|
131
|
+
end
|
132
|
+
end
|
133
|
+
CHUNK
|
134
|
+
|
135
|
+
output.puts "\e[038;0;1m[#{theme}]\e[0m#{ " *" if theme == old_theme }"
|
136
|
+
output.puts "---"
|
137
|
+
output.puts colorize_code(chunk)
|
138
|
+
output.puts unless index+1 == all_themes_num
|
139
|
+
end
|
140
|
+
ensure
|
141
|
+
PryTheme.set_theme(old_theme)
|
142
|
+
end
|
111
143
|
end
|
112
144
|
|
113
145
|
end
|
data/lib/pry-theme/version.rb
CHANGED
@@ -2,18 +2,18 @@ require 'fileutils'
|
|
2
2
|
|
3
3
|
module PryTheme
|
4
4
|
class WhenStartedHook
|
5
|
+
include PryTheme::Helper
|
5
6
|
|
6
7
|
def call(target, options, _pry_)
|
7
|
-
|
8
|
+
FileUtils.mkdir_p(THEME_DIR) unless File.exists?(THEME_DIR)
|
8
9
|
|
9
|
-
(
|
10
|
-
unless File.exists?(File.join(THEME_DIR,
|
11
|
-
FileUtils.cp(File.join(EXAMPLES_ROOT,
|
10
|
+
each_theme_in(EXAMPLES_ROOT) do |theme, _, _|
|
11
|
+
unless File.exists?(File.join(THEME_DIR, theme))
|
12
|
+
FileUtils.cp(File.join(EXAMPLES_ROOT, theme), THEME_DIR)
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
15
|
-
|
16
|
-
PryTheme.set_theme(theme_name)
|
16
|
+
PryTheme.set_theme(Pry.config.theme)
|
17
17
|
end
|
18
18
|
|
19
19
|
end
|
data/lib/pry-theme.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'pry-theme/version'
|
2
|
+
require 'pry-theme/helper'
|
2
3
|
require 'pry-theme/commands'
|
3
4
|
require 'pry-theme/palette'
|
4
5
|
require 'pry-theme/theme'
|
@@ -18,23 +19,31 @@ module PryTheme
|
|
18
19
|
|
19
20
|
# The root path for the directory with configuration files for OS you're using.
|
20
21
|
CONFIG_DIR = case RbConfig::CONFIG["host_os"]
|
21
|
-
when /darwin/
|
22
|
-
File.join(ENV["HOME"], "Library", "Application Support")
|
23
|
-
when /linux/
|
24
|
-
ENV["XDG_CONFIG_HOME"]
|
25
22
|
when /mingw|mswin/
|
26
|
-
ENV["APPDATA"]
|
23
|
+
File.join(ENV["APPDATA"], "pry-theme")
|
24
|
+
else
|
25
|
+
# /darwin|linux/ and friends.
|
26
|
+
File.join(ENV["HOME"], ".pry")
|
27
27
|
end
|
28
28
|
|
29
29
|
# Pry themes' directory.
|
30
|
-
THEME_DIR = File.join(CONFIG_DIR, "
|
30
|
+
THEME_DIR = File.join(CONFIG_DIR, "themes")
|
31
|
+
|
32
|
+
# The name of the default theme of Pry Theme.
|
33
|
+
DEFAULT_THEME_NAME = "pry-classic"
|
31
34
|
|
32
35
|
def self.set_theme(theme_name)
|
33
|
-
|
36
|
+
theme = PryTheme.convert(theme_name)
|
37
|
+
if theme ||= PryTheme.convert(theme_name = DEFAULT_THEME_NAME)
|
34
38
|
::CodeRay::Encoders::Terminal::TOKEN_COLORS.merge!(theme)
|
39
|
+
@current_theme = theme_name
|
35
40
|
end
|
36
41
|
end
|
37
42
|
|
43
|
+
def self.current_theme
|
44
|
+
@current_theme
|
45
|
+
end
|
46
|
+
|
38
47
|
def self.convert(theme_name)
|
39
48
|
begin
|
40
49
|
theme = Theme.new(theme_name)
|
@@ -124,11 +133,11 @@ module PryTheme
|
|
124
133
|
|
125
134
|
# Uh oh :(
|
126
135
|
notation = if !color_fg
|
127
|
-
"38;0
|
136
|
+
"38;0"
|
128
137
|
elsif palette.notation
|
129
138
|
palette.notation[0..-2]
|
130
139
|
else
|
131
|
-
|
140
|
+
nil
|
132
141
|
end
|
133
142
|
|
134
143
|
[notation, color_fg, formatting, color_bg].flatten.compact.join(";")
|
@@ -144,7 +153,7 @@ module PryTheme
|
|
144
153
|
|
145
154
|
def self.install_gem_hooks
|
146
155
|
Gem.post_uninstall do |u|
|
147
|
-
Uninstaller.run(u)
|
156
|
+
Uninstaller.run(u) if u.spec.name == "pry-theme"
|
148
157
|
end
|
149
158
|
end
|
150
159
|
|
data/lib/rubygems_plugin.rb
CHANGED
data/pry-theme.gemspec
CHANGED
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.version = PryTheme::VERSION
|
6
6
|
s.date = Time.now.strftime('%Y-%m-%d')
|
7
7
|
s.summary = "Easy way to customize your Pry colors"
|
8
|
-
s.description = "The plugin enables color theme for your Pry. No more pryrc bustling."
|
8
|
+
s.description = "The plugin enables color theme support for your Pry. No more .pryrc bustling."
|
9
9
|
s.author = "Kyrylo Silin"
|
10
10
|
s.email = "kyrylosilin@gmail.com"
|
11
11
|
s.homepage = "https://github.com/kyrylo/pry-theme"
|
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.
|
4
|
+
version: 0.0.8
|
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-
|
12
|
+
date: 2012-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pry
|
@@ -27,7 +27,7 @@ dependencies:
|
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0.9'
|
30
|
-
description: The plugin enables color theme for your Pry. No more pryrc bustling.
|
30
|
+
description: The plugin enables color theme support for your Pry. No more .pryrc bustling.
|
31
31
|
email: kyrylosilin@gmail.com
|
32
32
|
executables: []
|
33
33
|
extensions: []
|
@@ -41,6 +41,7 @@ files:
|
|
41
41
|
- examples/pry-modern.prytheme
|
42
42
|
- lib/pry-theme.rb
|
43
43
|
- lib/pry-theme/commands.rb
|
44
|
+
- lib/pry-theme/helper.rb
|
44
45
|
- lib/pry-theme/palette.rb
|
45
46
|
- lib/pry-theme/theme.rb
|
46
47
|
- lib/pry-theme/uninstaller.rb
|