star_wars 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/star_wars.rb +89 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c1c33ddbf0dd4e9b7511f3cf3ac669ce9e6b180c
|
4
|
+
data.tar.gz: ec2aace375c627c7399648314035aee84f62512a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8b6d900dc12ed5f1987defdefede9b1f0ae73553267a9b8775e3cbdbcbe8f41c649b86f9f4e78b484565a00d9495cf2de04196ab4bb0c8c773923a1b1ede64df
|
7
|
+
data.tar.gz: 664c9bac872a1d22d4b6ba5bfc2a38a96c1b99196daa495ac91eb10d6e84eee4b085e0b50f82e4b32d56eb80881ed4e547e89575d75eb1ffef729c2b928df365
|
data/lib/star_wars.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
class String
|
2
|
+
def yellow
|
3
|
+
"\e[33m#{self}\e[0m"
|
4
|
+
end
|
5
|
+
|
6
|
+
def blue
|
7
|
+
"\e[36m#{self}\e[0m"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class StarWars
|
12
|
+
@cols = `/usr/bin/env tput cols`.to_i
|
13
|
+
|
14
|
+
def self.opening_crawl(episode = 'IV')
|
15
|
+
system "clear" or system "cls"
|
16
|
+
|
17
|
+
clear
|
18
|
+
|
19
|
+
puts 'A long time ago, in a galaxy far, far away....'.blue.center(@cols)
|
20
|
+
sleep(2)
|
21
|
+
|
22
|
+
clear
|
23
|
+
|
24
|
+
title
|
25
|
+
|
26
|
+
case episode
|
27
|
+
when 'I'
|
28
|
+
title = "Episode I|THE PHANTOM MENACE"
|
29
|
+
when 'II'
|
30
|
+
title = "Episode II|ATTACK OF THE CLONES"
|
31
|
+
when 'III'
|
32
|
+
title = "Episode III|REVENGE OF THE SITH"
|
33
|
+
when 'V'
|
34
|
+
title = "Episode V|THE EMPIRE STRIKES BACK"
|
35
|
+
when 'VI'
|
36
|
+
title = 'Episode VI|RETURN OF THE JEDI'
|
37
|
+
else
|
38
|
+
title = ""
|
39
|
+
end
|
40
|
+
|
41
|
+
title.split('|').each do |title|
|
42
|
+
puts title.yellow.center(@cols)
|
43
|
+
end
|
44
|
+
|
45
|
+
puts ''
|
46
|
+
sleep(1)
|
47
|
+
|
48
|
+
crawl = "It is a period of civil war.|Rebel spaceships, striking|from a hidden base, have|won their first victory|against the evil Galactic Empire.||During the battle, rebel spies managed|to steal secret plans to the Empire's|ultimate weapon, the DEATH STAR, an|armored space station with enough|power to destroy an entire planet.||Pursued by the Empire's sinister agents,|Princess Leia races home aboard her|starship, custodian of the stolen plans|that can save her people and restore|freedom to the galaxy...."
|
49
|
+
crawl.split('|').each do |line|
|
50
|
+
puts line.yellow.center(@cols)
|
51
|
+
sleep(1)
|
52
|
+
end
|
53
|
+
|
54
|
+
100.times { puts ""; sleep(1) }
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.clear
|
58
|
+
1000.times { puts "" }
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.title
|
62
|
+
puts '
|
63
|
+
_________________ ____ __________
|
64
|
+
. . / | / \ . | \
|
65
|
+
. / ______ _____| . / \ | ___ | . .
|
66
|
+
\ \ | | / /\ \ | |___> |
|
67
|
+
. \ \ | | / /__\ \ . | _/ .
|
68
|
+
. ________> | | | . / \ | |\ \_______ .
|
69
|
+
| / | | / ______ \ | | \ |
|
70
|
+
|___________/ |___| /____/ \____\ |___| \__________| .
|
71
|
+
. ____ __ . _____ ____ . __________ . _________
|
72
|
+
\ \ / \ / / / \ | \ / | .
|
73
|
+
\ \/ \/ / / \ | ___ | / ______| .
|
74
|
+
\ / / /\ \ . | |___> | \ \
|
75
|
+
. \ / / /__\ \ | _/. \ \
|
76
|
+
\ /\ / / \ | |\ \______> | .
|
77
|
+
\ / \ / / ______ \ | | \ / .
|
78
|
+
. . \/ \/ /____/ \____\ |___| \____________/
|
79
|
+
.
|
80
|
+
. .
|
81
|
+
'.yellow.center(@cols)
|
82
|
+
|
83
|
+
sleep(2)
|
84
|
+
|
85
|
+
10.times { puts ""; sleep(1) }
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# StarWars.opening_crawl()
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: star_wars
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Harry Llewelyn
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-11 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Star Wars meets Ruby
|
14
|
+
email: harry@ratherneat.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/star_wars.rb
|
20
|
+
homepage: https://github.com/Advocation/star_wars
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.2.0
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Star Wars
|
44
|
+
test_files: []
|