lissio 0.1.0.beta1 → 0.1.0.beta2
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/bin/lissio +109 -0
- data/lib/lissio/server.rb +13 -2
- data/opal/lissio/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba686a58493d5a65eccdfdda13e86be6e55f9a72
|
4
|
+
data.tar.gz: ba343a782067081ac72f45ad92ff7c1d25066ba0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e6e28f0c18e06921d7034c4caaa90b51056dcb08e53a108966defdd29099de4d0d3bf12660f4ade34e01d40f50427ed703784d05a93634ad558184d0b68c67b
|
7
|
+
data.tar.gz: 5d60664168434ecdf79ca32c21305c79cf76aa955299461d9a1f16d6ead3d9cbca4333ba2d867335a667bcb2bd43d70333cc041506f9f0272e230b4ca4bbbdbc
|
data/bin/lissio
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
if File.exists?('Gemfile')
|
4
|
+
require 'bundler'
|
5
|
+
Bundler.require
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'thor'
|
9
|
+
require 'rack'
|
10
|
+
require 'lissio'
|
11
|
+
require 'fileutils'
|
12
|
+
|
13
|
+
class CLI < Thor
|
14
|
+
desc "start [OPTIONS]", "start the lissio server"
|
15
|
+
|
16
|
+
option :server, type: :string
|
17
|
+
option :port, type: :numeric, default: 9001
|
18
|
+
option :host, type: :string, default: '0.0.0.0'
|
19
|
+
option :use, type: :array, default: []
|
20
|
+
option :path, type: :array, default: ['app', 'js']
|
21
|
+
option :static, type: :array, default: ['/css', '/fonts', '/img']
|
22
|
+
option :index, type: :string
|
23
|
+
option :debug, type: :boolean
|
24
|
+
|
25
|
+
def start
|
26
|
+
options[:use].each {|u|
|
27
|
+
require u
|
28
|
+
}
|
29
|
+
|
30
|
+
Rack::Server.start(
|
31
|
+
Host: options[:host],
|
32
|
+
Port: options[:port],
|
33
|
+
|
34
|
+
app: Lissio::Server.new {|s|
|
35
|
+
options[:path].each {|path|
|
36
|
+
s.append_path path
|
37
|
+
}
|
38
|
+
|
39
|
+
s.static = options[:static]
|
40
|
+
|
41
|
+
if index = options[:index]
|
42
|
+
s.index = index
|
43
|
+
end
|
44
|
+
|
45
|
+
if options[:debug]
|
46
|
+
s.debug = true
|
47
|
+
end
|
48
|
+
})
|
49
|
+
end
|
50
|
+
|
51
|
+
desc "new [PATH]", "create a new lissio application"
|
52
|
+
def new(path = '.')
|
53
|
+
FileUtils.mkpath path
|
54
|
+
FileUtils.cd path do
|
55
|
+
FileUtils.mkdir 'app'
|
56
|
+
FileUtils.mkdir 'css'
|
57
|
+
FileUtils.mkdir 'js'
|
58
|
+
FileUtils.mkdir 'img'
|
59
|
+
FileUtils.mkdir 'fonts'
|
60
|
+
|
61
|
+
File.open 'index.html.erb', 'w' do |f|
|
62
|
+
f.puts <<-HTML.gsub(/^\t+/, '')
|
63
|
+
<!DOCTYPE html>
|
64
|
+
<html>
|
65
|
+
<head>
|
66
|
+
<meta charset="utf-8">
|
67
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
68
|
+
<title>Vai col lissio!</title>
|
69
|
+
|
70
|
+
<%= lissio 'app' %>
|
71
|
+
</head>
|
72
|
+
<body>
|
73
|
+
</body>
|
74
|
+
</html>
|
75
|
+
HTML
|
76
|
+
end
|
77
|
+
|
78
|
+
File.open 'app/app.rb', 'w' do |f|
|
79
|
+
f.puts <<-RUBY.gsub(/^\t+/, '')
|
80
|
+
require 'opal'
|
81
|
+
require 'lissio'
|
82
|
+
|
83
|
+
class Application < Lissio::Application
|
84
|
+
def initialize
|
85
|
+
super
|
86
|
+
|
87
|
+
route '/' do
|
88
|
+
alert "hello"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
html do
|
93
|
+
div "Vai col lissio!"
|
94
|
+
end
|
95
|
+
|
96
|
+
css do
|
97
|
+
rule 'body' do
|
98
|
+
font size: 42.px
|
99
|
+
text align: :center
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
RUBY
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
CLI.start(ARGV)
|
data/lib/lissio/server.rb
CHANGED
@@ -3,6 +3,7 @@ require 'rack/urlmap'
|
|
3
3
|
require 'rack/builder'
|
4
4
|
require 'rack/directory'
|
5
5
|
require 'rack/showexceptions'
|
6
|
+
|
6
7
|
require 'opal/source_map'
|
7
8
|
require 'opal/sprockets/environment'
|
8
9
|
|
@@ -28,7 +29,7 @@ class Server
|
|
28
29
|
end
|
29
30
|
end
|
30
31
|
|
31
|
-
class
|
32
|
+
class Prerender
|
32
33
|
def initialize(app, server)
|
33
34
|
@app = app
|
34
35
|
@server = server
|
@@ -106,6 +107,16 @@ class Server
|
|
106
107
|
block.call(self) if block
|
107
108
|
end
|
108
109
|
|
110
|
+
def path=(values)
|
111
|
+
values.each { |path|
|
112
|
+
append_path path
|
113
|
+
}
|
114
|
+
end
|
115
|
+
|
116
|
+
def append_static(path)
|
117
|
+
(@static ||= []) << path
|
118
|
+
end
|
119
|
+
|
109
120
|
def source_maps?
|
110
121
|
@source_maps
|
111
122
|
end
|
@@ -131,7 +142,7 @@ class Server
|
|
131
142
|
end
|
132
143
|
end
|
133
144
|
|
134
|
-
use
|
145
|
+
use Prerender, this
|
135
146
|
use Rack::Static, urls: this.static if this.static
|
136
147
|
|
137
148
|
instance_exec(&block) if block
|
data/opal/lissio/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lissio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- meh.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
@@ -96,7 +96,8 @@ dependencies:
|
|
96
96
|
version: '0'
|
97
97
|
description: ".."
|
98
98
|
email: meh@schizofreni.co
|
99
|
-
executables:
|
99
|
+
executables:
|
100
|
+
- lissio
|
100
101
|
extensions: []
|
101
102
|
extra_rdoc_files: []
|
102
103
|
files:
|
@@ -105,6 +106,7 @@ files:
|
|
105
106
|
- Gemfile.lock
|
106
107
|
- README.md
|
107
108
|
- Rakefile
|
109
|
+
- bin/lissio
|
108
110
|
- lib/lissio.rb
|
109
111
|
- lib/lissio/server.rb
|
110
112
|
- lissio.gemspec
|