pry-theme 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +1 -0
- data/.travis.yml +8 -1
- data/CHANGELOG.md +40 -0
- data/Gemfile +1 -1
- data/README.md +26 -48
- data/Rakefile +10 -1
- data/VERSION +1 -0
- data/lib/pry-theme/basic_editor.rb +116 -0
- data/lib/pry-theme/color.rb +431 -0
- data/lib/pry-theme/color_table.rb +39 -0
- data/lib/pry-theme/colors/color16.rb +35 -0
- data/lib/pry-theme/colors/color256.rb +30 -0
- data/lib/pry-theme/colors/color8.rb +31 -0
- data/lib/pry-theme/commands.rb +237 -275
- data/lib/pry-theme/declaration.rb +120 -0
- data/lib/pry-theme/definition.rb +111 -0
- data/lib/pry-theme/formattable.rb +26 -0
- data/lib/pry-theme/hex.rb +76 -0
- data/lib/pry-theme/preview.rb +74 -0
- data/lib/pry-theme/rgb.rb +238 -13
- data/lib/pry-theme/term.rb +66 -0
- data/lib/pry-theme/theme.rb +116 -26
- data/lib/pry-theme/theme_list.rb +52 -0
- data/lib/pry-theme/when_started_hook.rb +25 -27
- data/lib/pry-theme.rb +84 -158
- data/pry-theme.gemspec +14 -18
- data/spec/color_table.rb +53 -0
- data/spec/colors/color16_spec.rb +255 -0
- data/spec/colors/color256_spec.rb +323 -0
- data/spec/colors/color8_spec.rb +254 -0
- data/spec/commands_spec.rb +203 -0
- data/spec/helper.rb +16 -0
- data/spec/hex_spec.rb +52 -0
- data/spec/rgb_spec.rb +81 -0
- data/spec/term_spec.rb +23 -0
- data/spec/theme_spec.rb +486 -0
- data/themes/github.prytheme.rb +49 -0
- data/themes/monokai.prytheme.rb +48 -0
- data/themes/pry-classic-16.prytheme.rb +48 -0
- data/themes/pry-classic-256.prytheme.rb +48 -0
- data/themes/pry-classic-8.prytheme.rb +48 -0
- data/themes/pry-cold.prytheme.rb +49 -0
- data/themes/pry-love-16.prytheme.rb +48 -0
- data/themes/pry-love-8.prytheme.rb +48 -0
- data/themes/pry-modern-16.prytheme.rb +48 -0
- data/themes/pry-modern-256.prytheme.rb +48 -0
- data/themes/pry-modern-8.prytheme.rb +48 -0
- data/themes/pry-monochrome.prytheme.rb +32 -0
- data/themes/pry-siberia-16.prytheme.rb +48 -0
- data/themes/pry-siberia-8.prytheme.rb +48 -0
- data/themes/pry-tepid-16.prytheme.rb +48 -0
- data/themes/pry-tepid-8.prytheme.rb +48 -0
- data/themes/pry-zealand-16.prytheme.rb +48 -0
- data/themes/pry-zealand-8.prytheme.rb +49 -0
- data/themes/railscasts.prytheme.rb +50 -0
- data/themes/solarized.prytheme.rb +48 -0
- data/themes/tomorrow.prytheme.rb +48 -0
- data/themes/twilight.prytheme.rb +48 -0
- data/themes/vim-default.prytheme.rb +50 -0
- data/themes/vim-detailed.prytheme.rb +50 -0
- data/themes/zenburn.prytheme.rb +48 -0
- metadata +56 -41
- data/lib/pry-theme/color_converter.rb +0 -55
- data/lib/pry-theme/helper.rb +0 -87
- data/lib/pry-theme/palette.rb +0 -85
- data/lib/pry-theme/term_notation.rb +0 -17
- data/lib/pry-theme/version.rb +0 -3
- data/test/fixtures/pry-classic.prytheme +0 -38
- data/test/helper.rb +0 -56
- data/test/test_color_converter.rb +0 -38
- data/test/test_commands.rb +0 -55
- data/test/test_helper.rb +0 -45
- data/test/test_palette.rb +0 -11
- data/themes/github.prytheme +0 -43
- data/themes/monokai.prytheme +0 -42
- data/themes/pry-classic.prytheme +0 -43
- data/themes/pry-cold.prytheme +0 -43
- data/themes/pry-modern.prytheme +0 -42
- data/themes/railscasts.prytheme +0 -44
- data/themes/saturday.prytheme +0 -42
- data/themes/solarized.prytheme +0 -43
- data/themes/tomorrow.prytheme +0 -43
- data/themes/twilight.prytheme +0 -42
- data/themes/vim-default.prytheme +0 -42
- data/themes/vim-detailed.prytheme +0 -42
- data/themes/zenburn.prytheme +0 -43
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZjgyNDZhYTQxYjhiNTNmMDQ5Yjg1YjhlNDljYzM4YjcwNTVlNjY1YQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YzdjNDY5OTkzNWIwODQ3Zjk0YmZkZjlmNmM4Y2RmNmI1MjJkNGEwNw==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
OGJhMGRiMTE3NjRkOWYxMWRhOGY1OTRmODdiYTRhNDQ2YTFlZTNkZTM2ZDlj
|
10
|
+
MTM1YjhlNjU5ODM4MDc1NDIyY2YzMTkzMzA2NDU2MjA5NzgzMmEwMDVkODhl
|
11
|
+
ODcwZDA4YjFjZmViNTU2ZWQzN2FiMThjZjYyN2RjNjY2OWYyM2M=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YTkwOWI1NDY4MjdkOGNkY2FjN2IxMjc1MTRkYzQ5NTkyZmFiODEwZTBhMjc0
|
14
|
+
NTc3NDc2MzhjODdhZWNhM2ExOWVmMWQyMzgzNmUyNWYzNTBjOTVmYzM0ZjE1
|
15
|
+
ZmZkNDczMTc2YmVhZmEzZTM4ODMzYzIyMTY2ZDg5NzU5MGM3Mzc=
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -2,11 +2,18 @@ rvm:
|
|
2
2
|
- 1.8.7
|
3
3
|
- 1.9.2
|
4
4
|
- 1.9.3
|
5
|
+
- ruby-head
|
5
6
|
- ree
|
6
7
|
- rbx-18mode
|
7
8
|
- rbx-19mode
|
8
|
-
- jruby
|
9
|
+
- jruby-18mode
|
10
|
+
- jruby-19mode
|
11
|
+
- jruby-head
|
9
12
|
|
10
13
|
branches:
|
11
14
|
only:
|
12
15
|
- master
|
16
|
+
|
17
|
+
before_install:
|
18
|
+
- gem install sinatra
|
19
|
+
- gem install random-word
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,46 @@
|
|
1
1
|
Pry Theme changelog
|
2
2
|
===================
|
3
3
|
|
4
|
+
### v0.2.0 (March 26, 2013)
|
5
|
+
|
6
|
+
* **HOT**: Added Windows support
|
7
|
+
* **NOT SO HOT**: The plugin was rewritten from scratch
|
8
|
+
* The plugin works everywhere where you can launch Pry
|
9
|
+
* Improved `vim-detailed` theme
|
10
|
+
* Added support for 16 colour themes
|
11
|
+
* Introduced the new theme syntax
|
12
|
+
* Lots of rewordings, improvements of help messages
|
13
|
+
* Added fallback mode. It is useful when you are running Pry on poor terminals
|
14
|
+
and trying to use a 256 colour theme. It is quite numpty, though.
|
15
|
+
* Converted switches to subcommands
|
16
|
+
* Added basic tab completion for installed themes
|
17
|
+
* Added support for italic font. Does not work eveywhere. For example, I use
|
18
|
+
urxvt and it does support italic fonts.
|
19
|
+
* **NOT BAD**: Added a bunch of new themes
|
20
|
+
|
21
|
+
* pry-monochrome
|
22
|
+
* pry-modern-256 (old `pry-modern`)
|
23
|
+
* pry-classic-256 (old `pry-classic`; default theme on 256 colour capable
|
24
|
+
terminals)
|
25
|
+
|
26
|
+
Including Windows friendly themes:
|
27
|
+
|
28
|
+
* pry-classic-16 (default theme on Windows)
|
29
|
+
* pry-classic-8
|
30
|
+
* pry-zealand-16 (greenish)
|
31
|
+
* pry-zealand-8
|
32
|
+
* pry-love-16 (redish)
|
33
|
+
* pry-love-8
|
34
|
+
* pry-sibera-16 (bluish)
|
35
|
+
* pry-sibera-8
|
36
|
+
* pry-tepid-16 (yellowish)
|
37
|
+
* pry-tepid-8
|
38
|
+
* pry-modern-16
|
39
|
+
* pry-modern-8
|
40
|
+
* And probably something else. I could forget something!
|
41
|
+
|
42
|
+
And do not forget to check out [the new CLI][cli]!
|
43
|
+
|
4
44
|
### v0.1.3 (September 21, 2012)
|
5
45
|
|
6
46
|
* Improved integration with [pry-rescue][prescue] plugin.
|
data/Gemfile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
source
|
1
|
+
source 'http://rubygems.org'
|
2
2
|
gemspec
|
data/README.md
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
![Pry Theme][logo]
|
2
2
|
|
3
|
+
![Pry Theme version badge][ver-badge] [![Build Status][ci-badge]][ci-link]
|
4
|
+
|
3
5
|
* Repository: [https://github.com/kyrylo/pry-theme/][pt]
|
4
6
|
* Wiki: [https://github.com/kyrylo/pry-theme/wiki][wiki]
|
5
7
|
|
6
8
|
Description
|
7
9
|
-----------
|
8
10
|
|
9
|
-
Pry Theme is a plugin for [Pry][pry], which helps you to
|
10
|
-
colors via `prytheme` files.
|
11
|
+
Pry Theme is a plugin for [Pry][pry], which helps you to customise your Pry
|
12
|
+
colors via `prytheme.rb` files.
|
11
13
|
|
12
|
-
![Railscasts](
|
13
|
-
![Solarized](
|
14
|
-
![Tomorrow](
|
15
|
-
![Zenburn](
|
14
|
+
![Railscasts](./screenshots/railscasts.png)
|
15
|
+
![Solarized](./screenshots/solarized.png)
|
16
|
+
![Tomorrow](./screenshots/tomorrow.png)
|
17
|
+
![Zenburn](./screenshots/zenburn.png)
|
16
18
|
|
17
19
|
Installation
|
18
20
|
------------
|
@@ -27,14 +29,14 @@ Synopsis
|
|
27
29
|
|
28
30
|
### Theme files
|
29
31
|
|
30
|
-
Theme file is a
|
31
|
-
`beautiful.prytheme`). In order to set up the desired theme, add the
|
32
|
-
line
|
32
|
+
Theme file is nothing but a Ruby file, which has `.prytheme.rb` extension (for
|
33
|
+
example, `beautiful.prytheme.rb`). In order to set up the desired theme, add the
|
34
|
+
following line to your `.pryrc`:
|
33
35
|
|
34
36
|
Pry.config.theme = "theme-name"
|
35
37
|
|
36
|
-
The default theme is `pry-classic` (basically, you
|
37
|
-
it
|
38
|
+
The default theme is `pry-classic` (basically, you shouldn't notice it, because
|
39
|
+
it resembles the default outlook of Pry, as though you didn't install anything).
|
38
40
|
Let's change it to something more neoteric:
|
39
41
|
|
40
42
|
Pry.config.theme = "pry-modern"
|
@@ -47,60 +49,33 @@ Pry Theme has a command-line interface available via Pry. Just launch Pry and
|
|
47
49
|
start working with it. For example, you can _temporary_ change themes on the
|
48
50
|
fly (only for the current session):
|
49
51
|
|
50
|
-
[1] pry(main)> pry-theme pry-classic
|
52
|
+
[1] pry(main)> pry-theme try pry-classic
|
51
53
|
|
52
|
-
This
|
54
|
+
This subcommand would switch your current theme to `pry-classic` theme.
|
53
55
|
|
54
56
|
You can find [more information about CLI in Pry Theme Wiki][cli].
|
55
57
|
|
56
|
-
###
|
58
|
+
### Managing themes
|
57
59
|
|
58
60
|
Creating new themes isn't hard. [Check out Pry Theme Wiki article on that][new_theme].
|
59
61
|
|
60
|
-
|
61
|
-
|
62
|
-
Theme files must have `.prytheme` extension. Check out [Pry Theme Collection][ptc],
|
62
|
+
Theme files must have `.prytheme.rb` extension. Check out [Pry Theme Collection][ptc]
|
63
63
|
if you want to find some themes other than default ones.
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
Put your theme file in `$HOME/.pry/themes` directory.
|
65
|
+
If you already have your theme stored somewhere on disk, just put it in the
|
66
|
+
`$HOME/.pry/themes` directory.
|
68
67
|
|
69
68
|
If you don't want to bother with routine operations, you can install a theme
|
70
|
-
from the Collection with help of `pry-theme
|
71
|
-
can install
|
69
|
+
from the Collection with help of `pry-theme install <name>` subcommand. For
|
70
|
+
example, you can want to install xoria256 theme. Just execute
|
71
|
+
`pry-theme install xoria256` and you're done.
|
72
72
|
|
73
73
|
Oh, and don't forget to adjust your `.pryrc`!
|
74
74
|
|
75
75
|
Limitations
|
76
76
|
-----------
|
77
77
|
|
78
|
-
|
79
|
-
but with a couple of admonishments. They are listed below.
|
80
|
-
|
81
|
-
### OS support
|
82
|
-
|
83
|
-
* GNU/Linux;
|
84
|
-
* Mac OS.
|
85
|
-
|
86
|
-
I hope it runs on Windows too, but I couldn't find any sane terminal, that
|
87
|
-
would support 256 colors. Sorry, Windows guys. Please, file an issue, if you
|
88
|
-
noticed bugs or something.
|
89
|
-
|
90
|
-
### Ruby implementations support
|
91
|
-
|
92
|
-
* MRI 1.9.3
|
93
|
-
* MRI 1.9.2
|
94
|
-
* MRI 1.8.7
|
95
|
-
* REE 1.8.7-2012.02
|
96
|
-
* JRuby 1.6.7
|
97
|
-
* Rubinius 1.2.4
|
98
|
-
|
99
|
-
Under the hood
|
100
|
-
--------------
|
101
|
-
|
102
|
-
Basically, Pry Theme is nothing but a CodeRay color scheme with a human-readable
|
103
|
-
syntax.
|
78
|
+
No limitations. Pry Theme will run everywhere where you can launch Pry.
|
104
79
|
|
105
80
|
Credits
|
106
81
|
-------
|
@@ -118,6 +93,9 @@ License
|
|
118
93
|
The project uses Zlib License. See LICENSE file for more information.
|
119
94
|
|
120
95
|
[pt]: https://github.com/kyrylo/pry-theme/ "Home page"
|
96
|
+
[ver-badge]: https://badge.fury.io/rb/pry-theme.png "Pry Theme version badge"
|
97
|
+
[ci-badge]: https://travis-ci.org/kyrylo/pry-theme.png?branch=master "Build status"
|
98
|
+
[ci-link]: https://travis-ci.org/kyrylo/pry-theme/ "Build history"
|
121
99
|
[logo]: http://img-fotki.yandex.ru/get/5107/98991937.a/0_7c6c8_871a1842_orig "Pry Theme"
|
122
100
|
[pry]: https://github.com/pry/pry/ "Pry's home page"
|
123
101
|
[new_theme]: https://github.com/kyrylo/pry-theme/wiki/Creating-a-New-Theme
|
data/Rakefile
CHANGED
@@ -1,6 +1,15 @@
|
|
1
|
+
def quiet
|
2
|
+
ENV['VERBOSE'] ? '' : '-q'
|
3
|
+
end
|
4
|
+
|
5
|
+
def test_files
|
6
|
+
paths = FileList['spec/**/*_spec.rb']
|
7
|
+
paths.shuffle!.join(' ')
|
8
|
+
end
|
9
|
+
|
1
10
|
desc "Run tests"
|
2
11
|
task :test do
|
3
|
-
|
12
|
+
exec "bacon -Ispec #{ quiet } #{ test_files }"
|
4
13
|
end
|
5
14
|
|
6
15
|
task :default => :test
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.2.0
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require 'etc'
|
2
|
+
|
3
|
+
module PryTheme
|
4
|
+
class BasicEditor
|
5
|
+
|
6
|
+
class << self
|
7
|
+
def edit(theme_name)
|
8
|
+
editor = new(theme_name)
|
9
|
+
editor.start_editing
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
attr_reader :current_file, :output
|
14
|
+
|
15
|
+
def initialize(filename)
|
16
|
+
@filename = filename
|
17
|
+
theme_path = themify(filename)
|
18
|
+
|
19
|
+
@editor = Pry.config.editor
|
20
|
+
@new_theme = false
|
21
|
+
@output = Pry.output
|
22
|
+
@current_file = File.open(theme_path, 'r+')
|
23
|
+
rescue Errno::ENOENT
|
24
|
+
@new_theme = true
|
25
|
+
@current_file = File.open(theme_path, 'w')
|
26
|
+
end
|
27
|
+
|
28
|
+
def start_editing
|
29
|
+
if @new_theme
|
30
|
+
@output.puts 'Created a new theme.'
|
31
|
+
@current_file.puts template
|
32
|
+
@current_file.close
|
33
|
+
end
|
34
|
+
@output.puts "Opened in #{ @editor }: #{ themify(@filename) }"
|
35
|
+
|
36
|
+
reload_theme!
|
37
|
+
output_dashy_header("Current \"#@filename\"")
|
38
|
+
|
39
|
+
Pry::Editor.invoke_editor(@current_file.path, 1)
|
40
|
+
|
41
|
+
reload_theme!
|
42
|
+
output_dashy_header("Edited \"#@filename\"")
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def reload_theme!
|
48
|
+
ThemeList.reload_theme(@filename, @current_file)
|
49
|
+
end
|
50
|
+
|
51
|
+
def output_dashy_header(msg)
|
52
|
+
preview = Preview.new(ThemeList.themes.find { |t| t.name == @filename })
|
53
|
+
Pry::Pager.page(preview.banner(msg) + preview.long)
|
54
|
+
end
|
55
|
+
|
56
|
+
def themify(filename)
|
57
|
+
File.join(USER_THEMES_DIR, filename + PT_EXT)
|
58
|
+
end
|
59
|
+
|
60
|
+
def template
|
61
|
+
Pry::Helpers::CommandHelpers.unindent(<<-TEMPLATE)
|
62
|
+
t = PryTheme.create :name => '#{ @filename }' do
|
63
|
+
author :name => '#{ Etc.getlogin || 'me' }', :email => 'user@hostname'
|
64
|
+
description '#{ @filename } theme'
|
65
|
+
|
66
|
+
# How the flip do I edit this?!
|
67
|
+
# Help is there: https://github.com/kyrylo/pry-theme/wiki/Creating-a-New-Theme
|
68
|
+
define_theme do
|
69
|
+
class_
|
70
|
+
class_variable
|
71
|
+
comment
|
72
|
+
constant
|
73
|
+
error
|
74
|
+
float
|
75
|
+
global_variable
|
76
|
+
inline_delimiter
|
77
|
+
instance_variable
|
78
|
+
integer
|
79
|
+
keyword
|
80
|
+
method
|
81
|
+
predefined_constant
|
82
|
+
symbol
|
83
|
+
|
84
|
+
regexp do
|
85
|
+
self_
|
86
|
+
char
|
87
|
+
content
|
88
|
+
delimiter
|
89
|
+
modifier
|
90
|
+
escape
|
91
|
+
end
|
92
|
+
|
93
|
+
shell do
|
94
|
+
self_
|
95
|
+
char
|
96
|
+
content
|
97
|
+
delimiter
|
98
|
+
escape
|
99
|
+
end
|
100
|
+
|
101
|
+
string do
|
102
|
+
self_
|
103
|
+
char
|
104
|
+
content
|
105
|
+
delimiter
|
106
|
+
escape
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
PryTheme::ThemeList.add_theme(t)
|
112
|
+
TEMPLATE
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
end
|