teeny 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/teeny +5 -0
- data/lib/teeny.rb +31 -0
- data/lib/teeny/version.rb +3 -0
- metadata +75 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 20b9f46a8ba05d3d5dd6576ca5b1fd3c5cb366d5
|
4
|
+
data.tar.gz: 31dac765d0d57184235a81a13b6a60834dbf8350
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b8fe22023254ff19e951711039dd8715752fe4a455d93a2ae07432d87e2af23dae0c290cc69c47dfed4125786046df2aab947fe17cfeb4aaeae43f4fec79ffbc
|
7
|
+
data.tar.gz: f0e85a4bdbdf37a8ee1896d43dce6b85867ccc053483afe8cbea4f9201c90587a41047b61989b6e9b10e3e15312722abd5fa6d5d303584edf123e9d0cb60be30
|
data/bin/teeny
ADDED
data/lib/teeny.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'teeny/version'
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'sinatra'
|
5
|
+
|
6
|
+
class Teeny::Server < Sinatra::Base
|
7
|
+
HTTP_METHODS = ['get', 'post', 'put', 'delete']
|
8
|
+
|
9
|
+
before do
|
10
|
+
headers 'Access-Control-Allow-Origin' => '*'
|
11
|
+
end
|
12
|
+
|
13
|
+
Dir['**/*.rb'].each do |file|
|
14
|
+
method = File.basename(file, '.rb')
|
15
|
+
next if !HTTP_METHODS.include?(method)
|
16
|
+
|
17
|
+
path = File.dirname(file)
|
18
|
+
path = '' if path == '.'
|
19
|
+
|
20
|
+
ruby = File.read(file)
|
21
|
+
|
22
|
+
self.send method, "/#{path}" do
|
23
|
+
content_type :json
|
24
|
+
eval(ruby, get_binding(params, request.env)).to_json
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_binding(params, env)
|
30
|
+
binding
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: teeny
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dan Tao
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sinatra
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
description: A tool that lets you make a teeny service by just writing a script
|
42
|
+
email: daniel.tao@gmail.com
|
43
|
+
executables:
|
44
|
+
- teeny
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- bin/teeny
|
49
|
+
- lib/teeny.rb
|
50
|
+
- lib/teeny/version.rb
|
51
|
+
homepage: https://github.com/dtao/teeny
|
52
|
+
licenses:
|
53
|
+
- MIT
|
54
|
+
metadata: {}
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options: []
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
requirements: []
|
70
|
+
rubyforge_project:
|
71
|
+
rubygems_version: 2.2.2
|
72
|
+
signing_key:
|
73
|
+
specification_version: 4
|
74
|
+
summary: Make teeny tiny services
|
75
|
+
test_files: []
|