shatty 0.0.1 → 0.0.3
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.
- data/Makefile +50 -0
- data/{shatty.rb → bin/shatty} +3 -4
- data/shatty.gemspec +20 -0
- data/web.rb +3 -1
- metadata +4 -2
data/Makefile
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
GEMSPEC=$(shell ls *.gemspec)
|
|
2
|
+
VERSION=$(shell awk -F\" '/spec.version/ { print $$2 }' $(GEMSPEC))
|
|
3
|
+
NAME=$(shell awk -F\" '/spec.name/ { print $$2 }' $(GEMSPEC))
|
|
4
|
+
GEM=$(NAME)-$(VERSION).gem
|
|
5
|
+
|
|
6
|
+
.PHONY: test
|
|
7
|
+
test:
|
|
8
|
+
sh notify-failure.sh ruby test/all.rb
|
|
9
|
+
|
|
10
|
+
.PHONY: testloop
|
|
11
|
+
testloop:
|
|
12
|
+
while true; do \
|
|
13
|
+
$(MAKE) test; \
|
|
14
|
+
$(MAKE) wait-for-changes; \
|
|
15
|
+
done
|
|
16
|
+
|
|
17
|
+
.PHONY: serve-coverage
|
|
18
|
+
serve-coverage:
|
|
19
|
+
cd coverage; python -mSimpleHTTPServer
|
|
20
|
+
|
|
21
|
+
.PHONY: wait-for-changes
|
|
22
|
+
wait-for-changes:
|
|
23
|
+
-inotifywait --exclude '\.swp' -e modify $$(find $(DIRS) -name '*.rb'; find $(DIRS) -type d)
|
|
24
|
+
|
|
25
|
+
.PHONY: package
|
|
26
|
+
package: | $(GEM)
|
|
27
|
+
|
|
28
|
+
.PHONY: gem
|
|
29
|
+
gem: $(GEM)
|
|
30
|
+
|
|
31
|
+
$(GEM):
|
|
32
|
+
gem build $(GEMSPEC)
|
|
33
|
+
|
|
34
|
+
.PHONY: test-package
|
|
35
|
+
test-package: $(GEM)
|
|
36
|
+
# Sometimes 'gem build' makes a faulty gem.
|
|
37
|
+
gem unpack $(GEM)
|
|
38
|
+
rm -rf $(NAME)-$(VERSION)/
|
|
39
|
+
|
|
40
|
+
.PHONY: publish
|
|
41
|
+
publish: test-package
|
|
42
|
+
gem push $(GEM)
|
|
43
|
+
|
|
44
|
+
.PHONY: install
|
|
45
|
+
install: $(GEM)
|
|
46
|
+
gem install $(GEM)
|
|
47
|
+
|
|
48
|
+
.PHONY: clean
|
|
49
|
+
clean:
|
|
50
|
+
-rm -rf .yardoc $(GEM) $(NAME)-$(VERSION)/
|
data/{shatty.rb → bin/shatty}
RENAMED
|
@@ -9,14 +9,13 @@ class Shatty < Clamp::Command
|
|
|
9
9
|
"where to output the recording to (a path or url)"
|
|
10
10
|
option "--headless", :flag,
|
|
11
11
|
"headless mode; don't output anything to stdout."
|
|
12
|
-
parameter "COMMAND ...", "The command to run",
|
|
13
|
-
:attribute_name => :command
|
|
12
|
+
parameter "[COMMAND] ...", "The command to run",
|
|
13
|
+
:attribute_name => :command, :default => ENV["SHELL"]
|
|
14
14
|
|
|
15
15
|
def execute
|
|
16
16
|
start = Time.now
|
|
17
|
-
|
|
18
17
|
if output.nil?
|
|
19
|
-
output = "http://r.logstash.net:8200/s/#{UUIDTools::UUID.random_create}"
|
|
18
|
+
self.output = "http://r.logstash.net:8200/s/#{UUIDTools::UUID.random_create}"
|
|
20
19
|
puts "Sending output to: #{output}"
|
|
21
20
|
end
|
|
22
21
|
|
data/shatty.gemspec
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Gem::Specification.new do |spec|
|
|
2
|
+
files = %x{git ls-files}.split("\n")
|
|
3
|
+
|
|
4
|
+
spec.name = "shatty"
|
|
5
|
+
spec.version = "0.0.3"
|
|
6
|
+
spec.summary = "shatty"
|
|
7
|
+
spec.description = "shatty"
|
|
8
|
+
spec.license = "none chosen yet"
|
|
9
|
+
|
|
10
|
+
# Note: You should set the version explicitly.
|
|
11
|
+
spec.add_dependency "cabin", ">0" # for logging. apache 2 license
|
|
12
|
+
spec.files = files
|
|
13
|
+
spec.require_paths << "lib"
|
|
14
|
+
spec.bindir = "bin"
|
|
15
|
+
|
|
16
|
+
spec.authors = ["Jordan Sissel"]
|
|
17
|
+
spec.email = ["jls@semicomplete.com"]
|
|
18
|
+
#spec.homepage = "..."
|
|
19
|
+
end
|
|
20
|
+
|
data/web.rb
CHANGED
|
@@ -30,13 +30,13 @@ class Session
|
|
|
30
30
|
def raw
|
|
31
31
|
return Enumerator.new do |y|
|
|
32
32
|
enumerator.each do |chunk|
|
|
33
|
-
puts decode(chunk).inspect
|
|
34
33
|
y << decode(chunk)
|
|
35
34
|
end
|
|
36
35
|
end # Enumerator
|
|
37
36
|
end # def enumerator
|
|
38
37
|
|
|
39
38
|
def decode(chunk)
|
|
39
|
+
headersize = [1,1].pack("GN").size
|
|
40
40
|
return chunk[headersize .. -1]
|
|
41
41
|
end # def decode
|
|
42
42
|
|
|
@@ -68,6 +68,7 @@ server = FTW::WebServer.new("0.0.0.0", port) do |request, response|
|
|
|
68
68
|
response["Content-Type"] = "text/plain"
|
|
69
69
|
if request["user-agent"] =~ /^curl\/[0-9]/
|
|
70
70
|
# Curl. Send raw text.
|
|
71
|
+
puts "curl request"
|
|
71
72
|
response.body = session.raw
|
|
72
73
|
else
|
|
73
74
|
response.body = session.enumerator
|
|
@@ -81,4 +82,5 @@ server = FTW::WebServer.new("0.0.0.0", port) do |request, response|
|
|
|
81
82
|
end
|
|
82
83
|
end
|
|
83
84
|
|
|
85
|
+
Thread.abort_on_exception = true
|
|
84
86
|
server.run
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shatty
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -36,12 +36,14 @@ extra_rdoc_files: []
|
|
|
36
36
|
files:
|
|
37
37
|
- Gemfile
|
|
38
38
|
- Gemfile.lock
|
|
39
|
+
- Makefile
|
|
39
40
|
- Procfile
|
|
40
41
|
- README.md
|
|
42
|
+
- bin/shatty
|
|
41
43
|
- examples/blinkenlights.shatty
|
|
42
44
|
- examples/output.shatty
|
|
43
45
|
- misc/shatty.go
|
|
44
|
-
- shatty.
|
|
46
|
+
- shatty.gemspec
|
|
45
47
|
- web.rb
|
|
46
48
|
homepage:
|
|
47
49
|
licenses:
|