lgm 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/bin/lgm +9 -0
- data/server/Gemfile +4 -0
- data/server/Gemfile.lock +18 -0
- data/server/app.rb +43 -0
- data/server/config.ru +3 -0
- data/server/link.rb +14 -0
- data/static/dist/index.html +1 -0
- data/static/dist/main.js +10919 -0
- metadata +79 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f4bfb2208678b420a8e0aca9e926eeb843636d5a
|
4
|
+
data.tar.gz: 263966e8af9be3359b361730fe305d6e0edcb560
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ea7b1c30c18b60f18c758421b4fdae6ff95c77724353a72840b8855977878392100c1c1f2f375d14722e0ebc05f9e7afff126f8ec1cc1dce1c1da527ae09090c
|
7
|
+
data.tar.gz: 5db652eaac2ed220389bac38c1d0889c0dfafcadff3ad56b6ee0e7866850047f707a31dca44f36447af3b3e61fc6f71d841db1c1d03eef7e9798674c34e44d9c
|
data/bin/lgm
ADDED
data/server/Gemfile
ADDED
data/server/Gemfile.lock
ADDED
data/server/app.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'hobby'
|
2
|
+
require 'hobby/json'
|
3
|
+
|
4
|
+
require_relative 'link'
|
5
|
+
LINKS = [Link.new('/main.js'), Link.new('/another.html')]
|
6
|
+
|
7
|
+
class API
|
8
|
+
include Hobby
|
9
|
+
include JSON
|
10
|
+
|
11
|
+
get '/links' do
|
12
|
+
LINKS
|
13
|
+
end
|
14
|
+
|
15
|
+
post '/links' do
|
16
|
+
link = Link.new json['link']
|
17
|
+
|
18
|
+
if link.valid?
|
19
|
+
LINKS << link
|
20
|
+
link
|
21
|
+
else
|
22
|
+
response.status = 422
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class App
|
28
|
+
include Hobby
|
29
|
+
|
30
|
+
def initialize path
|
31
|
+
@path = path
|
32
|
+
end
|
33
|
+
|
34
|
+
map '/api', API.new
|
35
|
+
|
36
|
+
get do
|
37
|
+
IO.read "#{@path}/index.html"
|
38
|
+
end
|
39
|
+
|
40
|
+
get '/:name.:ext' do
|
41
|
+
IO.read "#{@path}/#{my[:name]}.#{my[:ext]}"
|
42
|
+
end
|
43
|
+
end
|
data/server/config.ru
ADDED
data/server/link.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
class Link
|
2
|
+
def initialize string
|
3
|
+
@string = string
|
4
|
+
end
|
5
|
+
|
6
|
+
def valid?
|
7
|
+
['http://', 'https://'].any? { |prefix| @string.start_with? prefix } &&
|
8
|
+
@string.include?(?.)
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_json _state = nil # JSON::Ext::Generator::State
|
12
|
+
@string.to_json
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<!DOCTYPE html><head><title>CRM | Lead Gathering Machine</title><meta charset="utf-8"></head><body><div id="main"></div><script type="text/javascript" src="main.js?cb363ee1309d44ca25a9"></script></body>
|