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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 28cd07e853a795de01b666cf461e41489270c8ab
4
- data.tar.gz: ab509c81637ecfd8c7e7760731686764d22fefb5
3
+ metadata.gz: 5f07e394bd8e5cdde7352a9b09de81dd1dadf5d8
4
+ data.tar.gz: fbb846f35f639f9a30f04f77ada7b8871e5271c4
5
5
  SHA512:
6
- metadata.gz: 85168038fc278b9fc8863629f59872596b30f0158d2c708f26df3e62bdfa5de98f314dab496c757e5cba61183c0ec4ff13a08732e358a774cdc3fb59a098f991
7
- data.tar.gz: 3c00c54dd45318557703874cdc0becc47250caf7e099f1aa9bff9003f4b75aa3baa69975b602aed984b6fd13063e4538f3c416a489bc5d98eecdcb421ac4b147
6
+ metadata.gz: 956d8e3fbfe0ea5c55b2303d2b67d1becfaa9d2e7b202bfec0fab54342458e66bfd2b0413e50e4578e92d465967e8d811f5913f0b171f0e9a1cba3bd10ec16c4
7
+ data.tar.gz: 1001a4ddc771bb10facc82f7e0587556a7bab07881f546fae4f4c9941f4697e658f6ae97ad88a6fbc7b67c746f7cbc5c4555f7406511b45046d863040bc1e89b
@@ -1,20 +1,23 @@
1
1
  class Presentify
2
2
  class Colorifer
3
- RED = 1
4
- GREEN = 2
5
- YELLOW = 3
6
- BLUE = 4
7
- MAGENTA = 5
8
- CYAN = 6
9
- WHITE = 7
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
- KEYWORDS_RE = /while|do|end|sleep|puts|print/
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[3#{color}m#{match}\e[0m"
44
- replacement << "\e[3#{GREEN}m" if re == ESCAPE_CODES_RE || re == INTERPOLATIONS_RE
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
@@ -1,3 +1,3 @@
1
1
  module Presentify
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
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.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: 2014-06-22 00:00:00.000000000 Z
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.2.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.