sinatra-hexacta 0.3.1 → 0.3.2
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/sinatra/handlers/errors.rb +1 -1
- data/lib/sinatra/handlers/notifications.rb +2 -2
- data/lib/sinatra/helpers/alerts.rb +1 -1
- data/lib/sinatra/helpers/charts.rb +1 -1
- data/lib/sinatra/helpers/inputs.rb +1 -1
- data/lib/sinatra/helpers/libraries.rb +1 -1
- data/lib/sinatra/helpers/reports.rb +1 -1
- data/lib/sinatra/hexacta.rb +12 -25
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6fb503a8966bb24d1526acd9e44a6b8f798967193f7b5c465c61b86c4eb4d76
|
4
|
+
data.tar.gz: 1896cd47708d90de659d4e7d5253d3588331fd2372234c7c1bc152783bbd75ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cbd2de133ebff3475d3d8f398d6588d264d6d310194b150e45a061a7d094f03dfe7288ef5b27bc1d9cecf663504fd793e0d0da9c9d47852ce327f04c5fc1e0b
|
7
|
+
data.tar.gz: ff26fc925028c9a03ca3af480c9292ed8a6ba6f463180d39625fb5a6ed896d13570f41e786a9d4038235ddfd950234e0e1ef402ee8be17085e8a8eb3670319c4
|
@@ -13,7 +13,7 @@ module Sinatra
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def error_template(code)
|
16
|
-
ErrorHandler.
|
16
|
+
ErrorHandler.copy_file("/lib/sinatra/views/errors/#{code}.slim","/app/views/#{Hexacta::GEM_FILE_DIR}/errors/#{code}.slim")
|
17
17
|
error code do
|
18
18
|
if code == 500
|
19
19
|
title = env['sinatra.error'].message.split(':')[0].gsub('#<','');
|
@@ -6,8 +6,8 @@ module Sinatra
|
|
6
6
|
def enable_notifications
|
7
7
|
p "Enabling notifications..."
|
8
8
|
NotificationHandler.setup_dir("/app/views/#{Hexacta::GEM_FILE_DIR}/notifications")
|
9
|
-
NotificationHandler.
|
10
|
-
NotificationHandler.
|
9
|
+
NotificationHandler.copy_file("/lib/sinatra/views/notifications.slim","/app/views/#{Hexacta::GEM_FILE_DIR}/notifications.slim")
|
10
|
+
NotificationHandler.copy_all_files("/lib/sinatra/views/notifications","/app/views/#{Hexacta::GEM_FILE_DIR}/notifications")
|
11
11
|
|
12
12
|
post '/notification' do
|
13
13
|
if params[:user_ids].blank?
|
@@ -20,7 +20,7 @@ module Sinatra
|
|
20
20
|
end
|
21
21
|
|
22
22
|
setup_dir("/app/views/#{Hexacta::GEM_FILE_DIR}/alerts")
|
23
|
-
|
23
|
+
copy_all_files("/lib/sinatra/views/alerts","/app/views/#{Hexacta::GEM_FILE_DIR}/alerts")
|
24
24
|
end
|
25
25
|
|
26
26
|
helpers AlertHelper
|
@@ -24,7 +24,7 @@ module Sinatra
|
|
24
24
|
end
|
25
25
|
|
26
26
|
setup_dir("/app/views/#{Hexacta::GEM_FILE_DIR}/charts")
|
27
|
-
|
27
|
+
copy_all_files("/lib/sinatra/views/charts","/app/views/#{Hexacta::GEM_FILE_DIR}/charts")
|
28
28
|
end
|
29
29
|
|
30
30
|
helpers ChartsHelper
|
@@ -40,7 +40,7 @@ module Sinatra
|
|
40
40
|
end
|
41
41
|
|
42
42
|
setup_dir("/app/views/#{Hexacta::GEM_FILE_DIR}/inputs")
|
43
|
-
|
43
|
+
copy_all_files("/lib/sinatra/views/inputs","/app/views/#{Hexacta::GEM_FILE_DIR}/inputs")
|
44
44
|
end
|
45
45
|
|
46
46
|
helpers InputHelper
|
@@ -18,7 +18,7 @@ module Sinatra
|
|
18
18
|
p "Setting up libraries directory..."
|
19
19
|
copy_dir_structure("/lib/sinatra/public","/app/public/#{Hexacta::GEM_FILE_DIR}")
|
20
20
|
setup_dir("/app/views/#{Hexacta::GEM_FILE_DIR}/libraries")
|
21
|
-
|
21
|
+
copy_all_files("/lib/sinatra/views/libraries","/app/views/#{Hexacta::GEM_FILE_DIR}/libraries")
|
22
22
|
end
|
23
23
|
|
24
24
|
helpers LibrariesHelper
|
@@ -20,7 +20,7 @@ module Sinatra
|
|
20
20
|
end
|
21
21
|
|
22
22
|
setup_dir("/app/views/#{Hexacta::GEM_FILE_DIR}/reports")
|
23
|
-
|
23
|
+
copy_all_files("/lib/sinatra/views/reports","/app/views/#{Hexacta::GEM_FILE_DIR}/reports")
|
24
24
|
end
|
25
25
|
|
26
26
|
helpers ReportHelper
|
data/lib/sinatra/hexacta.rb
CHANGED
@@ -9,43 +9,30 @@ module Sinatra
|
|
9
9
|
module Hexacta
|
10
10
|
GEM_FILE_DIR = "sinatra-hexacta"
|
11
11
|
|
12
|
-
def
|
13
|
-
File.
|
12
|
+
def gem_path
|
13
|
+
File.expand_path("../..",__dir__)
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
|
18
|
-
symlink("#{original_path}/#{child}","#{link_path}/#{child}") unless child == '.' || child == '..'
|
19
|
-
end unless Gem.loaded_specs["sinatra-hexacta"].nil?
|
16
|
+
def copy_file(original_path, link_path)
|
17
|
+
IO.copy_stream("#{gem_path}#{original_path}",link_path) unless File.exist?(link_path) && FileUtils.compare_file("#{gem_path}#{original_path}",link_path)
|
20
18
|
end
|
21
19
|
|
22
|
-
def
|
23
|
-
|
24
|
-
|
25
|
-
FileUtils.mkdir_p path
|
20
|
+
def copy_all_files(original_path, link_path)
|
21
|
+
Dir.foreach("#{gem_path}#{original_path}") do |child|
|
22
|
+
copy_file("#{original_path}/#{child}","#{link_path}/#{child}") unless child == '.' || child == '..'
|
26
23
|
end
|
27
24
|
end
|
28
25
|
|
26
|
+
def setup_dir(path)
|
27
|
+
FileUtils.mkdir_p path
|
28
|
+
end
|
29
|
+
|
29
30
|
def copy_dir_structure(original_path, destination_path)
|
30
|
-
|
31
|
-
FileUtils.remove_dir destination_path if Dir.exist? destination_path
|
32
|
-
FileUtils.copy_entry("#{Gem.loaded_specs["sinatra-hexacta"].gem_dir}#{original_path}", destination_path)
|
33
|
-
end
|
31
|
+
FileUtils.copy_entry("#{gem_path}#{original_path}", destination_path)
|
34
32
|
end
|
35
33
|
end
|
36
34
|
end
|
37
35
|
|
38
|
-
if Gem.loaded_specs["sinatra-hexacta"].nil?
|
39
|
-
p "ERROR: Sinatra hexacta gem was not found"
|
40
|
-
else
|
41
|
-
p "Sinatr hexacta gem was found in #{Gem.loaded_specs["sinatra-hexacta"].gem_dir}"
|
42
|
-
end
|
43
|
-
|
44
|
-
unless Gem.loaded_specs["sinatra-hexacta"].nil?
|
45
|
-
FileUtils.remove_dir "/app/views/sinatra-hexacta" if Dir.exist? "/app/views/sinatra-hexacta"
|
46
|
-
FileUtils.remove_dir "/app/public/sinatra-hexacta" if Dir.exist? "/app/public/sinatra-hexacta"
|
47
|
-
end
|
48
|
-
|
49
36
|
require_relative 'helpers/init'
|
50
37
|
require_relative 'handlers/init'
|
51
38
|
require_relative 'extensions/init'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-hexacta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marco Zanger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A gem to support general functionality accross all apps
|
14
14
|
email: mzanger@hexacta.com
|