jetski 0.1.4 → 0.1.6
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/lib/jetski/splash_router.rb +4 -4
- data/lib/jetski/waterfall_controller.rb +2 -2
- data/lib/jetski.rb +11 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9cc9b88e2c41fbcc2309861e79463aedfa5b74609c586727e1c2bd299795d935
|
|
4
|
+
data.tar.gz: d86233e0c7004b9e39ab74b0a9c81c6fdacedfaf8ef21381b19e2bcdb82c1af6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4bf7480dd350ab39470ed4365360df3a04dd487a4514c656c3064c36d691ddfbcd3b9acb596b871c752f9e3f7aa17eb8c3cc50dd9612555c6e30fbaf01ba62cd
|
|
7
|
+
data.tar.gz: 0ebd7a01770a920234de7cbe0cd0e5027f09be9494c88834d0b0edc84d8c76790ffe02e5d2a0aa519d9d5e836668f02cf753389e2197631c99e7f2ec0367d8d7
|
data/lib/jetski/splash_router.rb
CHANGED
|
@@ -10,7 +10,7 @@ module Jetski
|
|
|
10
10
|
|
|
11
11
|
def parse_routes
|
|
12
12
|
# Convert routes file into render of correct controller and action
|
|
13
|
-
routes_file = File.join(
|
|
13
|
+
routes_file = File.join(Jetski.app_root, "config/routes.rb")
|
|
14
14
|
|
|
15
15
|
File.readlines(routes_file, chomp: true).each do |line|
|
|
16
16
|
route_action = line.split(" ")[0]
|
|
@@ -25,7 +25,7 @@ module Jetski
|
|
|
25
25
|
|
|
26
26
|
server.mount_proc served_url do |req, res|
|
|
27
27
|
constantized_controller = "#{controller_name.capitalize}Controller"
|
|
28
|
-
path_to_defined_controller = File.join(
|
|
28
|
+
path_to_defined_controller = File.join(Jetski.app_root, "app/controllers/#{controller_name}_controller.rb")
|
|
29
29
|
require_relative path_to_defined_controller
|
|
30
30
|
found_error = false
|
|
31
31
|
begin
|
|
@@ -48,12 +48,12 @@ module Jetski
|
|
|
48
48
|
|
|
49
49
|
def host_assets
|
|
50
50
|
# Render css via url
|
|
51
|
-
css_files = Dir[File.join(
|
|
51
|
+
css_files = Dir[File.join(Jetski.app_root,'app/assets/stylesheets/*.css')]
|
|
52
52
|
css_files.each do |file_path|
|
|
53
53
|
filename = file_path.split("/").last
|
|
54
54
|
asset_url = "/assets/#{filename}"
|
|
55
55
|
server.mount_proc asset_url do |req, res|
|
|
56
|
-
res.body = File.read(File.join(
|
|
56
|
+
res.body = File.read(File.join(Jetski.app_root,"app/assets/stylesheets/#{filename}"))
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
end
|
|
@@ -10,8 +10,8 @@ module Jetski
|
|
|
10
10
|
# Method to render matching view with controller_name/action_name
|
|
11
11
|
|
|
12
12
|
def render
|
|
13
|
-
views_folder = File.join(
|
|
14
|
-
assets_folder = File.join(
|
|
13
|
+
views_folder = File.join(Jetski.app_root, 'app/views')
|
|
14
|
+
assets_folder = File.join(Jetski.app_root, 'app/assets/stylesheets')
|
|
15
15
|
layout_content = File.read(File.join(views_folder, "layouts/application.html"))
|
|
16
16
|
page_content = File.read(File.join(views_folder, controller_name, "#{action_name}.html"))
|
|
17
17
|
page_with_layout = layout_content.gsub("YIELD_CONTENT", page_content)
|
data/lib/jetski.rb
CHANGED
|
@@ -5,6 +5,15 @@ require "webrick"
|
|
|
5
5
|
require "pry"
|
|
6
6
|
|
|
7
7
|
module Jetski
|
|
8
|
-
#
|
|
9
|
-
|
|
8
|
+
# Debug stage add constants here for debugging.
|
|
9
|
+
extend self
|
|
10
|
+
def app_root
|
|
11
|
+
if ENV['JETSKI_PROJECT_PATH']
|
|
12
|
+
ENV['JETSKI_PROJECT_PATH']
|
|
13
|
+
elsif ENV['USE_DIR']
|
|
14
|
+
__dir__
|
|
15
|
+
else
|
|
16
|
+
Dir.pwd
|
|
17
|
+
end
|
|
18
|
+
end
|
|
10
19
|
end
|