yankee 0.0.3 → 0.0.5
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/api.rb +33 -6
- data/bin/yankee +13 -3
- data/yankee.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7553f8472892bc9593722960302c8f1fdf1cdf97
|
4
|
+
data.tar.gz: a4eb59ac5b2082efb1e4cc56c40f4b24c85b7d29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4971015df11e4ee393971860399078a527850211564268ab16db39b10efcde7abf06465eb1115bf75ac1591a0150eb1c9a9d900dad2d5591a68697de9ce14f78
|
7
|
+
data.tar.gz: c244600fc065aaa635d766f57cdf0f4330c6ffc1b1c76aa3a71ec27b3e771d6ebb16772bd727554667c40fb726c99dfaf77643aec76579669c05efcab0f269aa
|
data/api.rb
CHANGED
@@ -1,11 +1,38 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'sinatra'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
class Yankee < Sinatra::Base
|
5
|
+
|
6
|
+
set :env, :production
|
7
|
+
set :port, 8888
|
8
|
+
set :static, true # set up static file routing
|
9
|
+
#set :public, File.expand_path('..', __FILE__) # set up the static dir (with images/js/css inside)
|
10
|
+
|
11
|
+
#set :views, File.expand_path('../views', __FILE__) # set up the views dir
|
12
|
+
#set :haml, { :format => :html5 } # if you use haml
|
13
|
+
|
14
|
+
before do
|
15
|
+
#raise "XXX - SECURITY - You should set an API key!"
|
16
|
+
#error 401 unless params[:key] =~ /^WHATEVER/
|
17
|
+
end
|
18
|
+
|
19
|
+
get '/' do
|
20
|
+
|
21
|
+
sort = params["sort"]
|
22
|
+
|
23
|
+
if sort == "Modified"
|
24
|
+
entries = Dir.entries('.').sort_by { |x| File.mtime(x) }
|
25
|
+
else
|
26
|
+
entries = Dir.entries('.').sort_by { |x| File.size(x) }
|
27
|
+
end
|
8
28
|
|
9
|
-
|
10
|
-
|
29
|
+
out = []
|
30
|
+
out << "<table>"
|
31
|
+
out << "<tr><td>Filename</td><td><a href=/?sort=>Size</a><td><td><a href=/?sort=Modified>Modified</a><td></tr><br/>"
|
32
|
+
entries.map do |e|
|
33
|
+
out << "<tr><td>#{e}</td><td>#{File.size(e)}<td><td>#{File.mtime(e)}<td></tr><br/>"
|
34
|
+
end
|
35
|
+
out << "</table>"
|
36
|
+
out.join("\n")
|
37
|
+
end
|
11
38
|
end
|
data/bin/yankee
CHANGED
@@ -1,4 +1,14 @@
|
|
1
|
-
#!/bin/
|
2
|
-
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
begin
|
4
|
+
require_relative '../api.rb'
|
5
|
+
# Run the app!
|
6
|
+
#
|
7
|
+
puts "Hello, you're running yankee from a gem!"
|
8
|
+
Yankee.run!
|
3
9
|
|
4
|
-
|
10
|
+
rescue LoadError => e
|
11
|
+
#$:.unshift(path) if File.directory?(path) && !$:.include?(path)
|
12
|
+
puts "Unable to load api"
|
13
|
+
|
14
|
+
end
|
data/yankee.gemspec
CHANGED