let_it_fall 0.1.3 → 0.2.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 +3 -1
- data/lib/let_it_fall/cli.rb +34 -3
- data/lib/let_it_fall/code.rb +40 -25
- data/lib/let_it_fall/version.rb +1 -1
- data/lib/let_it_fall.rb +11 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f964116373d22bffa902bc202396b7765bd97ab9
|
4
|
+
data.tar.gz: 0755a7b71e74ebeb63a3996dda16e76449ac4fca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abd4b6a949fb9bb275bbaa40217e032685684230fc0c94782aa5f610275b68004c57514dad90231983e9458e55710953c8d12ae1f618bf2829cd6be73010ae53
|
7
|
+
data.tar.gz: 450123d36c94db052efaa36174f4f7ff229816567ce6602ec4e622914c78dd3f3bd069a343ebbc847d9b5cee7ead996d107cea01587a119a324b668ab9cf1caa
|
data/README.md
CHANGED
@@ -26,6 +26,8 @@ You also enjoy over 40 commands other than `beer` like `money`, `face` or `kanji
|
|
26
26
|
|
27
27
|
During the fall running, hitting a return key will change the character to fall.
|
28
28
|
|
29
|
+
Also `let_it_fall go` command let them fall in rotation automatically without the key hitting.
|
30
|
+
|
29
31
|
`code` command is a special. It takes one or more unicodes which specify characters to fall.
|
30
32
|
|
31
33
|
$ let_it_fall code 0x2660 0x2666 -r # code command with --range option
|
@@ -38,7 +40,7 @@ If you prefer another character rather than latin one, pass it to the command.
|
|
38
40
|
|
39
41
|
$ let_it_fall matrix kanji
|
40
42
|
|
41
|
-
These command takes `--speed` option(ex. -s=2), and some also takes `--color` option(ex. -c=31). `let_it_fall
|
43
|
+
These command takes `--speed` option(ex. -s=2), and some also takes `--color` option(ex. -c=31). `let_it_fall -h` for more info.
|
42
44
|
|
43
45
|
## Contributing
|
44
46
|
|
data/lib/let_it_fall/cli.rb
CHANGED
@@ -15,6 +15,7 @@ module LetItFall
|
|
15
15
|
|
16
16
|
desc "rand", "Let something fall randomly"
|
17
17
|
option :speed, aliases:'-s', default:1, type: :numeric
|
18
|
+
option :color, aliases:'-c', default:nil, type: :numeric
|
18
19
|
def rand
|
19
20
|
code = LetItFall::CODESET.keys.sample
|
20
21
|
run(code, options[:speed], options[:color], false)
|
@@ -27,7 +28,17 @@ module LetItFall
|
|
27
28
|
run(mark, options[:speed], options[:color], true)
|
28
29
|
end
|
29
30
|
|
30
|
-
desc "
|
31
|
+
desc "go", "Let it fall in rotation"
|
32
|
+
option :speed, aliases:'-s', default:2, type: :numeric
|
33
|
+
option :color, aliases:'-c', default:nil, type: :numeric
|
34
|
+
option :interval, aliases:'-i', default:3, type: :numeric
|
35
|
+
def go
|
36
|
+
code = LetItFall::CODESET.keys.sample
|
37
|
+
run(code, options[:speed], options[:color], false, options[:interval])
|
38
|
+
end
|
39
|
+
map "auto" => :go
|
40
|
+
|
41
|
+
desc "code CODE", "Let specific character fall by unicode(s)"
|
31
42
|
option :speed, aliases:'-s', default:1, type: :numeric
|
32
43
|
option :color, aliases:'-c', default:nil, type: :numeric
|
33
44
|
option :range, aliases:'-r', default:false, type: :boolean
|
@@ -41,6 +52,26 @@ module LetItFall
|
|
41
52
|
run(code, options[:speed], options[:color], options[:matrix])
|
42
53
|
end
|
43
54
|
|
55
|
+
desc "list", "List of all commands"
|
56
|
+
def list
|
57
|
+
puts "Commands:"
|
58
|
+
puts " let_it_fall MARK # Let any of following MARKs fall"
|
59
|
+
LetItFall::CODESET.keys.sort.each_with_index do |mark, i|
|
60
|
+
print "\n " if i%8==0
|
61
|
+
print mark, " "
|
62
|
+
end
|
63
|
+
puts "\n\n"
|
64
|
+
puts " let_it_fall matrix [MARK] # Let it matrix!"
|
65
|
+
puts " let_it_fall rand # Let something fall randomly"
|
66
|
+
puts " let_it_fall go # Let them Go!"
|
67
|
+
puts " let_it_fall code CODE # Let specific character fall by unicode(s) ex. code 0x2660"
|
68
|
+
puts " let_it_fall help [COMMAND] # Describe available commands or one specific command"
|
69
|
+
puts " let_it_fall version # Show LetItFall version"
|
70
|
+
end
|
71
|
+
map "commands" => :list
|
72
|
+
default_task :list
|
73
|
+
map "-h" => :list
|
74
|
+
|
44
75
|
desc "version", "Show LetItFall version"
|
45
76
|
def version
|
46
77
|
puts "LetItFall #{LetItFall::VERSION} (c) 2014 kyoendo"
|
@@ -48,10 +79,10 @@ module LetItFall
|
|
48
79
|
map "-v" => :version
|
49
80
|
|
50
81
|
no_tasks do
|
51
|
-
def run(name, speed, color, matrix)
|
82
|
+
def run(name, speed, color, matrix, auto=nil)
|
52
83
|
speed = 0.1 if speed < 0.1
|
53
84
|
interval = 0.05 / speed
|
54
|
-
Render.run(name, IO.console.winsize, interval:interval, color:color, matrix:matrix)
|
85
|
+
Render.run(name, IO.console.winsize, interval:interval, color:color, matrix:matrix, auto:auto)
|
55
86
|
end
|
56
87
|
end
|
57
88
|
end
|
data/lib/let_it_fall/code.rb
CHANGED
@@ -1,61 +1,76 @@
|
|
1
1
|
module LetItFall
|
2
2
|
CODESET = {
|
3
3
|
face: [*0x1F600..0x1F64F] - [*0x1F641..0x1F644],
|
4
|
-
kanji: (0x4E00..0x4F00),
|
5
4
|
snow: 0x2736,
|
6
|
-
time: (0x1F550..0x1f567),
|
7
|
-
animal: (0x1F40C..0x1F43C),
|
8
|
-
oreilly: (0x1F40C..0x1F43C),
|
9
|
-
food: (0x1F344..0x1F373),
|
10
|
-
love: (0x1F493..0x1F49F),
|
11
|
-
moon: (0x1F311..0x1F315),
|
12
5
|
gem: 0x1F48E,
|
13
6
|
python: 0x1F40D,
|
14
|
-
|
15
|
-
wine: 0x1F377,
|
7
|
+
ghost: 0x1F47B,
|
16
8
|
cocktail: 0x1F378,
|
9
|
+
kanji: (0x4E00..0x4F00),
|
17
10
|
juice: 0x1F379,
|
11
|
+
time: (0x1F550..0x1f567),
|
18
12
|
beer: 0x1F37A,
|
19
|
-
|
13
|
+
tower: 0x1F5FC,
|
14
|
+
sorry: 0x1F647,
|
20
15
|
cake: 0x1F382,
|
21
16
|
sparkle: 0x2728,
|
17
|
+
animal: (0x1F40C..0x1F43C),
|
22
18
|
cyclone: 0x1F300,
|
23
19
|
octopus: 0x1F419,
|
20
|
+
perl: 0x1F42A,
|
21
|
+
dancer: 0x1F483,
|
24
22
|
bee: 0x1F41D,
|
23
|
+
downarrow: 0x2935,
|
24
|
+
cross: 0x274C,
|
25
25
|
dolphin: 0x1F42C,
|
26
|
+
wine: 0x1F377,
|
27
|
+
food: (0x1F344..0x1F373),
|
28
|
+
japan: 0x1F5FE,
|
29
|
+
bikini: 0x1F459,
|
30
|
+
oden: 0x1F362,
|
31
|
+
wavy: 0x3030,
|
32
|
+
please: 0x1F64F,
|
33
|
+
apple: 0x1F34E,
|
26
34
|
paw: 0x1F43E,
|
27
35
|
eyes: 0x1F440,
|
28
|
-
|
29
|
-
|
36
|
+
smoking: 0x1F6AC,
|
37
|
+
m: 0x24C2,
|
38
|
+
thunder: 0x26A1,
|
39
|
+
toilet: 0x1F6BD,
|
40
|
+
cactus: 0x1F335,
|
30
41
|
mouth: 0x1F444,
|
31
|
-
|
32
|
-
|
33
|
-
|
42
|
+
love: (0x1F493..0x1F49F),
|
43
|
+
nose: 0x1F443,
|
44
|
+
snowman: 0x26C4,
|
45
|
+
latin: [*0x0021..0x007E, *0x00A1..0x00FF, *0x0100..0x017F, *0x0250..0x02AF],
|
34
46
|
poo: 0x1F4A9,
|
35
47
|
money: [0x1F4B0, 0x1F4B3, 0x1F4B4, 0x1F4B5, 0x1F4B6, 0x1F4B7, 0x1F4B8],
|
36
48
|
pushpin: 0x1F4CD,
|
49
|
+
ear: 0x1F442,
|
50
|
+
sushi: 0x1F363,
|
51
|
+
arrow: (0x2190..0x21FF),
|
37
52
|
hocho: 0x1F52A,
|
38
|
-
|
53
|
+
tongue: 0x1F445,
|
54
|
+
soccer: 0x26BD,
|
55
|
+
beers: 0x1F37B,
|
56
|
+
oreilly: (0x1F40C..0x1F43C),
|
39
57
|
beginner: 0x1F530,
|
40
58
|
helicopter: 0x1F681,
|
41
59
|
earth: [0x1F30D, 0x1F30E],
|
42
|
-
fuji: 0x1F5FB,
|
43
|
-
tower: 0x1F5FC,
|
44
|
-
japan: 0x1F5FE,
|
45
60
|
liberty: 0x1F5FD,
|
46
|
-
ghost: 0x1F47B,
|
47
61
|
angel: 0x1F47C,
|
48
62
|
alien: 0x1F47D,
|
63
|
+
uparrow: 0x2934,
|
64
|
+
pistol: 0x1F52B,
|
49
65
|
kiss: 0x1F48B,
|
50
66
|
alphabet: [*0x0041..0x005A, *0x0061..0x007A],
|
51
|
-
latin: [*0x0021..0x007E, *0x00A1..0x00FF, *0x0100..0x017F, *0x0250..0x02AF],
|
52
|
-
dingbat: (0x2701..0x27BF),
|
53
|
-
arrow: (0x2190..0x21FF),
|
54
67
|
pizza: 0x1F355,
|
55
|
-
|
56
|
-
sushi: 0x1F363,
|
68
|
+
dingbat: (0x2701..0x27BF),
|
57
69
|
naruto: 0x1F365,
|
70
|
+
moon: (0x1F311..0x1F315),
|
58
71
|
cookie: 0x1F36A,
|
72
|
+
christmas: [0x1F384, 0x1F385, 0x1F370],
|
73
|
+
fuji: 0x1F5FB,
|
59
74
|
lollipop: 0x1F36D,
|
60
75
|
|
61
76
|
}
|
data/lib/let_it_fall/version.rb
CHANGED
data/lib/let_it_fall.rb
CHANGED
@@ -4,11 +4,12 @@ require "let_it_fall/version"
|
|
4
4
|
|
5
5
|
module LetItFall
|
6
6
|
class Render
|
7
|
-
def self.run(mark, screen, color:nil, interval:0.1, matrix:false)
|
8
|
-
new(mark, screen, color:color, interval:interval, matrix:matrix).run
|
7
|
+
def self.run(mark, screen, color:nil, interval:0.1, matrix:false, auto:nil)
|
8
|
+
new(mark, screen, color:color, interval:interval, matrix:matrix, auto:auto).run
|
9
9
|
end
|
10
10
|
|
11
|
-
|
11
|
+
# auto: nil or interval time(Integer)
|
12
|
+
def initialize(mark, screen, color:nil, interval:0.1, matrix:false, auto:nil)
|
12
13
|
@y, @x = screen
|
13
14
|
if [nil, *31..37].include?(color)
|
14
15
|
@color = color
|
@@ -19,6 +20,7 @@ module LetItFall
|
|
19
20
|
@interval = interval
|
20
21
|
@screen = {}
|
21
22
|
@matrix = matrix
|
23
|
+
@auto = auto
|
22
24
|
$stdout.sync = true
|
23
25
|
end
|
24
26
|
|
@@ -35,7 +37,13 @@ module LetItFall
|
|
35
37
|
exit(0)
|
36
38
|
end
|
37
39
|
|
40
|
+
t = Time.now
|
38
41
|
loop do
|
42
|
+
if @auto && Time.now - t > @auto
|
43
|
+
marks = select_next_marks(@mark)
|
44
|
+
t = Time.now
|
45
|
+
end
|
46
|
+
|
39
47
|
print_marks(rand(@x), 0, marks)
|
40
48
|
sleep @interval
|
41
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: let_it_fall
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kyoendo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|