space_station 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/space_station.rb +28 -16
- data/lib/space_station/version.rb +1 -1
- data/space_station.gemspec +3 -3
- metadata +6 -14
- data/lib/space_station/airplane.rb +0 -8
- data/lib/space_station/apollo.rb +0 -8
- data/lib/space_station/darth_vader.rb +0 -8
- data/lib/space_station/f16.rb +0 -8
- data/lib/space_station/middle_finger.rb +0 -8
- data/lib/space_station/space_shuttle.rb +0 -7
- data/lib/space_station/ufo.rb +0 -9
- data/lib/space_station/unicorn.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d905781df0dcd51970885bb4bbd620325372cd63
|
4
|
+
data.tar.gz: 5c2fcd742c5ba382ed6e7bb89cb2643aa4596847
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53151669ac8013c4fe6c828fe42736da7b4afe4287743007197b13922b7d6c77c122dfd0a2c0bd308a13ae8594a31398e3dcb7381a020cd173428b7ab0321969
|
7
|
+
data.tar.gz: 0f86b5843924a077fcaafbb08819e8f5cf6690a2be9a7ea45d9600fe3d86b65ebf7703bd2d74aa92b97a99c2eee644cd951aba4048241c3e4d94fb6a0a737d85
|
data/lib/space_station.rb
CHANGED
@@ -1,30 +1,42 @@
|
|
1
1
|
require "space_station/version"
|
2
2
|
|
3
3
|
module SpaceStation
|
4
|
-
|
5
|
-
ASCII_PATH = File.join(File.dirname(__FILE__), '/space_station/ascii/')
|
4
|
+
ASCII_PATH = File.join(File.dirname(__FILE__), '/space_station/ascii').freeze
|
6
5
|
|
7
|
-
|
8
|
-
|
6
|
+
class Station
|
7
|
+
def initialize(app, options = {})
|
8
|
+
@app = app
|
9
|
+
@ascii_art =
|
10
|
+
self.class.name.split('::').last.gsub(/([a-z\d])([A-Z])/,'\1_\2').downcase
|
11
|
+
@msg = options.fetch(:msg, nil)
|
9
12
|
end
|
10
13
|
|
11
14
|
def call(env)
|
12
|
-
|
15
|
+
to_write = @msg || IO.read("#{SpaceStation::ASCII_PATH}/#{@ascii_art}") rescue ''
|
16
|
+
log_before_response(to_write)
|
13
17
|
|
14
18
|
@app.call(env)
|
15
19
|
end
|
16
20
|
|
17
|
-
|
18
|
-
|
21
|
+
protected
|
22
|
+
|
23
|
+
def log_before_response(to_write)
|
24
|
+
puts "*" * 69
|
25
|
+
puts self.class.name
|
26
|
+
puts "VS"
|
27
|
+
puts @ascii_art
|
28
|
+
puts to_write
|
29
|
+
# begin
|
30
|
+
# puts IO.read("#{SpaceStation::ASCII_PATH}/#{to_write}")
|
31
|
+
# rescue
|
32
|
+
# puts ''
|
33
|
+
# end
|
19
34
|
end
|
20
35
|
end
|
21
|
-
end
|
22
36
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
require 'space_station/middle_finger'
|
30
|
-
require 'space_station/unicorn'
|
37
|
+
Dir.entries(ASCII_PATH).select { |f| !File.directory? f }.each do |ascii_file|
|
38
|
+
klass = Class.new(SpaceStation::Station)
|
39
|
+
klass_name = ascii_file.to_s.split('_').collect(&:capitalize).join
|
40
|
+
SpaceStation.const_set(klass_name, klass)
|
41
|
+
end
|
42
|
+
end
|
data/space_station.gemspec
CHANGED
@@ -6,12 +6,12 @@ require 'space_station/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "space_station"
|
8
8
|
spec.version = SpaceStation::VERSION
|
9
|
-
spec.authors = ["
|
10
|
-
spec.email = ["
|
9
|
+
spec.authors = ["aaoiki"]
|
10
|
+
spec.email = ["aaoiki7@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{Transform your rack app into a space station!}
|
13
13
|
spec.description = %q{A toy gem dedicated to clients and project managers who make silly and unrealistic requirements}
|
14
|
-
spec.homepage = "https://github.com/
|
14
|
+
spec.homepage = "https://github.com/aaoiki/space_station"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: space_station
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- aaoiki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -55,7 +55,7 @@ dependencies:
|
|
55
55
|
description: A toy gem dedicated to clients and project managers who make silly and
|
56
56
|
unrealistic requirements
|
57
57
|
email:
|
58
|
-
-
|
58
|
+
- aaoiki7@gmail.com
|
59
59
|
executables: []
|
60
60
|
extensions: []
|
61
61
|
extra_rdoc_files: []
|
@@ -70,8 +70,6 @@ files:
|
|
70
70
|
- bin/console
|
71
71
|
- bin/setup
|
72
72
|
- lib/space_station.rb
|
73
|
-
- lib/space_station/airplane.rb
|
74
|
-
- lib/space_station/apollo.rb
|
75
73
|
- lib/space_station/ascii/airplane
|
76
74
|
- lib/space_station/ascii/apollo
|
77
75
|
- lib/space_station/ascii/darth_vader
|
@@ -80,16 +78,10 @@ files:
|
|
80
78
|
- lib/space_station/ascii/space_shuttle
|
81
79
|
- lib/space_station/ascii/ufo
|
82
80
|
- lib/space_station/ascii/unicorn
|
83
|
-
- lib/space_station/darth_vader.rb
|
84
|
-
- lib/space_station/f16.rb
|
85
|
-
- lib/space_station/middle_finger.rb
|
86
|
-
- lib/space_station/space_shuttle.rb
|
87
|
-
- lib/space_station/ufo.rb
|
88
|
-
- lib/space_station/unicorn.rb
|
89
81
|
- lib/space_station/version.rb
|
90
82
|
- space_station.gemspec
|
91
83
|
- ufo_example.png
|
92
|
-
homepage: https://github.com/
|
84
|
+
homepage: https://github.com/aaoiki/space_station
|
93
85
|
licenses:
|
94
86
|
- MIT
|
95
87
|
metadata: {}
|
@@ -109,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
101
|
version: '0'
|
110
102
|
requirements: []
|
111
103
|
rubyforge_project:
|
112
|
-
rubygems_version: 2.
|
104
|
+
rubygems_version: 2.6.11
|
113
105
|
signing_key:
|
114
106
|
specification_version: 4
|
115
107
|
summary: Transform your rack app into a space station!
|
data/lib/space_station/apollo.rb
DELETED
data/lib/space_station/f16.rb
DELETED
data/lib/space_station/ufo.rb
DELETED