xmas 0.1.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 +7 -0
- data/bin/xmas +49 -0
- data/bin/xmas-tree +49 -0
- metadata +62 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9f1d390eab0e74da2e115cd612feb3bf469d2ee68ba98d4df63cedd3d6df530f
|
4
|
+
data.tar.gz: edb8f9bd1268754b4cf84b6bfbe6c9541dbfdd75d169b0795fbe903d70e23197
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2c9ca94f2c1822f89707e90d0be122b44652b9558a2e2a93c5bd4516587c334ce2b01c33cbfb2332782e3e7199eaf890c5c58209d1c3bc6b6165baa6d7abe753
|
7
|
+
data.tar.gz: 72d94c21aeb5ba5a12bb3c32c1052fdcd9f32b131ed621abb08b8adf5ec28491e8ab76da5058198fb5163b39d63b754fa89c5d82305a5f04ca5f22402e58d492
|
data/bin/xmas
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'paint'
|
5
|
+
|
6
|
+
trap('INT') { exit }
|
7
|
+
|
8
|
+
XMAS_TREE = <<-XMAS.freeze # rubocop:disable Style/RedundantFreeze
|
9
|
+
x ☆ x
|
10
|
+
x .o x x
|
11
|
+
x .*.'.
|
12
|
+
.'.'o'. x
|
13
|
+
x o'.*.'.o.
|
14
|
+
x .'.o.'.'.*. x x
|
15
|
+
x .*.'.o.'.o.'. x
|
16
|
+
x o'.'.'.'*'.'.'. x
|
17
|
+
x .'.'*'.'o'.'.'o'. x
|
18
|
+
x [_____] x
|
19
|
+
x \\___/ x x
|
20
|
+
XMAS
|
21
|
+
HEADSTAR_REGEX = /(☆)/.freeze
|
22
|
+
LEAVES_REGEX = /('?\.'?)/.freeze
|
23
|
+
STARS_REGEX = /(\*)/.freeze
|
24
|
+
LIGHTS_REGEX = /(o)/.freeze
|
25
|
+
POT_REGEX = %r{(\[_+\]|\\_+/)}.freeze
|
26
|
+
LIGHTS = [91, *93..96,
|
27
|
+
*%w[magenta navy orange purple tomato violet]].freeze # rubocop:disable Lint/RedundantSplatExpansion
|
28
|
+
|
29
|
+
def color(*args)
|
30
|
+
Paint[*args]
|
31
|
+
end
|
32
|
+
|
33
|
+
at_exit { puts color("\nMerry Christmas!", :green) }
|
34
|
+
|
35
|
+
def decorated_xmas_tree
|
36
|
+
out = XMAS_TREE.gsub HEADSTAR_REGEX, color('\1', :yellow, :bright)
|
37
|
+
out.gsub! POT_REGEX, color('\1', 'coral')
|
38
|
+
out.gsub! LEAVES_REGEX, color('\1', :green)
|
39
|
+
out.gsub! STARS_REGEX, color('\1', LIGHTS.sample)
|
40
|
+
out.gsub! LIGHTS_REGEX, color('\1', LIGHTS.sample)
|
41
|
+
out.tr('x', '*')
|
42
|
+
end
|
43
|
+
|
44
|
+
loop do
|
45
|
+
print "\033[0m\033c"
|
46
|
+
puts decorated_xmas_tree
|
47
|
+
$stdout.flush
|
48
|
+
sleep 0.9
|
49
|
+
end
|
data/bin/xmas-tree
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'paint'
|
5
|
+
|
6
|
+
trap('INT') { exit }
|
7
|
+
|
8
|
+
XMAS_TREE = <<-XMAS.freeze # rubocop:disable Style/RedundantFreeze
|
9
|
+
x ☆ x
|
10
|
+
x .o x x
|
11
|
+
x .*.'.
|
12
|
+
.'.'o'. x
|
13
|
+
x o'.*.'.o.
|
14
|
+
x .'.o.'.'.*. x x
|
15
|
+
x .*.'.o.'.o.'. x
|
16
|
+
x o'.'.'.'*'.'.'. x
|
17
|
+
x .'.'*'.'o'.'.'o'. x
|
18
|
+
x [_____] x
|
19
|
+
x \\___/ x x
|
20
|
+
XMAS
|
21
|
+
HEADSTAR_REGEX = /(☆)/.freeze
|
22
|
+
LEAVES_REGEX = /('?\.'?)/.freeze
|
23
|
+
STARS_REGEX = /(\*)/.freeze
|
24
|
+
LIGHTS_REGEX = /(o)/.freeze
|
25
|
+
POT_REGEX = %r{(\[_+\]|\\_+/)}.freeze
|
26
|
+
LIGHTS = [91, *93..96,
|
27
|
+
*%w[magenta navy orange purple tomato violet]].freeze # rubocop:disable Lint/RedundantSplatExpansion
|
28
|
+
|
29
|
+
def color(*args)
|
30
|
+
Paint[*args]
|
31
|
+
end
|
32
|
+
|
33
|
+
at_exit { puts color("\nMerry Christmas!", :green) }
|
34
|
+
|
35
|
+
def decorated_xmas_tree
|
36
|
+
out = XMAS_TREE.gsub HEADSTAR_REGEX, color('\1', :yellow, :bright)
|
37
|
+
out.gsub! POT_REGEX, color('\1', 'coral')
|
38
|
+
out.gsub! LEAVES_REGEX, color('\1', :green)
|
39
|
+
out.gsub! STARS_REGEX, color('\1', LIGHTS.sample)
|
40
|
+
out.gsub! LIGHTS_REGEX, color('\1', LIGHTS.sample)
|
41
|
+
out.tr('x', '*')
|
42
|
+
end
|
43
|
+
|
44
|
+
loop do
|
45
|
+
print "\033[0m\033c"
|
46
|
+
puts decorated_xmas_tree
|
47
|
+
$stdout.flush
|
48
|
+
sleep 0.9
|
49
|
+
end
|
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: xmas
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nihad Abbasov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-12-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: paint
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
description: Light the Christmas Tree in your terminal
|
28
|
+
email: nihad@42na.in
|
29
|
+
executables:
|
30
|
+
- xmas
|
31
|
+
- xmas-tree
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- bin/xmas
|
36
|
+
- bin/xmas-tree
|
37
|
+
homepage: https://github.com/NARKOZ/xmas
|
38
|
+
licenses:
|
39
|
+
- BSD-2-Clause
|
40
|
+
metadata:
|
41
|
+
homepage_uri: https://github.com/NARKOZ/xmas
|
42
|
+
source_code_uri: https://github.com/NARKOZ/xmas
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '2.6'
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
requirements: []
|
58
|
+
rubygems_version: 3.2.33
|
59
|
+
signing_key:
|
60
|
+
specification_version: 4
|
61
|
+
summary: Animated Christmas Tree in terminal
|
62
|
+
test_files: []
|