run_tasks 1.2.6 → 1.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/src/run/markdown.rb +35 -0
- data/src/run/string.rb +56 -0
- data/src/run.rb +5 -4
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '080afe6e5a7c8c122e4c1df3df0e43f881294ea254735680d912a0c373dd3a0a'
|
4
|
+
data.tar.gz: c54fcd1fac401c4b66ae21d3baa0e87dbe555201e4c3d0f389088f078729b7c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6125dfb0293f121608a217519e7b587b4a348fa2d986786e32aa3f6a0152a88aed07976f8c3485b84b4dd0b40ff2f2a672dacfca9f5838295134c4df388e62aa
|
7
|
+
data.tar.gz: 56611fd8558b70f6a2e59cdf778fefadea99eb924a06b9e08a434b1cb23f7345e4fe44092c009fb35d983e957ed5c51082902ed8ae2f25d10d3967a2e9a7ca85
|
data/src/run/markdown.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require_relative "./string"
|
2
|
+
|
3
|
+
class Markdown
|
4
|
+
def initialize(string)
|
5
|
+
@string = string
|
6
|
+
end
|
7
|
+
|
8
|
+
def to_ansi
|
9
|
+
# Apply private methods onto string.
|
10
|
+
private_methods(false).reject{ |name| name == :initialize }
|
11
|
+
.reduce(@string) do |string, method|
|
12
|
+
send(method, string)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def bold(string)
|
19
|
+
string.gsub(/([^*_]|^)[*_]{2}([^*_]+)[*_]{2}([^*_]|$)/) do
|
20
|
+
Regexp.last_match[1] + Regexp.last_match[2].bold + Regexp.last_match[3]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def code(string)
|
25
|
+
string.gsub(/([^`]|^)`([^*_]+)`([^`]|$)/) do
|
26
|
+
Regexp.last_match[1] + Regexp.last_match[2].cyan + Regexp.last_match[3]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def italic(string)
|
31
|
+
string.gsub(/([^*_]|^)[*_]{1}([^*_]+)[*_]{1}([^*_]|$)/) do
|
32
|
+
Regexp.last_match[1] + Regexp.last_match[2].italic + Regexp.last_match[3]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/src/run/string.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797
|
2
|
+
|
3
|
+
class String
|
4
|
+
@@styles = {
|
5
|
+
:bold => "1",
|
6
|
+
:dim => "2",
|
7
|
+
:italic => "3",
|
8
|
+
:underline => "4",
|
9
|
+
:inverse => "7",
|
10
|
+
:strikethrough => "9",
|
11
|
+
:fg_black => "30",
|
12
|
+
:fg_red => "31",
|
13
|
+
:fg_green => "32",
|
14
|
+
:fg_yellow => "33",
|
15
|
+
:fg_blue => "34",
|
16
|
+
:fg_magenta => "35",
|
17
|
+
:fg_cyan => "36",
|
18
|
+
:fg_white => "37",
|
19
|
+
:fg_bright_black => "30;1",
|
20
|
+
:fg_bright_red => "31;1",
|
21
|
+
:fg_bright_green => "32;1",
|
22
|
+
:fg_bright_yellow => "33;1",
|
23
|
+
:fg_bright_blue => "34;1",
|
24
|
+
:fg_bright_magenta => "35;1",
|
25
|
+
:fg_bright_cyan => "36;1",
|
26
|
+
:fg_bright_white => "37;1",
|
27
|
+
}
|
28
|
+
|
29
|
+
# To be able to handle more styles (with method chaining) we should refactor this.
|
30
|
+
def stylize(style)
|
31
|
+
"\033[#{@@styles[style.to_sym]}m#{self}\033[0m"
|
32
|
+
end
|
33
|
+
|
34
|
+
def bold; stylize(:bold); end
|
35
|
+
def dim; stylize(:dim); end
|
36
|
+
def italic; stylize(:italic); end
|
37
|
+
def underline; stylize(:underline); end
|
38
|
+
def inverse; stylize(:inverse); end
|
39
|
+
def strikethrough; stylize(:strikethrough); end
|
40
|
+
def black; stylize(:fg_black); end
|
41
|
+
def red; stylize(:fg_red); end
|
42
|
+
def green; stylize(:fg_green); end
|
43
|
+
def yellow; stylize(:fg_yellow); end
|
44
|
+
def blue; stylize(:fg_blue); end
|
45
|
+
def magenta; stylize(:fg_magenta); end
|
46
|
+
def cyan; stylize(:fg_cyan); end
|
47
|
+
def white; stylize(:fg_white); end
|
48
|
+
def bright_black; stylize(:fg_bright_black); end
|
49
|
+
def bright_red; stylize(:fg_bright_red); end
|
50
|
+
def bright_green; stylize(:fg_bright_green); end
|
51
|
+
def bright_yellow; stylize(:fg_bright_yellow); end
|
52
|
+
def bright_blue; stylize(:fg_bright_blue); end
|
53
|
+
def bright_magenta; stylize(:fg_bright_magenta); end
|
54
|
+
def bright_cyan; stylize(:fg_bright_cyan); end
|
55
|
+
def bright_white; stylize(:fg_bright_white); end
|
56
|
+
end
|
data/src/run.rb
CHANGED
@@ -106,9 +106,10 @@ end
|
|
106
106
|
|
107
107
|
begin
|
108
108
|
require "./#{RUNFILE}"
|
109
|
-
rescue SyntaxError
|
109
|
+
rescue SyntaxError => error
|
110
110
|
puts
|
111
|
-
puts "The Runfile contains a syntax error
|
111
|
+
puts "The Runfile contains a syntax error:".red
|
112
|
+
puts error.message.red
|
112
113
|
puts
|
113
114
|
exit 5
|
114
115
|
end
|
@@ -148,8 +149,8 @@ if VERSION && HOMEPAGE
|
|
148
149
|
current = VERSION.split "."
|
149
150
|
latest = version[1].split "."
|
150
151
|
if current[0].to_i < latest[0].to_i ||
|
151
|
-
|
152
|
-
|
152
|
+
current[1].to_i < latest[1].to_i ||
|
153
|
+
current[2].to_i < latest[2].to_i
|
153
154
|
puts "New ".cyan + version[1].yellow + " version released!".cyan
|
154
155
|
puts
|
155
156
|
puts "You can upgrade with:".cyan + "gem update run_tasks".yellow
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: run_tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aurélien Delogu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: aurelien.delogu@gmail.com
|
@@ -19,6 +19,8 @@ extra_rdoc_files: []
|
|
19
19
|
files:
|
20
20
|
- bin/run
|
21
21
|
- src/run.rb
|
22
|
+
- src/run/markdown.rb
|
23
|
+
- src/run/string.rb
|
22
24
|
homepage: https://github.com/pyrsmk/run
|
23
25
|
licenses:
|
24
26
|
- MIT
|