christmas_tree 0.2.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/exe/christmas_tree +15 -13
- 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/exe/christmas_tree
CHANGED
@@ -1,21 +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
|
-
|
12
|
+
opts.on("-mNAME", "--merry_to=NAME", "name") do |name|
|
13
|
+
options[:name] = name
|
14
|
+
end
|
15
|
+
end.parse!
|
13
16
|
|
14
|
-
opts.on("-mNAME", "--merry_to=NAME", "name") do |name|
|
15
|
-
options[:name] = name
|
16
|
-
end
|
17
|
-
end.parse!
|
18
17
|
|
18
|
+
begin
|
19
|
+
require 'curses'
|
20
|
+
require_relative '../lib/christmas_tree'
|
19
21
|
ChristmasTree::Tree.new(options[:name]).draw
|
20
22
|
ensure
|
21
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
|