presentify 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/presentify/colorifer.rb +16 -11
- data/lib/presentify/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f07e394bd8e5cdde7352a9b09de81dd1dadf5d8
|
4
|
+
data.tar.gz: fbb846f35f639f9a30f04f77ada7b8871e5271c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 956d8e3fbfe0ea5c55b2303d2b67d1becfaa9d2e7b202bfec0fab54342458e66bfd2b0413e50e4578e92d465967e8d811f5913f0b171f0e9a1cba3bd10ec16c4
|
7
|
+
data.tar.gz: 1001a4ddc771bb10facc82f7e0587556a7bab07881f546fae4f4c9941f4697e658f6ae97ad88a6fbc7b67c746f7cbc5c4555f7406511b45046d863040bc1e89b
|
data/lib/presentify/colorifer.rb
CHANGED
@@ -1,20 +1,23 @@
|
|
1
1
|
class Presentify
|
2
2
|
class Colorifer
|
3
|
-
RED =
|
4
|
-
GREEN =
|
5
|
-
YELLOW =
|
6
|
-
BLUE =
|
7
|
-
MAGENTA =
|
8
|
-
CYAN =
|
9
|
-
WHITE =
|
3
|
+
RED = 31
|
4
|
+
GREEN = 32
|
5
|
+
YELLOW = 33
|
6
|
+
BLUE = 34
|
7
|
+
MAGENTA = 35
|
8
|
+
CYAN = 36
|
9
|
+
WHITE = 37
|
10
|
+
GRAY = 2
|
10
11
|
|
11
12
|
CONSTANTS_RE = /true|false|nil/
|
12
13
|
SINGLE_STRINGS_RE = /('|").*?((?![\\])\1)/
|
13
14
|
MUTLTI_STRINGS_RE = /%(Q|w)[\{\[]([\s\S]*?)[\]\}]/m
|
14
|
-
|
15
|
+
COMMENTS_RE = /# [^\n|\Z]+/
|
16
|
+
KEYWORDS_RE = /(\s|\n|\A)(while|do|end|sleep|puts|print|if|unless|else|def|class|ensure|rescue|yield)/
|
15
17
|
METHOD_CALLS_RE = /\.[a-z_]+/
|
16
18
|
ESCAPE_CODES_RE = /\\(r|b|n|(e\[[\d\;]+(m|A)))/
|
17
19
|
INTERPOLATIONS_RE = /\#\{.+?\}/
|
20
|
+
CLASSES_RE = /[A-Z][a-zA-Z_]+/
|
18
21
|
|
19
22
|
def colorify(code)
|
20
23
|
#code = code.gsub NUMBERS_RE, "\e[3#{RED}m\\2\e[0m\\3"
|
@@ -25,8 +28,10 @@ class Presentify
|
|
25
28
|
INTERPOLATIONS_RE => YELLOW,
|
26
29
|
MUTLTI_STRINGS_RE => GREEN,
|
27
30
|
SINGLE_STRINGS_RE => GREEN,
|
31
|
+
COMMENTS_RE => GRAY,
|
28
32
|
KEYWORDS_RE => MAGENTA,
|
29
|
-
METHOD_CALLS_RE => CYAN
|
33
|
+
METHOD_CALLS_RE => CYAN,
|
34
|
+
CLASSES_RE => YELLOW
|
30
35
|
}
|
31
36
|
end
|
32
37
|
|
@@ -40,8 +45,8 @@ class Presentify
|
|
40
45
|
while code.match(re)
|
41
46
|
match = $&.dup
|
42
47
|
code.sub! match, placeholder(stash.size)
|
43
|
-
replacement = "\e[
|
44
|
-
replacement << "\e[
|
48
|
+
replacement = "\e[#{color}m#{match}\e[0m"
|
49
|
+
replacement << "\e[#{GREEN}m" if re == ESCAPE_CODES_RE || re == INTERPOLATIONS_RE
|
45
50
|
stash << replacement
|
46
51
|
end
|
47
52
|
end
|
data/lib/presentify/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: presentify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikolay Nemshilov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
82
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.4.5
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: Turns a folder with ruby files into a CLI presentation.
|