fiveapples 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/config5.ru +34 -3
- data/lib/fiveapples.rb +42 -39
- data/lib/ui5/controller/Cultivar_Create.controller.js +2 -1
- data/lib/version.rb +5 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e515423afa398eb0c84bcde4011e6d8e0c1956abe7e560eae16dbf7227ebb74
|
4
|
+
data.tar.gz: 7785ce629615f46dd99fd292dcecdcd92a26b0ce256f4edb01eae718e6da32d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 858a88008a5b520f052cb2083b5bd68ec66b9f2b66f14a937144f96a2f010d4a387503a8f332af9b85d80220f49b0a78b157accb1e9399bdde3e43619f790cd4
|
7
|
+
data.tar.gz: e9814e215c62e5d79237195ecaff7517d9781b2a429231225e7e1e0b5b68c337d13c84ca5802d7c33ce77d3b98df9e5f1e98e328da5468bd8916ee5a1bc3c0ff
|
data/lib/config5.ru
CHANGED
@@ -6,6 +6,27 @@ require_relative './model.rb'
|
|
6
6
|
|
7
7
|
require 'rack/logger'
|
8
8
|
|
9
|
+
# simple redirect middleware for doing / => /ui5/index.html
|
10
|
+
|
11
|
+
module FiveApples
|
12
|
+
class Redirect
|
13
|
+
def initialize(app, options={})
|
14
|
+
@app = app
|
15
|
+
@map = options
|
16
|
+
end
|
17
|
+
def call(env)
|
18
|
+
if @map.has_key?(pi = env['PATH_INFO'])
|
19
|
+
destination = "#{env['rack.url_scheme']}://#{env['HTTP_HOST']}#{@map[pi]}"
|
20
|
+
destination << "?#{qs}" unless (qs=env['QUERY_STRING']).empty?
|
21
|
+
[301, {'Location' => destination}, ['See Ya!']]
|
22
|
+
else
|
23
|
+
@app.call(env)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
|
9
30
|
fiveapples = Rack::OData::Builder.new do
|
10
31
|
|
11
32
|
use Rack::Cors do
|
@@ -20,10 +41,20 @@ fiveapples = Rack::OData::Builder.new do
|
|
20
41
|
use Rack::CommonLogger
|
21
42
|
use Rack::ShowExceptions
|
22
43
|
|
23
|
-
# Serve the ui5 app
|
24
|
-
use Rack::Static, :urls => ["/ui5"]
|
25
44
|
|
26
|
-
# Serve the
|
45
|
+
# Serve the ui5 app
|
46
|
+
|
47
|
+
# redirect / to /ui5/index.html
|
48
|
+
# Note: We need this because serving / with /ui5/index.html content does not work
|
49
|
+
# as is produces follow-up javascript resource requests like "/Component.js"
|
50
|
+
# outside of ui5 directory and it gives NOT FOUND
|
51
|
+
use FiveApples::Redirect, {'/' => '/ui5/index.html',
|
52
|
+
'/ui5' => '/ui5/index.html'}
|
53
|
+
|
54
|
+
use Rack::Static, :urls => ['/ui5']
|
55
|
+
|
56
|
+
|
57
|
+
# Serve the OData (prefixed /odata )
|
27
58
|
run ODataFiveApples.new
|
28
59
|
|
29
60
|
end
|
data/lib/fiveapples.rb
CHANGED
@@ -3,44 +3,47 @@
|
|
3
3
|
require 'safrano.rb'
|
4
4
|
require 'sequel'
|
5
5
|
require 'fileutils'
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
6
|
+
require_relative 'version'
|
7
|
+
|
8
|
+
module FiveApples
|
9
|
+
class Server
|
10
|
+
CONFIGDIRNAME = 'fiveapples'.freeze
|
11
|
+
DBFILENAME = 'fiveapples.db3'.freeze
|
12
|
+
CONFIGRU = 'config5.ru'
|
13
|
+
|
14
|
+
attr_reader :db
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
gconfigdir = File.expand_path('.config', Dir.home)
|
18
|
+
@apphome = File.expand_path(CONFIGDIRNAME, gconfigdir)
|
19
|
+
@libdir = __dir__.dup
|
20
|
+
@systemdbname = File.join(@libdir, DBFILENAME)
|
21
|
+
@homedbname = File.expand_path(DBFILENAME, @apphome)
|
22
|
+
@configru = File.expand_path(CONFIGRU, @libdir)
|
23
|
+
end
|
24
|
+
|
25
|
+
def setup_db_in_homedir
|
26
|
+
FileUtils.mkdir_p(@apphome) unless Dir.exist?(@apphome)
|
27
|
+
FileUtils.cp(@systemdbname, @homedbname) unless File.exist?(@homedbname)
|
28
|
+
end
|
29
|
+
|
30
|
+
def startdb
|
31
|
+
setup_db_in_homedir
|
32
|
+
|
33
|
+
@db = Sequel::Model.db = Sequel.sqlite(@homedbname)
|
34
|
+
|
35
|
+
Kernel.at_exit { Sequel::Model.db.disconnect if Sequel::Model.db }
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
def serve
|
40
|
+
|
41
|
+
Dir.chdir @libdir
|
42
|
+
puts "Fiveapples version #{FiveApples::VERSION}"
|
43
|
+
exec "rackup -I#{@libdir} #{@configru}"
|
44
|
+
|
45
|
+
end
|
46
|
+
|
42
47
|
end
|
43
|
-
|
44
48
|
end
|
45
|
-
|
46
|
-
FiveA = FiveApples.new
|
49
|
+
FiveA = FiveApples::Server.new
|
@@ -31,7 +31,8 @@ sap.ui.define([
|
|
31
31
|
_that.byId('year').setValue("");
|
32
32
|
_that.byId('breeder_id').setValue("");
|
33
33
|
MessageToast.show("Create success");
|
34
|
-
|
34
|
+
// TODO: isnt this data access OData version dependant?
|
35
|
+
_that._oRouter.navTo( "cultivar_detail", {id: data["results"]["0"].id} );
|
35
36
|
}
|
36
37
|
function onErrorHandler(){
|
37
38
|
MessageToast.show("Create failed"); }
|
data/lib/version.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fiveapples
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- D.M.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: safrano
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- lib/ui5/view/ParentageList.view.xml
|
119
119
|
- lib/ui5/view/Parentage_Create.view.xml
|
120
120
|
- lib/ui5/view/Parentage_Detail.view.xml
|
121
|
+
- lib/version.rb
|
121
122
|
homepage: https://gitlab.com/dm0da/fiveapples
|
122
123
|
licenses:
|
123
124
|
- MIT
|