tzispa 0.3.4 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/LICENSE +21 -0
- data/README.md +50 -1
- data/bin/tzispa +4 -0
- data/lib/tzispa/app.rb +11 -10
- data/lib/tzispa/bin/tzispa +4 -0
- data/lib/tzispa/cli.rb +19 -0
- data/lib/tzispa/command/app.rb +86 -0
- data/lib/tzispa/command/cli/generate.rb +41 -0
- data/lib/tzispa/command/project.rb +257 -0
- data/lib/tzispa/command/rig.rb +26 -0
- data/lib/tzispa/config/appconfig.rb +65 -0
- data/lib/tzispa/config/routes.rb +8 -8
- data/lib/tzispa/config/yaml.rb +6 -0
- data/lib/tzispa/context.rb +1 -1
- data/lib/tzispa/controller/layout.rb +1 -0
- data/lib/tzispa/domain.rb +4 -4
- data/lib/tzispa/http/context.rb +1 -0
- data/lib/tzispa/version.rb +1 -1
- data/tzispa.gemspec +31 -0
- metadata +45 -7
- data/lib/tzispa/config/webconfig.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd74c98b9c732e76ab7fa87e760664c4bb1770db
|
4
|
+
data.tar.gz: 0c805105cfede7ef61edced4d066e510db90000a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36d1a0becbad7b32e90cce228d2ff4a6c291ba02cc3390af297ec98de4aeb8b75249836425b1a275eb1d9dfa6ae66dc6e8e028c0a73344b3f95a361dce4085d7
|
7
|
+
data.tar.gz: ffa0c807d47a7f36e038d4cc757e1c9f422c0f87a0833f00b454683f4af10d5daa770089e150e85258a3aab6e6a60366b9dd5a390b3b94cd79924d6c7f4851ba
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@ Tzispa
|
|
2
2
|
|
3
3
|
General purpose web framework
|
4
4
|
|
5
|
+
## v0.4.0
|
6
|
+
- Added basic cli command engine
|
7
|
+
- Added some documentation in README.md
|
8
|
+
|
5
9
|
## v0.3.3
|
6
10
|
- Added internationalization support with i18n
|
7
11
|
- Created new config folder in each domain to store all configurations
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Juan Antonio Piñero
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,3 +1,52 @@
|
|
1
|
-
Tzispa
|
1
|
+
# Tzispa
|
2
2
|
|
3
3
|
A sparkling web framework
|
4
|
+
|
5
|
+
## Frameworks
|
6
|
+
|
7
|
+
Tzispa is composed by these frameworks:
|
8
|
+
|
9
|
+
* [**Tzispa::Rig**](https://github.com/japiber/tzispa_rig) - Template engine
|
10
|
+
* [**Tzispa::Utils**](https://github.com/japiber/tzispa_utils) - Ruby class utilities
|
11
|
+
* [**Tzispa::Helpers**](https://github.com/japiber/tzispa_helpers) - Helper modules
|
12
|
+
* [**Tzispa::Data**](https://github.com/japiber/tzispa_data) - Data access layer
|
13
|
+
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
```shell
|
18
|
+
% gem install tzispa
|
19
|
+
```
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```shell
|
24
|
+
% tzispa generate project myproject
|
25
|
+
% cd myproject
|
26
|
+
% tzispa generate app mainapp --host=www.mynewsite.com
|
27
|
+
% puma start.ru
|
28
|
+
```
|
29
|
+
|
30
|
+
## Adding more apps
|
31
|
+
|
32
|
+
Tzispa support multi-app projects. Each app must have a unique mount path
|
33
|
+
|
34
|
+
```shell
|
35
|
+
% tzispa generate app adminapp --host=www.mynewsite.com --mount=admin
|
36
|
+
```
|
37
|
+
|
38
|
+
## Adding templates
|
39
|
+
|
40
|
+
There are 3 template types: layout, static and block:
|
41
|
+
|
42
|
+
* layout: these are the skeleton entry points of the rig templates
|
43
|
+
* static: these are "light" templates that are a included without any processing as plain text
|
44
|
+
* block: the true core of the rig templates, each block template file has an associated ruby file with the template binder class
|
45
|
+
|
46
|
+
```shell
|
47
|
+
% tzispa generate rig lister --type=layout --app=mainapp
|
48
|
+
% tzispa generate rig sitefoot --type=static --app=mainapp
|
49
|
+
% tzispa generate rig product_detail --type=block --app=mainapp
|
50
|
+
```
|
51
|
+
|
52
|
+
Work in progress ...
|
data/bin/tzispa
ADDED
data/lib/tzispa/app.rb
CHANGED
@@ -4,7 +4,7 @@ require 'forwardable'
|
|
4
4
|
require 'logger'
|
5
5
|
require 'i18n'
|
6
6
|
require 'tzispa/domain'
|
7
|
-
require 'tzispa/config/
|
7
|
+
require 'tzispa/config/appconfig'
|
8
8
|
require 'tzispa/config/routes'
|
9
9
|
require 'tzispa/middleware'
|
10
10
|
require 'tzispa_data'
|
@@ -46,10 +46,11 @@ module Tzispa
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def mount(mount_point, builder)
|
49
|
-
self.
|
50
|
-
|
51
|
-
|
52
|
-
|
49
|
+
self.new.tap { |app|
|
50
|
+
self.routes ||= Config::Routes.new(mount_point)
|
51
|
+
yield(routes)
|
52
|
+
app.middleware.map mount_point, builder
|
53
|
+
}
|
53
54
|
end
|
54
55
|
|
55
56
|
def router
|
@@ -59,9 +60,10 @@ module Tzispa
|
|
59
60
|
end
|
60
61
|
|
61
62
|
def initialize(domain_name)
|
62
|
-
@domain = Domain.new(
|
63
|
-
@middleware =
|
63
|
+
@domain = Domain.new(domain_name)
|
64
|
+
@middleware = Middleware.new self
|
64
65
|
I18n.load_path = Dir["config/locales/*.yml"]
|
66
|
+
@config = Config::AppConfig.new(@domain).load!
|
65
67
|
end
|
66
68
|
|
67
69
|
def call(env)
|
@@ -72,10 +74,9 @@ module Tzispa
|
|
72
74
|
def load!
|
73
75
|
unless @loaded
|
74
76
|
Mutex.new.synchronize {
|
75
|
-
@config = Tzispa::Config::WebConfig.new(@domain).load!
|
76
77
|
@middleware.load!
|
77
|
-
@repository =
|
78
|
-
@engine =
|
78
|
+
@repository = Data::Repository.new(@config.repository.to_h).load! if @config.respond_to? :repository
|
79
|
+
@engine = Rig::Engine.new self
|
79
80
|
@logger = Logger.new("logs/#{@domain.name}.log", 'weekly')
|
80
81
|
@logger.level = @config.respond_to?(:developing) && @config.developing ? Logger::DEBUG : Logger::INFO
|
81
82
|
I18n.load_path += Dir["#{@domain.path}/config/locales/*.yml"] if @config.respond_to?(:locales) && @config.locales.preload
|
data/lib/tzispa/cli.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module Tzispa
|
4
|
+
|
5
|
+
class Cli < Thor
|
6
|
+
|
7
|
+
desc 'version', 'Prints Tzispa version'
|
8
|
+
def version
|
9
|
+
require 'tzispa/version'
|
10
|
+
puts "v#{VERSION}"
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'tzispa/command/cli/generate'
|
14
|
+
register Tzispa::Command::Cli::Generate, 'generate', 'generate [SUBCOMMAND]', 'Generate Tzispa components'
|
15
|
+
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'tzispa/domain'
|
3
|
+
require 'tzispa/utils/string'
|
4
|
+
require 'tzispa/config/appconfig'
|
5
|
+
require_relative 'project'
|
6
|
+
|
7
|
+
module Tzispa
|
8
|
+
module Command
|
9
|
+
|
10
|
+
class App
|
11
|
+
|
12
|
+
APP_STRUCTURE = [
|
13
|
+
'api',
|
14
|
+
'config',
|
15
|
+
'config/locales',
|
16
|
+
'error',
|
17
|
+
'rig',
|
18
|
+
'rig/block',
|
19
|
+
'rig/layout',
|
20
|
+
'rig/static'
|
21
|
+
]
|
22
|
+
|
23
|
+
attr_reader :domain, :config
|
24
|
+
|
25
|
+
def initialize(name)
|
26
|
+
@domain = Tzispa::Domain.new(name)
|
27
|
+
end
|
28
|
+
|
29
|
+
def generate(host, mount_path=nil)
|
30
|
+
update_project
|
31
|
+
create_structure
|
32
|
+
create_class mount_path
|
33
|
+
create_appconfig(host)
|
34
|
+
create_home_layout
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def update_project
|
40
|
+
prj = Project.open
|
41
|
+
raise "Application '#{domain.name}' already exist in this project" if prj.apps.include?(domain.name)
|
42
|
+
prj.apps << domain.name
|
43
|
+
prj.close
|
44
|
+
end
|
45
|
+
|
46
|
+
def create_class(mount_path=nil)
|
47
|
+
appclass = "#{TzString.camelize domain.name}App"
|
48
|
+
mount_path ||= DEFAULT_MOUNT_PATH
|
49
|
+
class_code = TzString.new
|
50
|
+
File.open("#{Project::START_FILE}","a") do |f|
|
51
|
+
f.puts class_code.indenter("\nclass #{appclass} < Tzispa::Application\n\n")
|
52
|
+
f.puts class_code.indenter("def initialize", 2)
|
53
|
+
f.puts class_code.indenter("super(:#{domain.name})", 2)
|
54
|
+
f.puts class_code.unindenter("end\n\n", 2)
|
55
|
+
f.puts class_code.unindenter("end\n\n", 2)
|
56
|
+
f.puts class_code.indenter("#{appclass}.mount '/#{mount_path}', self do |route|")
|
57
|
+
f.puts class_code.indenter("route.index '/', [:get, :head]", 2)
|
58
|
+
f.puts class_code.indenter("route.api '/__api_:sign/:handler/:verb(~:predicate)(/:sufix)', [:get, :head, :post]")
|
59
|
+
f.puts class_code.indenter("route.site '/:title(/@:id0)(@:id1)(@~:id2)(@@:id3)(@@~:id4)(@@@:id5)/:layout.:format', [:get, :head]")
|
60
|
+
f.puts class_code.unindenter("end\n\n", 2)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def create_structure
|
65
|
+
unless File.exist? domain.path
|
66
|
+
Dir.mkdir "#{domain.path}"
|
67
|
+
APP_STRUCTURE.each { |appdir|
|
68
|
+
Dir.mkdir "#{domain.path}/#{appdir}"
|
69
|
+
}
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def create_appconfig(host)
|
74
|
+
appconfig = Tzispa::Config::AppConfig.new(domain)
|
75
|
+
@config = appconfig.create_default host: host
|
76
|
+
end
|
77
|
+
|
78
|
+
def create_home_layout
|
79
|
+
tpl = Tzispa::Rig::Template.new(name: config&.default_layout || 'index', type: :layout, domain: domain, format: :htm)
|
80
|
+
tpl.create("<html><body><h1>Welcome: Tzispa #{domain.name} application is working!</h1></body></html>")
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'tzispa/command/project'
|
3
|
+
require 'tzispa/command/app'
|
4
|
+
require 'tzispa/command/rig'
|
5
|
+
|
6
|
+
module Tzispa
|
7
|
+
module Command
|
8
|
+
module Cli
|
9
|
+
|
10
|
+
class Generate < Thor
|
11
|
+
|
12
|
+
desc 'project', 'Generate Tzispa project components'
|
13
|
+
def project(name)
|
14
|
+
Tzispa::Command::Project.new(name).generate
|
15
|
+
puts "Project '#{name}' has been created"
|
16
|
+
end
|
17
|
+
|
18
|
+
desc 'app', 'Generate new application into a project'
|
19
|
+
method_option :mount, :aliases => "-m", :desc => "The mount point for this app", :default => ""
|
20
|
+
method_option :host, :aliases => "-h", :desc => "The hostname used for this app ", :required => true
|
21
|
+
def app(name)
|
22
|
+
tzapp = Tzispa::Command::App.new(name)
|
23
|
+
tzapp.generate(options[:host], options[:mount])
|
24
|
+
puts "App '#{name}' has been created"
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
desc 'rig', 'Generate new rig template'
|
29
|
+
method_option :app, :aliases => "-a", :desc => "The app where the new template will be created", :required => true
|
30
|
+
method_option :type, :aliases => "-t", :desc => "The template type: block, static or layout ", :required => true
|
31
|
+
def rig(name)
|
32
|
+
tpl = Tzispa::Command::Rig.new(name, options[:app], options[:type])
|
33
|
+
tpl.generate
|
34
|
+
puts "Rig #{options[:type]} template '#{name}' has been created in #{options[:app]}"
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,257 @@
|
|
1
|
+
require 'json'
|
2
|
+
require "base64"
|
3
|
+
|
4
|
+
module Tzispa
|
5
|
+
module Command
|
6
|
+
|
7
|
+
class Project
|
8
|
+
|
9
|
+
PROJECT_STRUCTURE = [
|
10
|
+
'apps',
|
11
|
+
'config',
|
12
|
+
'config/locales',
|
13
|
+
'data',
|
14
|
+
'data/session',
|
15
|
+
'logs',
|
16
|
+
'public',
|
17
|
+
'public/css',
|
18
|
+
'public/css/fonts',
|
19
|
+
'public/css/less',
|
20
|
+
'public/img',
|
21
|
+
'public/js',
|
22
|
+
'repository'
|
23
|
+
]
|
24
|
+
|
25
|
+
PROJECT_FILE = '.tzispaprj'
|
26
|
+
START_FILE = 'start.ru'
|
27
|
+
PUMA_CONFIG_FILE = 'puma.rb'
|
28
|
+
|
29
|
+
DEFAULT_MOUNT_PATH = '/'
|
30
|
+
|
31
|
+
attr_accessor :name, :apps, :created
|
32
|
+
|
33
|
+
def initialize(name)
|
34
|
+
@name = name
|
35
|
+
@apps = Array.new
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
def generate
|
40
|
+
if create_structure
|
41
|
+
create_project
|
42
|
+
create_start
|
43
|
+
create_pumaconfig
|
44
|
+
create_i18n 'en'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.check?
|
49
|
+
File.exist? "#{PROJECT_FILE}"
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.open
|
53
|
+
raise "This command must be runned in a Tzispa project base dir" unless self.check?
|
54
|
+
hpj = JSON.parse String.new.tap { |ptxt|
|
55
|
+
File.open("#{PROJECT_FILE}","r") do |f|
|
56
|
+
while line = f.gets
|
57
|
+
ptxt << line
|
58
|
+
end
|
59
|
+
end
|
60
|
+
}
|
61
|
+
self.new(hpj['name']).tap { |project|
|
62
|
+
project.apps = hpj['apps']
|
63
|
+
project.created = hpj['created']
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
def close
|
68
|
+
save to_h
|
69
|
+
end
|
70
|
+
|
71
|
+
def to_h
|
72
|
+
Hash.new.tap { |h|
|
73
|
+
h['name'] = name
|
74
|
+
h['apps'] = apps
|
75
|
+
h['created'] = created
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
private
|
80
|
+
|
81
|
+
def save(prj, base_dir=nil)
|
82
|
+
base_dir = "#{base_dir}/" if base_dir
|
83
|
+
File.open("#{base_dir}#{PROJECT_FILE}","w") do |f|
|
84
|
+
f.write prj.to_json
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def create_structure
|
89
|
+
unless File.exist? name
|
90
|
+
Dir.mkdir "#{name}"
|
91
|
+
PROJECT_STRUCTURE.each { |psdir|
|
92
|
+
Dir.mkdir "#{name}/#{psdir}"
|
93
|
+
}
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def create_project
|
98
|
+
save({
|
99
|
+
name: name,
|
100
|
+
created: Time.new,
|
101
|
+
apps: []
|
102
|
+
}, name)
|
103
|
+
end
|
104
|
+
|
105
|
+
def create_start
|
106
|
+
File.open("#{name}/#{START_FILE}","w") do |f|
|
107
|
+
f.puts "require 'rack'\nrequire 'tzispa'"
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def create_pumaconfig
|
112
|
+
File.open("#{name}/config/#{PUMA_CONFIG_FILE}", "w") do |f|
|
113
|
+
f.puts PUMA_CONFIG
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def create_i18n(lang)
|
118
|
+
File.open("#{name}/config/locales/#{lang}.yml", "w") do |f|
|
119
|
+
f.puts Base64.decode64(I18N_DEFAULTS)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
PUMA_CONFIG = <<-PUMACONFIG
|
124
|
+
#!/usr/bin/env puma
|
125
|
+
|
126
|
+
#daemonize true
|
127
|
+
pidfile 'puma.pid'
|
128
|
+
state_path 'puma.state'
|
129
|
+
|
130
|
+
# stdout_redirect 'logs/puma.stdout', 'logs/puma.stderr'
|
131
|
+
# stdout_redirect '/u/apps/lolcat/log/stdout', '/u/apps/lolcat/log/stderr', true
|
132
|
+
|
133
|
+
# Disable request logging.
|
134
|
+
# quiet
|
135
|
+
|
136
|
+
# threads 0, 16
|
137
|
+
|
138
|
+
|
139
|
+
bind 'tcp://0.0.0.0:9292'
|
140
|
+
workers 0
|
141
|
+
|
142
|
+
on_restart do
|
143
|
+
require 'fileutils'
|
144
|
+
FileUtils.rm_rf(Dir.glob('./data/session/*'))
|
145
|
+
end
|
146
|
+
|
147
|
+
# on_worker_boot do
|
148
|
+
# puts 'On worker boot...'
|
149
|
+
# end
|
150
|
+
|
151
|
+
# after_worker_boot do
|
152
|
+
# puts 'On worker boot...'
|
153
|
+
# end
|
154
|
+
|
155
|
+
# on_worker_shutdown do
|
156
|
+
# puts 'On worker boot...'
|
157
|
+
# end
|
158
|
+
|
159
|
+
|
160
|
+
tag 'your_app_tag'
|
161
|
+
worker_timeout 90
|
162
|
+
PUMACONFIG
|
163
|
+
|
164
|
+
I18N_DEFAULTS = <<-I18NDEFAULTSBASE64
|
165
|
+
LS0tDQplbjoNCiAgZGF0ZToNCiAgICBhYmJyX2RheV9uYW1lczoNCiAgICAtIFN1bg0KICAgIC0g
|
166
|
+
TW9uDQogICAgLSBUdWUNCiAgICAtIFdlZA0KICAgIC0gVGh1DQogICAgLSBGcmkNCiAgICAtIFNh
|
167
|
+
dA0KICAgIGFiYnJfbW9udGhfbmFtZXM6DQogICAgLQ0KICAgIC0gSmFuDQogICAgLSBGZWINCiAg
|
168
|
+
ICAtIE1hcg0KICAgIC0gQXByDQogICAgLSBNYXkNCiAgICAtIEp1bg0KICAgIC0gSnVsDQogICAg
|
169
|
+
LSBBdWcNCiAgICAtIFNlcA0KICAgIC0gT2N0DQogICAgLSBOb3YNCiAgICAtIERlYw0KICAgIGRh
|
170
|
+
eV9uYW1lczoNCiAgICAtIFN1bmRheQ0KICAgIC0gTW9uZGF5DQogICAgLSBUdWVzZGF5DQogICAg
|
171
|
+
LSBXZWRuZXNkYXkNCiAgICAtIFRodXJzZGF5DQogICAgLSBGcmlkYXkNCiAgICAtIFNhdHVyZGF5
|
172
|
+
DQogICAgZm9ybWF0czoNCiAgICAgIGRlZmF1bHQ6ICIlWS0lbS0lZCINCiAgICAgIGxvbmc6ICIl
|
173
|
+
QiAlZCwgJVkiDQogICAgICBzaG9ydDogIiViICVkIg0KICAgIG1vbnRoX25hbWVzOg0KICAgIC0N
|
174
|
+
CiAgICAtIEphbnVhcnkNCiAgICAtIEZlYnJ1YXJ5DQogICAgLSBNYXJjaA0KICAgIC0gQXByaWwN
|
175
|
+
CiAgICAtIE1heQ0KICAgIC0gSnVuZQ0KICAgIC0gSnVseQ0KICAgIC0gQXVndXN0DQogICAgLSBT
|
176
|
+
ZXB0ZW1iZXINCiAgICAtIE9jdG9iZXINCiAgICAtIE5vdmVtYmVyDQogICAgLSBEZWNlbWJlcg0K
|
177
|
+
ICAgIG9yZGVyOg0KICAgIC0gOnllYXINCiAgICAtIDptb250aA0KICAgIC0gOmRheQ0KICBkYXRl
|
178
|
+
dGltZToNCiAgICBkaXN0YW5jZV9pbl93b3JkczoNCiAgICAgIGFib3V0X3hfaG91cnM6DQogICAg
|
179
|
+
ICAgIG9uZTogYWJvdXQgMSBob3VyDQogICAgICAgIG90aGVyOiBhYm91dCAle2NvdW50fSBob3Vy
|
180
|
+
cw0KICAgICAgYWJvdXRfeF9tb250aHM6DQogICAgICAgIG9uZTogYWJvdXQgMSBtb250aA0KICAg
|
181
|
+
ICAgICBvdGhlcjogYWJvdXQgJXtjb3VudH0gbW9udGhzDQogICAgICBhYm91dF94X3llYXJzOg0K
|
182
|
+
ICAgICAgICBvbmU6IGFib3V0IDEgeWVhcg0KICAgICAgICBvdGhlcjogYWJvdXQgJXtjb3VudH0g
|
183
|
+
eWVhcnMNCiAgICAgIGFsbW9zdF94X3llYXJzOg0KICAgICAgICBvbmU6IGFsbW9zdCAxIHllYXIN
|
184
|
+
CiAgICAgICAgb3RoZXI6IGFsbW9zdCAle2NvdW50fSB5ZWFycw0KICAgICAgaGFsZl9hX21pbnV0
|
185
|
+
ZTogaGFsZiBhIG1pbnV0ZQ0KICAgICAgbGVzc190aGFuX3hfbWludXRlczoNCiAgICAgICAgb25l
|
186
|
+
OiBsZXNzIHRoYW4gYSBtaW51dGUNCiAgICAgICAgb3RoZXI6IGxlc3MgdGhhbiAle2NvdW50fSBt
|
187
|
+
aW51dGVzDQogICAgICBsZXNzX3RoYW5feF9zZWNvbmRzOg0KICAgICAgICBvbmU6IGxlc3MgdGhh
|
188
|
+
biAxIHNlY29uZA0KICAgICAgICBvdGhlcjogbGVzcyB0aGFuICV7Y291bnR9IHNlY29uZHMNCiAg
|
189
|
+
ICAgIG92ZXJfeF95ZWFyczoNCiAgICAgICAgb25lOiBvdmVyIDEgeWVhcg0KICAgICAgICBvdGhl
|
190
|
+
cjogb3ZlciAle2NvdW50fSB5ZWFycw0KICAgICAgeF9kYXlzOg0KICAgICAgICBvbmU6IDEgZGF5
|
191
|
+
DQogICAgICAgIG90aGVyOiAiJXtjb3VudH0gZGF5cyINCiAgICAgIHhfbWludXRlczoNCiAgICAg
|
192
|
+
ICAgb25lOiAxIG1pbnV0ZQ0KICAgICAgICBvdGhlcjogIiV7Y291bnR9IG1pbnV0ZXMiDQogICAg
|
193
|
+
ICB4X21vbnRoczoNCiAgICAgICAgb25lOiAxIG1vbnRoDQogICAgICAgIG90aGVyOiAiJXtjb3Vu
|
194
|
+
dH0gbW9udGhzIg0KICAgICAgeF9zZWNvbmRzOg0KICAgICAgICBvbmU6IDEgc2Vjb25kDQogICAg
|
195
|
+
ICAgIG90aGVyOiAiJXtjb3VudH0gc2Vjb25kcyINCiAgICBwcm9tcHRzOg0KICAgICAgZGF5OiBE
|
196
|
+
YXkNCiAgICAgIGhvdXI6IEhvdXINCiAgICAgIG1pbnV0ZTogTWludXRlDQogICAgICBtb250aDog
|
197
|
+
TW9udGgNCiAgICAgIHNlY29uZDogU2Vjb25kcw0KICAgICAgeWVhcjogWWVhcg0KICBlcnJvcnM6
|
198
|
+
DQogICAgZm9ybWF0OiAiJXthdHRyaWJ1dGV9ICV7bWVzc2FnZX0iDQogICAgbWVzc2FnZXM6DQog
|
199
|
+
ICAgICBhY2NlcHRlZDogbXVzdCBiZSBhY2NlcHRlZA0KICAgICAgYmxhbms6IGNhbid0IGJlIGJs
|
200
|
+
YW5rDQogICAgICBwcmVzZW50OiBtdXN0IGJlIGJsYW5rDQogICAgICBjb25maXJtYXRpb246IGRv
|
201
|
+
ZXNuJ3QgbWF0Y2ggJXthdHRyaWJ1dGV9DQogICAgICBlbXB0eTogY2FuJ3QgYmUgZW1wdHkNCiAg
|
202
|
+
ICAgIGVxdWFsX3RvOiBtdXN0IGJlIGVxdWFsIHRvICV7Y291bnR9DQogICAgICBldmVuOiBtdXN0
|
203
|
+
IGJlIGV2ZW4NCiAgICAgIGV4Y2x1c2lvbjogaXMgcmVzZXJ2ZWQNCiAgICAgIGdyZWF0ZXJfdGhh
|
204
|
+
bjogbXVzdCBiZSBncmVhdGVyIHRoYW4gJXtjb3VudH0NCiAgICAgIGdyZWF0ZXJfdGhhbl9vcl9l
|
205
|
+
cXVhbF90bzogbXVzdCBiZSBncmVhdGVyIHRoYW4gb3IgZXF1YWwgdG8gJXtjb3VudH0NCiAgICAg
|
206
|
+
IGluY2x1c2lvbjogaXMgbm90IGluY2x1ZGVkIGluIHRoZSBsaXN0DQogICAgICBpbnZhbGlkOiBp
|
207
|
+
cyBpbnZhbGlkDQogICAgICBsZXNzX3RoYW46IG11c3QgYmUgbGVzcyB0aGFuICV7Y291bnR9DQog
|
208
|
+
ICAgICBsZXNzX3RoYW5fb3JfZXF1YWxfdG86IG11c3QgYmUgbGVzcyB0aGFuIG9yIGVxdWFsIHRv
|
209
|
+
ICV7Y291bnR9DQogICAgICBtb2RlbF9pbnZhbGlkOiAiVmFsaWRhdGlvbiBmYWlsZWQ6ICV7ZXJy
|
210
|
+
b3JzfSINCiAgICAgIG5vdF9hX251bWJlcjogaXMgbm90IGEgbnVtYmVyDQogICAgICBub3RfYW5f
|
211
|
+
aW50ZWdlcjogbXVzdCBiZSBhbiBpbnRlZ2VyDQogICAgICBvZGQ6IG11c3QgYmUgb2RkDQogICAg
|
212
|
+
ICByZXF1aXJlZDogbXVzdCBleGlzdA0KICAgICAgdGFrZW46IGhhcyBhbHJlYWR5IGJlZW4gdGFr
|
213
|
+
ZW4NCiAgICAgIHRvb19sb25nOg0KICAgICAgICBvbmU6IGlzIHRvbyBsb25nIChtYXhpbXVtIGlz
|
214
|
+
IDEgY2hhcmFjdGVyKQ0KICAgICAgICBvdGhlcjogaXMgdG9vIGxvbmcgKG1heGltdW0gaXMgJXtj
|
215
|
+
b3VudH0gY2hhcmFjdGVycykNCiAgICAgIHRvb19zaG9ydDoNCiAgICAgICAgb25lOiBpcyB0b28g
|
216
|
+
c2hvcnQgKG1pbmltdW0gaXMgMSBjaGFyYWN0ZXIpDQogICAgICAgIG90aGVyOiBpcyB0b28gc2hv
|
217
|
+
cnQgKG1pbmltdW0gaXMgJXtjb3VudH0gY2hhcmFjdGVycykNCiAgICAgIHdyb25nX2xlbmd0aDoN
|
218
|
+
CiAgICAgICAgb25lOiBpcyB0aGUgd3JvbmcgbGVuZ3RoIChzaG91bGQgYmUgMSBjaGFyYWN0ZXIp
|
219
|
+
DQogICAgICAgIG90aGVyOiBpcyB0aGUgd3JvbmcgbGVuZ3RoIChzaG91bGQgYmUgJXtjb3VudH0g
|
220
|
+
Y2hhcmFjdGVycykNCiAgICAgIG90aGVyX3RoYW46IG11c3QgYmUgb3RoZXIgdGhhbiAle2NvdW50
|
221
|
+
fQ0KICAgIHRlbXBsYXRlOg0KICAgICAgYm9keTogJ1RoZXJlIHdlcmUgcHJvYmxlbXMgd2l0aCB0
|
222
|
+
aGUgZm9sbG93aW5nIGZpZWxkczonDQogICAgICBoZWFkZXI6DQogICAgICAgIG9uZTogMSBlcnJv
|
223
|
+
ciBwcm9oaWJpdGVkIHRoaXMgJXttb2RlbH0gZnJvbSBiZWluZyBzYXZlZA0KICAgICAgICBvdGhl
|
224
|
+
cjogIiV7Y291bnR9IGVycm9ycyBwcm9oaWJpdGVkIHRoaXMgJXttb2RlbH0gZnJvbSBiZWluZyBz
|
225
|
+
YXZlZCINCiAgaGVscGVyczoNCiAgICBzZWxlY3Q6DQogICAgICBwcm9tcHQ6IFBsZWFzZSBzZWxl
|
226
|
+
Y3QNCiAgICBzdWJtaXQ6DQogICAgICBjcmVhdGU6IENyZWF0ZSAle21vZGVsfQ0KICAgICAgc3Vi
|
227
|
+
bWl0OiBTYXZlICV7bW9kZWx9DQogICAgICB1cGRhdGU6IFVwZGF0ZSAle21vZGVsfQ0KICBudW1i
|
228
|
+
ZXI6DQogICAgY3VycmVuY3k6DQogICAgICBmb3JtYXQ6DQogICAgICAgIGRlbGltaXRlcjogIiwi
|
229
|
+
DQogICAgICAgIGZvcm1hdDogIiV1JW4iDQogICAgICAgIHByZWNpc2lvbjogMg0KICAgICAgICBz
|
230
|
+
ZXBhcmF0b3I6ICIuIg0KICAgICAgICBzaWduaWZpY2FudDogZmFsc2UNCiAgICAgICAgc3RyaXBf
|
231
|
+
aW5zaWduaWZpY2FudF96ZXJvczogZmFsc2UNCiAgICAgICAgdW5pdDogIiQiDQogICAgZm9ybWF0
|
232
|
+
Og0KICAgICAgZGVsaW1pdGVyOiAiLCINCiAgICAgIHByZWNpc2lvbjogMw0KICAgICAgc2VwYXJh
|
233
|
+
dG9yOiAiLiINCiAgICAgIHNpZ25pZmljYW50OiBmYWxzZQ0KICAgICAgc3RyaXBfaW5zaWduaWZp
|
234
|
+
Y2FudF96ZXJvczogZmFsc2UNCiAgICBodW1hbjoNCiAgICAgIGRlY2ltYWxfdW5pdHM6DQogICAg
|
235
|
+
ICAgIGZvcm1hdDogIiVuICV1Ig0KICAgICAgICB1bml0czoNCiAgICAgICAgICBiaWxsaW9uOiBC
|
236
|
+
aWxsaW9uDQogICAgICAgICAgbWlsbGlvbjogTWlsbGlvbg0KICAgICAgICAgIHF1YWRyaWxsaW9u
|
237
|
+
OiBRdWFkcmlsbGlvbg0KICAgICAgICAgIHRob3VzYW5kOiBUaG91c2FuZA0KICAgICAgICAgIHRy
|
238
|
+
aWxsaW9uOiBUcmlsbGlvbg0KICAgICAgICAgIHVuaXQ6ICcnDQogICAgICBmb3JtYXQ6DQogICAg
|
239
|
+
ICAgIGRlbGltaXRlcjogJycNCiAgICAgICAgcHJlY2lzaW9uOiAzDQogICAgICAgIHNpZ25pZmlj
|
240
|
+
YW50OiB0cnVlDQogICAgICAgIHN0cmlwX2luc2lnbmlmaWNhbnRfemVyb3M6IHRydWUNCiAgICAg
|
241
|
+
IHN0b3JhZ2VfdW5pdHM6DQogICAgICAgIGZvcm1hdDogIiVuICV1Ig0KICAgICAgICB1bml0czoN
|
242
|
+
CiAgICAgICAgICBieXRlOg0KICAgICAgICAgICAgb25lOiBCeXRlDQogICAgICAgICAgICBvdGhl
|
243
|
+
cjogQnl0ZXMNCiAgICAgICAgICBnYjogR0INCiAgICAgICAgICBrYjogS0INCiAgICAgICAgICBt
|
244
|
+
YjogTUINCiAgICAgICAgICB0YjogVEINCiAgICBwZXJjZW50YWdlOg0KICAgICAgZm9ybWF0Og0K
|
245
|
+
ICAgICAgICBkZWxpbWl0ZXI6ICcnDQogICAgICAgIGZvcm1hdDogIiVuJSINCiAgICBwcmVjaXNp
|
246
|
+
b246DQogICAgICBmb3JtYXQ6DQogICAgICAgIGRlbGltaXRlcjogJycNCiAgdGltZToNCiAgICBh
|
247
|
+
bTogYW0NCiAgICBmb3JtYXRzOg0KICAgICAgZGVmYXVsdDogIiVhLCAlZCAlYiAlWSAlSDolTTol
|
248
|
+
UyAleiINCiAgICAgIGxvbmc6ICIlQiAlZCwgJVkgJUg6JU0iDQogICAgICBzaG9ydDogIiVkICVi
|
249
|
+
ICVIOiVNIg0KICAgIHBtOiBwbQ0K
|
250
|
+
I18NDEFAULTSBASE64
|
251
|
+
|
252
|
+
|
253
|
+
end
|
254
|
+
|
255
|
+
|
256
|
+
end
|
257
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'tzispa/rig/template'
|
2
|
+
|
3
|
+
module Tzispa
|
4
|
+
module Command
|
5
|
+
|
6
|
+
class Rig
|
7
|
+
|
8
|
+
attr_reader :name, :domain, :type, :mime_format
|
9
|
+
|
10
|
+
def initialize(name, app, type, mime_format = nil)
|
11
|
+
@prj = Project.open
|
12
|
+
raise "Application '#{app}' does not exists in project file" unless @prj.apps.include?(app)
|
13
|
+
@domain = Tzispa::Domain.new app
|
14
|
+
@type = type.to_sym
|
15
|
+
@name = name
|
16
|
+
@mime_format = mime_format
|
17
|
+
end
|
18
|
+
|
19
|
+
def generate
|
20
|
+
Tzispa::Rig::Template.new(name: name, type: type, domain: domain, format: mime_format).create
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'tzispa/config/yaml'
|
4
|
+
require 'tzispa/helpers/security'
|
5
|
+
|
6
|
+
module Tzispa
|
7
|
+
module Config
|
8
|
+
class AppConfig
|
9
|
+
|
10
|
+
include Tzispa::Helpers::Security
|
11
|
+
|
12
|
+
CONFIG_FILENAME = :appconfig
|
13
|
+
|
14
|
+
attr_reader :domain, :cfname
|
15
|
+
|
16
|
+
def initialize(domain, configname=nil)
|
17
|
+
@domain = domain
|
18
|
+
@cfname = configname || CONFIG_FILENAME
|
19
|
+
@cftime = nil
|
20
|
+
end
|
21
|
+
|
22
|
+
def filename
|
23
|
+
@filename ||= "#{domain.path}/config/#{cfname}.yml".freeze
|
24
|
+
end
|
25
|
+
|
26
|
+
def load!
|
27
|
+
if @cftime.nil?
|
28
|
+
@cftime = File.ctime(filename)
|
29
|
+
else
|
30
|
+
if @cftime != File.ctime(filename)
|
31
|
+
@config = nil
|
32
|
+
@cftime = File.ctime(filename)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
@config ||= Tzispa::Config::Yaml.load(filename)
|
36
|
+
end
|
37
|
+
|
38
|
+
def create_default(host:, layout: 'index', dev_mode: true, locale: 'en')
|
39
|
+
hcfg = Hash.new.tap { |cfg|
|
40
|
+
cfg['id'] = domain.name
|
41
|
+
cfg['default_layout'] = layout
|
42
|
+
cfg['default_format'] = 'htm'
|
43
|
+
cfg['host_name'] = host
|
44
|
+
cfg['dev_mode'] = dev_mode
|
45
|
+
cfg['default_encoding'] = 'utf-8'
|
46
|
+
cfg['auth_required'] = false
|
47
|
+
cfg['salt'] = secret(24)
|
48
|
+
cfg['locales'] = Hash.new.tap { |loc|
|
49
|
+
loc['preload'] = true
|
50
|
+
loc['default'] = locale
|
51
|
+
}
|
52
|
+
cfg['sessions'] = Hash.new.tap { |ses|
|
53
|
+
ses['enabled'] = true
|
54
|
+
ses['timeout'] = 3600
|
55
|
+
ses['secret'] = secret(32)
|
56
|
+
}
|
57
|
+
}
|
58
|
+
Tzispa::Config::Yaml.save(hcfg, filename)
|
59
|
+
load!
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
data/lib/tzispa/config/routes.rb
CHANGED
@@ -21,7 +21,7 @@ module Tzispa
|
|
21
21
|
"#{@map_path}#{@router.path path_id, params}"
|
22
22
|
end
|
23
23
|
|
24
|
-
def add(route_id, path, controller)
|
24
|
+
def add(route_id, path, controller, methods)
|
25
25
|
spec_control, callmethod = controller.to_s.split(':')
|
26
26
|
mpath = spec_control.split('#')
|
27
27
|
controller = TzString.camelize(mpath.pop).to_s
|
@@ -32,22 +32,22 @@ module Tzispa
|
|
32
32
|
controller_module = CONTROLLERS_BASE
|
33
33
|
require "tzispa/controller/#{controller.downcase}"
|
34
34
|
end
|
35
|
-
@router.add(path).tap { |rule|
|
35
|
+
@router.add(path, {request_method: methods}).tap { |rule|
|
36
36
|
rule.to TzString.constantize("#{controller_module}::#{controller}").new(callmethod)
|
37
37
|
rule.name = route_id
|
38
38
|
}
|
39
39
|
end
|
40
40
|
|
41
|
-
def index(path, controller=nil)
|
42
|
-
add :index, path, controller || 'layout:render!'
|
41
|
+
def index(path, methods, controller=nil)
|
42
|
+
add :index, path, controller || 'layout:render!', methods
|
43
43
|
end
|
44
44
|
|
45
|
-
def api(path, controller=nil)
|
46
|
-
add :api, path, controller || 'api:dispatch!'
|
45
|
+
def api(path, methods, controller=nil)
|
46
|
+
add :api, path, controller || 'api:dispatch!', methods
|
47
47
|
end
|
48
48
|
|
49
|
-
def site(path, controller=nil)
|
50
|
-
add :site, path, controller || 'layout:render!'
|
49
|
+
def site(path, methods, controller=nil)
|
50
|
+
add :site, path, controller || 'layout:render!', methods
|
51
51
|
end
|
52
52
|
|
53
53
|
end
|
data/lib/tzispa/config/yaml.rb
CHANGED
data/lib/tzispa/context.rb
CHANGED
@@ -18,6 +18,7 @@ module Tzispa
|
|
18
18
|
context.router_params[:layout] || context.config.default_layout
|
19
19
|
end
|
20
20
|
layout_format = context.router_params[:format] || context.config.default_format
|
21
|
+
context.layout = layout
|
21
22
|
rig = context.app.engine.layout(name: layout, format: layout_format.to_sym)
|
22
23
|
response.body << rig.render(context)
|
23
24
|
content_type layout_format
|
data/lib/tzispa/domain.rb
CHANGED
@@ -6,12 +6,12 @@ module Tzispa
|
|
6
6
|
attr_reader :name, :root
|
7
7
|
|
8
8
|
DEFAULT_DOMAIN_NAME = :default
|
9
|
-
DEFAULT_DOMAINS_ROOT = :
|
9
|
+
DEFAULT_DOMAINS_ROOT = :apps
|
10
10
|
|
11
11
|
|
12
|
-
def initialize(name
|
13
|
-
@name = name
|
14
|
-
@root = root
|
12
|
+
def initialize(name=DEFAULT_DOMAIN_NAME, root=DEFAULT_DOMAINS_ROOT)
|
13
|
+
@name = name
|
14
|
+
@root = root
|
15
15
|
end
|
16
16
|
|
17
17
|
def path
|
data/lib/tzispa/http/context.rb
CHANGED
data/lib/tzispa/version.rb
CHANGED
data/tzispa.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/tzispa/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = Tzispa::FRAMEWORK_NAME.downcase
|
6
|
+
s.version = Tzispa::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.bindir = 'bin'
|
9
|
+
s.authors = ['Juan Antonio Piñero']
|
10
|
+
s.email = ['japinero@area-integral.com']
|
11
|
+
s.homepage = 'https://github.com/japiber/tzispa'
|
12
|
+
s.summary = 'A sparkling web framework'
|
13
|
+
s.description = 'A sparkling web framework based on Rack and inspired by Sinatra and Lotus'
|
14
|
+
s.licenses = ['MIT']
|
15
|
+
|
16
|
+
s.required_ruby_version = '~> 2.3'
|
17
|
+
|
18
|
+
s.add_dependency 'rack', '~> 1.5'
|
19
|
+
s.add_dependency 'puma', '~> 3.1'
|
20
|
+
s.add_dependency 'i18n', '~> 0.7'
|
21
|
+
s.add_dependency 'http_router', '~> 0.11'
|
22
|
+
s.add_dependency 'moneta', '~> 0.8'
|
23
|
+
s.add_dependency 'tzispa_helpers', '~> 0.1.0'
|
24
|
+
s.add_dependency 'tzispa_utils', '~> 0.2.1'
|
25
|
+
s.add_dependency 'tzispa_rig', '~> 0.2.0'
|
26
|
+
s.add_dependency 'tzispa_data', '~> 0.1'
|
27
|
+
|
28
|
+
s.files = Dir.glob("{lib,bin}/**/*") + %w(README.md CHANGELOG.md LICENSE tzispa.gemspec)
|
29
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
30
|
+
s.require_paths = ['lib']
|
31
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tzispa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Antonio Piñero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -24,6 +24,34 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: puma
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: i18n
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.7'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.7'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: http_router
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +100,14 @@ dependencies:
|
|
72
100
|
requirements:
|
73
101
|
- - "~>"
|
74
102
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.1
|
103
|
+
version: 0.2.1
|
76
104
|
type: :runtime
|
77
105
|
prerelease: false
|
78
106
|
version_requirements: !ruby/object:Gem::Requirement
|
79
107
|
requirements:
|
80
108
|
- - "~>"
|
81
109
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.1
|
110
|
+
version: 0.2.1
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
112
|
name: tzispa_rig
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -111,18 +139,27 @@ dependencies:
|
|
111
139
|
description: A sparkling web framework based on Rack and inspired by Sinatra and Lotus
|
112
140
|
email:
|
113
141
|
- japinero@area-integral.com
|
114
|
-
executables:
|
142
|
+
executables:
|
143
|
+
- tzispa
|
115
144
|
extensions: []
|
116
145
|
extra_rdoc_files: []
|
117
146
|
files:
|
118
147
|
- CHANGELOG.md
|
148
|
+
- LICENSE
|
119
149
|
- README.md
|
150
|
+
- bin/tzispa
|
120
151
|
- lib/tzispa.rb
|
121
152
|
- lib/tzispa/api/handler.rb
|
122
153
|
- lib/tzispa/app.rb
|
154
|
+
- lib/tzispa/bin/tzispa
|
155
|
+
- lib/tzispa/cli.rb
|
156
|
+
- lib/tzispa/command/app.rb
|
157
|
+
- lib/tzispa/command/cli/generate.rb
|
158
|
+
- lib/tzispa/command/project.rb
|
159
|
+
- lib/tzispa/command/rig.rb
|
160
|
+
- lib/tzispa/config/appconfig.rb
|
123
161
|
- lib/tzispa/config/base.rb
|
124
162
|
- lib/tzispa/config/routes.rb
|
125
|
-
- lib/tzispa/config/webconfig.rb
|
126
163
|
- lib/tzispa/config/yaml.rb
|
127
164
|
- lib/tzispa/context.rb
|
128
165
|
- lib/tzispa/controller/api.rb
|
@@ -137,6 +174,7 @@ files:
|
|
137
174
|
- lib/tzispa/http/session_flash_bag.rb
|
138
175
|
- lib/tzispa/middleware.rb
|
139
176
|
- lib/tzispa/version.rb
|
177
|
+
- tzispa.gemspec
|
140
178
|
homepage: https://github.com/japiber/tzispa
|
141
179
|
licenses:
|
142
180
|
- MIT
|
@@ -157,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
195
|
version: '0'
|
158
196
|
requirements: []
|
159
197
|
rubyforge_project:
|
160
|
-
rubygems_version: 2.
|
198
|
+
rubygems_version: 2.4.8
|
161
199
|
signing_key:
|
162
200
|
specification_version: 4
|
163
201
|
summary: A sparkling web framework
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'tzispa/config/yaml'
|
4
|
-
|
5
|
-
module Tzispa
|
6
|
-
module Config
|
7
|
-
class WebConfig
|
8
|
-
|
9
|
-
RPG_WEBCONFIG_FILENAME = :webconfig
|
10
|
-
|
11
|
-
|
12
|
-
def initialize(domain,configname=nil)
|
13
|
-
@domain = domain
|
14
|
-
@cfname = configname || RPG_WEBCONFIG_FILENAME
|
15
|
-
@cftime = nil
|
16
|
-
end
|
17
|
-
|
18
|
-
def filename
|
19
|
-
@filename ||= "#{@domain.path}/config/#{@cfname}.yml".freeze
|
20
|
-
end
|
21
|
-
|
22
|
-
def load!
|
23
|
-
if @cftime.nil?
|
24
|
-
@cftime = File.ctime(filename)
|
25
|
-
else
|
26
|
-
if @cftime != File.ctime(filename)
|
27
|
-
@config = nil
|
28
|
-
@cftime = File.ctime(filename)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
@config ||= Tzispa::Config::Yaml.load(filename)
|
32
|
-
end
|
33
|
-
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|