christmas_tree 0.1.0 → 0.3.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/README.md +11 -5
- data/exe/christmas_tree +16 -10
- data/lib/christmas_tree/version.rb +1 -1
- data/lib/christmas_tree.rb +7 -7
- metadata +1 -2
- data/christmas_tree.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz: '
|
3
|
+
metadata.gz: c75425a2a6db4aafbd32c08ab2a00bcc8c6a5f271601781182ffc130f9ccfb8c
|
4
|
+
data.tar.gz: '04423182fb72a7c72ea0505ab66b240634c2011f2d101caa27c5f2b2b2dba4b7'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 312b80468c9a75d923f74f5c5b383b29616d6551fd2a249c76e41703739b3a852e3cd945c63737ca6e68d3cbb7b3d08277afd02e20ddd28f697e5dc2e49a5f95
|
7
|
+
data.tar.gz: 6495229ecf2ab4d5a1afdafc56bc338a3f786ec8ae2baf58949cc884067755f2c62df778d6a321a7154f45ba3fe0b39e0af7ccf0e17d44df1a7a4c8ba3eca8e4
|
data/README.md
CHANGED
@@ -9,10 +9,6 @@ System dependencies:
|
|
9
9
|
- Ruby 3.0+
|
10
10
|
- Ncurses: macos: `brew install ncurses`
|
11
11
|
|
12
|
-
Ruby Gem:
|
13
|
-
|
14
|
-
- Curses: `gem install curses``
|
15
|
-
|
16
12
|
# local run
|
17
13
|
|
18
14
|
`ruby christmas_tree.rb`
|
@@ -25,9 +21,19 @@ Ruby Gem:
|
|
25
21
|
|
26
22
|
# remote run
|
27
23
|
|
24
|
+
## use GEM
|
25
|
+
|
26
|
+
`gem exec christmas_tree`
|
27
|
+
|
28
|
+
### add your name
|
29
|
+
|
30
|
+
`gem exec christmas_tree --name=<yourname>`
|
31
|
+
|
32
|
+
## use Curl
|
33
|
+
|
28
34
|
`ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Mark24Code/christmas_tree/main/christmas_tree.rb)"`
|
29
35
|
|
30
|
-
|
36
|
+
### add your name
|
31
37
|
|
32
38
|
`ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Mark24Code/christmas_tree/main/christmas_tree.rb)" -- -n <your name>`
|
33
39
|
|
data/exe/christmas_tree
CHANGED
@@ -1,17 +1,23 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require '
|
3
|
-
require_relative '../lib/christmas_tree'
|
2
|
+
require 'optparse'
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
options = {}
|
5
|
+
OptionParser.new do |opts|
|
6
|
+
opts.banner = "Usage: christmas_tree [options]"
|
7
|
+
|
8
|
+
opts.on("-nNAME", "--name=NAME", "name") do |name|
|
9
|
+
options[:name] = name
|
10
|
+
end
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
opts.on("-mNAME", "--merry_to=NAME", "name") do |name|
|
13
|
+
options[:name] = name
|
14
|
+
end
|
15
|
+
end.parse!
|
14
16
|
|
17
|
+
|
18
|
+
begin
|
19
|
+
require 'curses'
|
20
|
+
require_relative '../lib/christmas_tree'
|
15
21
|
ChristmasTree::Tree.new(options[:name]).draw
|
16
22
|
ensure
|
17
23
|
Curses.close_screen
|
data/lib/christmas_tree.rb
CHANGED
@@ -1,15 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "christmas_tree/version"
|
4
|
-
|
5
|
-
require 'optparse'
|
6
4
|
require 'curses'
|
7
5
|
|
8
|
-
|
9
|
-
Curses.init_screen
|
10
|
-
Curses.noecho
|
11
|
-
Curses.curs_set(0)
|
12
|
-
|
13
6
|
COLORS_ORDER = [
|
14
7
|
:black, :red, :green, :yellow, :blue, :magenta, :cyan, :white,
|
15
8
|
:bright_black, :bright_red, :bright_green, :bright_yellow,
|
@@ -54,6 +47,7 @@ module ChristmasTree
|
|
54
47
|
class Tree
|
55
48
|
CHAR_SPACE = ' '
|
56
49
|
def initialize(name = nil, layer_count = 10)
|
50
|
+
init_curses
|
57
51
|
@name = name
|
58
52
|
@buffer_count = layer_count
|
59
53
|
@scale = 3
|
@@ -65,6 +59,12 @@ module ChristmasTree
|
|
65
59
|
@width = nil
|
66
60
|
end
|
67
61
|
|
62
|
+
def init_curses
|
63
|
+
Curses.init_screen
|
64
|
+
Curses.noecho
|
65
|
+
Curses.curs_set(0)
|
66
|
+
end
|
67
|
+
|
68
68
|
def tree_crown
|
69
69
|
(1..@buffer_count).each do |count|
|
70
70
|
total = 2*count-1
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: christmas_tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark24Code
|
@@ -36,7 +36,6 @@ files:
|
|
36
36
|
- README.md
|
37
37
|
- Rakefile
|
38
38
|
- christmas_tree.gemspec
|
39
|
-
- christmas_tree.rb
|
40
39
|
- demo.png
|
41
40
|
- exe/christmas_tree
|
42
41
|
- lib/christmas_tree.rb
|
data/christmas_tree.rb
DELETED
File without changes
|