super-app 0.0.2 → 0.0.3
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 +8 -8
- data/bin/main.rb +65 -0
- metadata +4 -3
- data/lib/base.rb +0 -6
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
Y2ZhODM5YThjNjhiNjFiYmVhODQwNjBiN2RhNjU4YmY4YTdhOTEwOA==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
YTkzMTk4NzNiN2JjZDA3YTdhMzg4NDAzNWI5Mzc2Y2VlOWFhOTcxZA==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
NDE4NWM1YTkwMjY2YjU1MWYzZjQ0NmFjMjJlNDJmZTRkYzZhNTY3NDFhZGE0
|
|
10
|
+
N2U2ZmE0ZmI5OWM1ZWQ4ZTNlYjBhNmRhMTI5MzRjMWIwMWQ3NDZhMTE2YTEw
|
|
11
|
+
NDYwNDYzNjNhNTVhNWNiMWJkMmJhNWZhM2Q3NDNhM2I3NDhkZWI=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
MDk0YzJiMDA5ZWY4YTBlMWIwZjAxZTViOWM2YWRjZTJkZmI3YjY1ZWU0ODZh
|
|
14
|
+
ZjVlYzIzZjk2ZTFmNzhhMjQyMDIzZmFiNjRkNTI0MzYwMTkzMTY1NTIzZTg3
|
|
15
|
+
YjM5MWUzYTMxMmJkNmNlZDNkNGU2OTI0ZWVkMDQ0MDZlZGYzNzU=
|
data/bin/main.rb
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
2
|
+
|
|
3
|
+
require 'rubygems'
|
|
4
|
+
require 'sinatra'
|
|
5
|
+
require 'helpers/starter.rb'
|
|
6
|
+
require 'logics/process_engine.rb'
|
|
7
|
+
require 'haml'
|
|
8
|
+
|
|
9
|
+
disable :protection
|
|
10
|
+
set :port, 1000
|
|
11
|
+
#set :bind, '192.168.128.59'
|
|
12
|
+
set :environment, :development
|
|
13
|
+
set :threaded, true
|
|
14
|
+
set :server, :thin
|
|
15
|
+
|
|
16
|
+
#use NTLMAuthentication
|
|
17
|
+
|
|
18
|
+
get '/public/:folder/:file_name' do
|
|
19
|
+
content_url = File.join(settings.public_folder, params[:folder], params[:file_name])
|
|
20
|
+
send_file content_url
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
get '/:controller/:action.?:format?*' do
|
|
24
|
+
output = "OK"
|
|
25
|
+
content_disposition = false
|
|
26
|
+
content_type = 'text/html'
|
|
27
|
+
domain_host = "http://#{settings.bind.to_s}:#{settings.port}"
|
|
28
|
+
|
|
29
|
+
begin
|
|
30
|
+
controller = params[:controller]
|
|
31
|
+
action = params[:action]
|
|
32
|
+
format = params[:format]
|
|
33
|
+
|
|
34
|
+
# recupero modello dati e template view
|
|
35
|
+
ret_model = Logics::ProcessEngine.exec action, params
|
|
36
|
+
ret_view = Helpers::Utility.get_template action
|
|
37
|
+
ret_model.public_path = domain_host + "/public"
|
|
38
|
+
|
|
39
|
+
case format.upcase
|
|
40
|
+
when 'PDF'
|
|
41
|
+
html = Haml::Engine.new(ret_view).render(Object.new, :models => ret_model)
|
|
42
|
+
output = Helpers::PdfEngine.create_pdf_s DateTime.now.strftime("%Y%m%d%H%M%S"), html, action
|
|
43
|
+
|
|
44
|
+
content_type = 'application/pdf'
|
|
45
|
+
content_disposition = true
|
|
46
|
+
|
|
47
|
+
when 'HTML'
|
|
48
|
+
output = Haml::Engine.new(ret_view).render(Object.new, :models => ret_model)
|
|
49
|
+
content_type = 'text/html'
|
|
50
|
+
else
|
|
51
|
+
p "errore formato sconosciuto"
|
|
52
|
+
haml :error, :locals => {:err_msg => "errore formato sconosciuto"}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
rescue Exception => e
|
|
56
|
+
puts e.message
|
|
57
|
+
puts e.backtrace
|
|
58
|
+
haml :error, :locals => {:err_msg => e}
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
headers["Content-Type"] = content_type
|
|
62
|
+
headers["Content-Disposition"] = "attachment;filename=the_file.pdf" if content_disposition == true
|
|
63
|
+
output
|
|
64
|
+
end
|
|
65
|
+
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: super-app
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Marco Gallo
|
|
@@ -15,11 +15,12 @@ description: Bundler manages an application's dependencies through its entire li
|
|
|
15
15
|
across many machines, systematically and repeatably
|
|
16
16
|
email:
|
|
17
17
|
- marco.gallo@email.com
|
|
18
|
-
executables:
|
|
18
|
+
executables:
|
|
19
|
+
- main.rb
|
|
19
20
|
extensions: []
|
|
20
21
|
extra_rdoc_files: []
|
|
21
22
|
files:
|
|
22
|
-
-
|
|
23
|
+
- bin/main.rb
|
|
23
24
|
homepage:
|
|
24
25
|
licenses: []
|
|
25
26
|
metadata: {}
|