firew0rks 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/README.md +2 -2
- data/exe/firew0rks +16 -7
- data/lib/firew0rks/terminal.rb +34 -0
- data/lib/firew0rks/version.rb +1 -1
- data/lib/firew0rks.rb +3 -2
- metadata +4 -3
- data/fireworks_show.gif +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '05698dd4f09201f6c1daa2243b0aa3c8e4283e176c5351f086cd6e1ff8a471f2'
|
4
|
+
data.tar.gz: 599205907b70d6d6ed6989b240bbcae26309954f689c41d121ce31bf6cbf0827
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 167e7ec659bf378efd9e32a5f9fc2f781e13fdfee485396153ab67b6f86cfc65cb9922c575ec8b37bc0902b2dc22f87586b7a8ea8392242de743f28b5595c90d
|
7
|
+
data.tar.gz: 18c6bce19eb8be3f829b964984020e743e8069820a3a58772e85c120652072a2e3a184d3205d91b4922479b13afc4e2dc11cacbf372e4a768cdc76544569c99e
|
data/.DS_Store
ADDED
Binary file
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Play fireworks text art animations in your terminal!
|
4
4
|
|
5
|
-

|
5
|
+

|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -19,7 +19,7 @@ Play fireworks text art animations in your terminal!
|
|
19
19
|
`Ctrl + C`
|
20
20
|
|
21
21
|
## Acknowledgments
|
22
|
-
This project is a Ruby version of [text_art_animations](https://github.com/rvizzz/text_art_animations) by rvizzz. Thank you for the inspiration and the amazing ASCII art animations!
|
22
|
+
This project is a Ruby version of [text_art_animations](https://github.com/rvizzz/text_art_animations) by [rvizzz](https://github.com/rvizzz). Thank you for the inspiration and the amazing ASCII art animations!
|
23
23
|
|
24
24
|
## Contributing
|
25
25
|
|
data/exe/firew0rks
CHANGED
@@ -1,22 +1,31 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require_relative "../lib/firew0rks
|
3
|
-
|
2
|
+
require_relative "../lib/firew0rks"
|
3
|
+
require_relative "../lib/firew0rks/terminal"
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
def setup
|
6
|
+
Terminal.open_buffer
|
7
|
+
Terminal.hide_cursor
|
8
|
+
Terminal.clear_screen
|
9
|
+
end
|
10
|
+
|
11
|
+
def clean_up
|
12
|
+
Terminal.close_buffer
|
13
|
+
Terminal.clear_screen
|
14
|
+
Terminal.show_cursor
|
15
|
+
end
|
7
16
|
|
8
17
|
trap("INT") {
|
9
|
-
|
18
|
+
clean_up
|
10
19
|
puts ""
|
11
20
|
puts "Bye."
|
12
21
|
exit 0
|
13
22
|
}
|
14
23
|
|
15
|
-
|
16
24
|
begin
|
25
|
+
setup
|
17
26
|
Fireworks.new.run
|
18
27
|
rescue => error
|
19
28
|
puts error
|
20
29
|
ensure
|
21
|
-
|
30
|
+
clean_up
|
22
31
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# ANSI_escape_code
|
2
|
+
# Ref: https://xn--rpa.cc/irl/term.html
|
3
|
+
# https://en.wikipedia.org/wiki/ANSI_escape_code#CSIsection
|
4
|
+
|
5
|
+
class Terminal
|
6
|
+
class << self
|
7
|
+
|
8
|
+
def clear_buffer
|
9
|
+
print "\x1b[3J"
|
10
|
+
end
|
11
|
+
|
12
|
+
def clear_screen
|
13
|
+
print "\x1b[2J"
|
14
|
+
end
|
15
|
+
|
16
|
+
def hide_cursor
|
17
|
+
print "\x1b[?25l"
|
18
|
+
end
|
19
|
+
|
20
|
+
def show_cursor
|
21
|
+
print "\x1b[?25h"
|
22
|
+
end
|
23
|
+
|
24
|
+
def open_buffer
|
25
|
+
# 打开特殊缓存
|
26
|
+
print "\x1b[?1049h"
|
27
|
+
end
|
28
|
+
|
29
|
+
def close_buffer
|
30
|
+
# 关闭特殊缓存
|
31
|
+
print "\x1b[?1049l"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/firew0rks/version.rb
CHANGED
data/lib/firew0rks.rb
CHANGED
@@ -3,6 +3,7 @@ require "io/console"
|
|
3
3
|
require_relative "firew0rks/version"
|
4
4
|
require_relative "firew0rks/frame"
|
5
5
|
require_relative "firew0rks/error"
|
6
|
+
require_relative "firew0rks/terminal"
|
6
7
|
|
7
8
|
|
8
9
|
class Fireworks
|
@@ -14,7 +15,7 @@ class Fireworks
|
|
14
15
|
|
15
16
|
|
16
17
|
def clear_screen
|
17
|
-
|
18
|
+
Terminal.clear_buffer
|
18
19
|
end
|
19
20
|
|
20
21
|
def init_screen
|
@@ -27,7 +28,7 @@ class Fireworks
|
|
27
28
|
if !@first_frame
|
28
29
|
$stdout.print @backspace_adjust
|
29
30
|
end
|
30
|
-
|
31
|
+
clear_screen
|
31
32
|
$stdout.print content
|
32
33
|
@first_frame = false
|
33
34
|
sleep(0.05)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: firew0rks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark24
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-01-
|
10
|
+
date: 2025-01-03 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: "Fireworks in your terminal \U0001F386 power by Ruby"
|
13
13
|
email:
|
@@ -17,11 +17,11 @@ executables:
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- ".DS_Store"
|
20
21
|
- LICENSE.txt
|
21
22
|
- README.md
|
22
23
|
- Rakefile
|
23
24
|
- exe/firew0rks
|
24
|
-
- fireworks_show.gif
|
25
25
|
- lib/firew0rks.rb
|
26
26
|
- lib/firew0rks/error.rb
|
27
27
|
- lib/firew0rks/frame.rb
|
@@ -175,6 +175,7 @@ files:
|
|
175
175
|
- lib/firew0rks/frames/97.txt
|
176
176
|
- lib/firew0rks/frames/98.txt
|
177
177
|
- lib/firew0rks/frames/99.txt
|
178
|
+
- lib/firew0rks/terminal.rb
|
178
179
|
- lib/firew0rks/version.rb
|
179
180
|
- sig/firew0rks.rbs
|
180
181
|
homepage: https://github.com/Mark24Code/firew0rks
|
data/fireworks_show.gif
DELETED
Binary file
|