eucalypt 0.5.4 → 0.6.0
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/eucalypt/blog/namespaces/blog/templates/controller/controller_spec.tt +5 -5
- data/lib/eucalypt/blog/namespaces/blog/templates/helper/helper_spec.tt +2 -2
- data/lib/eucalypt/core/helpers/assets.rb +12 -0
- data/lib/eucalypt/core/helpers/default_index.rb +62 -0
- data/lib/eucalypt/core/helpers/maintenance.rb +9 -17
- data/lib/eucalypt/core/helpers/static.rb +9 -0
- data/lib/eucalypt/core/templates/eucalypt/Procfile +1 -1
- data/lib/eucalypt/core/templates/eucalypt/app/controllers/main_controller.rb +8 -0
- data/lib/eucalypt/core/templates/eucalypt/app/helpers/application_helper.rb +1 -0
- data/lib/eucalypt/core/templates/eucalypt/app/helpers/main_helper.rb +3 -0
- data/lib/eucalypt/core/templates/eucalypt/app.rb +6 -3
- data/lib/eucalypt/core/templates/eucalypt/config/assets.rb +0 -11
- data/lib/eucalypt/core/templates/eucalypt/config/logging.rb +2 -2
- data/lib/eucalypt/core/templates/eucalypt/config.ru +2 -2
- data/lib/eucalypt/core/templates/eucalypt/spec/controllers/main_controller_spec.rb +9 -0
- data/lib/eucalypt/core/templates/eucalypt/spec/helpers/application_helper_spec.rb +2 -2
- data/lib/eucalypt/core/templates/eucalypt/spec/helpers/main_helper_spec.rb +9 -0
- data/lib/eucalypt/destroy/helpers.rb +3 -3
- data/lib/eucalypt/destroy/namespaces/destroy/cli/destroy-scaffold.rb +1 -1
- data/lib/eucalypt/generate/namespaces/generate-controller/templates/controller_spec.tt +2 -2
- data/lib/eucalypt/generate/namespaces/generate-helper/templates/helper_spec.tt +2 -2
- data/lib/eucalypt/generate/namespaces/generate-model/templates/model_spec.tt +2 -2
- data/lib/eucalypt/load.rb +10 -4
- data/lib/eucalypt/version.rb +1 -1
- data/lib/eucalypt.rb +0 -1
- metadata +8 -5
- data/lib/eucalypt/core/templates/eucalypt/app/controllers/application_controller.rb +0 -13
- data/lib/eucalypt/core/templates/eucalypt/spec/controllers/application_controller_spec.rb +0 -9
- data/lib/eucalypt/guard.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63a4230316973e6c72642122be340698338ba605203cac4b45d136b67e470831
|
4
|
+
data.tar.gz: e195e28d876bc4f267b2247928dfb1f2989b2221c698c3b1277533505a52583d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98e8356429004cd6c51bf8772cf7fe73ff91f30a5824f851abb81deebaef4b17c47da94106337e49dca1367f122d6e5bd7f3a078a70c0e2ad0fff05f17c1b9f8
|
7
|
+
data.tar.gz: 460de18916f03b34b1fa63f81bdebb8e33619d9937dce312addbfd9cbd8da4efb9ca61beaef892e8025695f76eff17d913e7a7bee065b07491d6403285695533
|
@@ -11,7 +11,7 @@ describe BlogController do
|
|
11
11
|
describe 'blog page' do
|
12
12
|
it "should display all posts" do
|
13
13
|
get '/'
|
14
|
-
expect(true).to be
|
14
|
+
expect(true).to be true
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -22,20 +22,20 @@ describe BlogController do
|
|
22
22
|
before { get "/#{subpath}/#{post[:urltitle]}" }
|
23
23
|
|
24
24
|
it "should have a timestamp" do
|
25
|
-
expect(true).to be
|
25
|
+
expect(true).to be true
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should have a title" do
|
29
|
-
expect(true).to be
|
29
|
+
expect(true).to be true
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should have a description" do
|
33
|
-
expect(true).to be
|
33
|
+
expect(true).to be true
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should have tags" do
|
37
37
|
post[:tags].each do |tag|
|
38
|
-
expect(true).to be
|
38
|
+
expect(true).to be true
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class ApplicationController < Sinatra::Base
|
2
|
+
set :assets, Sprockets::Environment.new
|
3
|
+
|
4
|
+
Eucalypt.glob 'app', 'assets', '*' do |item|
|
5
|
+
assets.append_path item if File.directory? item
|
6
|
+
end
|
7
|
+
|
8
|
+
MainController.get '/assets/*' do
|
9
|
+
env["PATH_INFO"].sub! '/assets', ''
|
10
|
+
settings.assets.call env
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
class MainController < ApplicationController
|
2
|
+
unless self.routes["GET"].map {|r| r.first.to_s}.include?('/')
|
3
|
+
self.get '/' do
|
4
|
+
<<-HEREDOC
|
5
|
+
<html>
|
6
|
+
<head>
|
7
|
+
<style>
|
8
|
+
@import url('https://fonts.googleapis.com/css?family=Alegreya:400,500|Inconsolata:400,700');
|
9
|
+
body {
|
10
|
+
margin: 0;
|
11
|
+
height: 100vh;
|
12
|
+
width: 100vw;
|
13
|
+
display: flex;
|
14
|
+
align-items: center;
|
15
|
+
justify-content: center;
|
16
|
+
}
|
17
|
+
#container {
|
18
|
+
display: flex;
|
19
|
+
align-items: center;
|
20
|
+
}
|
21
|
+
#container img {
|
22
|
+
display: inline-block;
|
23
|
+
height: 200px;
|
24
|
+
padding: 30px;
|
25
|
+
}
|
26
|
+
#text {
|
27
|
+
display: inline-block;
|
28
|
+
}
|
29
|
+
#text h1 {
|
30
|
+
font-family: 'Alegreya', serif;
|
31
|
+
font-size: 2.5em;
|
32
|
+
}
|
33
|
+
#text p {
|
34
|
+
font-family: 'Inconsolata', monospace;
|
35
|
+
font-size: 1.5em;
|
36
|
+
}
|
37
|
+
#text p b {
|
38
|
+
color: rgb(120,120,120);
|
39
|
+
font-family: 'Inconsolata', monospace;
|
40
|
+
font-weight: 700;
|
41
|
+
}
|
42
|
+
#text p span {
|
43
|
+
color: #4ab37b;
|
44
|
+
}
|
45
|
+
</style>
|
46
|
+
<meta name="viewport" content="width=device-width">
|
47
|
+
</head>
|
48
|
+
<body>
|
49
|
+
<div id="container">
|
50
|
+
<img src="https://raw.githubusercontent.com/eucalypt-framework/eucalypt/master/gfx/eucalypt.png">
|
51
|
+
<div id="text">
|
52
|
+
<h1>It's alive!</h1>
|
53
|
+
<p><b>Eucalypt version</b> : <span>#{Eucalypt::VERSION}</span></p>
|
54
|
+
<p><b>Ruby version</b> : <span>#{RUBY_VERSION}</span></p>
|
55
|
+
</div>
|
56
|
+
</div>
|
57
|
+
</body>
|
58
|
+
</html>
|
59
|
+
HEREDOC
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -1,22 +1,14 @@
|
|
1
|
-
require 'sinatra'
|
2
|
-
require 'securerandom'
|
3
1
|
class ApplicationController < Sinatra::Base
|
4
|
-
|
5
|
-
if
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
link '*', &block
|
14
|
-
unlink '*', &block
|
2
|
+
def self.maintenance(enabled:, &block)
|
3
|
+
if enabled
|
4
|
+
MainController.get '/maintenance', &block
|
5
|
+
Eucalypt.glob('app', 'controllers', '*.rb') do |file|
|
6
|
+
controller = File.basename(file,'.*').camelize.constantize
|
7
|
+
controller.before '*' do
|
8
|
+
splat = params[:splat].reject {|param| /\/assets\/.*/.match? param}
|
9
|
+
redirect '/maintenance' unless splat.include?('/maintenance') || splat.empty?
|
10
|
+
end
|
15
11
|
end
|
16
|
-
else
|
17
|
-
define_singleton_method(:maintenance) {|&block| get 3.times.map{"/#{SecureRandom.hex 8}"}.join(), &block}
|
18
12
|
end
|
19
|
-
else
|
20
|
-
define_singleton_method(:maintenance) {|&block| get 3.times.map{"/#{SecureRandom.hex 8}"}.join(), &block}
|
21
13
|
end
|
22
14
|
end
|
@@ -44,4 +44,13 @@ class ApplicationController < Sinatra::Base
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
47
|
+
|
48
|
+
helpers do
|
49
|
+
def render_static(file)
|
50
|
+
raise ArgumentError.new("Invalid argument #{file} for 'file' - Expected string (file path with preceding /)") unless file.is_a?(String) && file.start_with?('/')
|
51
|
+
location = File.join settings.public_folder, file.sub('/', '')
|
52
|
+
raise ArgumentError.new("Invalid argument #{file} for 'file' - File \"#{location}\" doesn't exist") unless File.file? location
|
53
|
+
send_file location
|
54
|
+
end
|
55
|
+
end
|
47
56
|
end
|
@@ -1 +1 @@
|
|
1
|
-
web:
|
1
|
+
web: eucalypt launch production -p $PORT
|
@@ -20,11 +20,14 @@ class ApplicationController < Sinatra::Base
|
|
20
20
|
# Set default ERB template
|
21
21
|
set :erb, layout: :'layouts/main'
|
22
22
|
|
23
|
-
# Toggle maintenance mode
|
24
|
-
disable :maintenance
|
25
|
-
|
26
23
|
# Set Hanami HTML and asset helpers
|
27
24
|
helpers Hanami::Helpers, Hanami::Assets::Helpers
|
28
25
|
|
26
|
+
# Load controllers and other application files
|
29
27
|
require 'eucalypt/load'
|
28
|
+
|
29
|
+
# Set maintenance route
|
30
|
+
maintenance enabled: false do
|
31
|
+
render_static '/maintenance.html'
|
32
|
+
end
|
30
33
|
end
|
@@ -1,15 +1,4 @@
|
|
1
1
|
class ApplicationController < Sinatra::Base
|
2
|
-
set :assets, Sprockets::Environment.new
|
3
|
-
|
4
2
|
assets.css_compressor = :scss
|
5
3
|
assets.js_compressor = :uglify
|
6
|
-
|
7
|
-
Eucalypt.glob 'app', 'assets', '*' do |item|
|
8
|
-
assets.append_path item if File.directory? item
|
9
|
-
end
|
10
|
-
|
11
|
-
get '/assets/*' do
|
12
|
-
env["PATH_INFO"].sub! '/assets', ''
|
13
|
-
settings.assets.call env
|
14
|
-
end
|
15
4
|
end
|
@@ -5,12 +5,12 @@ class ApplicationController < Sinatra::Base
|
|
5
5
|
end
|
6
6
|
|
7
7
|
configure :development do
|
8
|
-
|
8
|
+
set :logging, Lumberjack::Severity::DEBUG
|
9
9
|
disable :log_file
|
10
10
|
end
|
11
11
|
|
12
12
|
configure :production do
|
13
|
-
|
13
|
+
enable :logging
|
14
14
|
enable :log_file
|
15
15
|
end
|
16
16
|
|
@@ -2,9 +2,9 @@ require_relative 'app'
|
|
2
2
|
|
3
3
|
Eucalypt.glob('app', 'controllers', '*.rb').each do |file|
|
4
4
|
controller_name = File.basename(file,'.*').camelize
|
5
|
-
next if controller_name == '
|
5
|
+
next if controller_name == 'MainController'
|
6
6
|
controller = controller_name.constantize
|
7
7
|
map(controller.router) { run controller }
|
8
8
|
end
|
9
9
|
|
10
|
-
map('/') { run
|
10
|
+
map('/') { run MainController }
|
@@ -13,7 +13,7 @@ module Eucalypt
|
|
13
13
|
directory = File.expand_path('.')
|
14
14
|
if Eucalypt.app? directory
|
15
15
|
files = Dir[File.join directory, 'app', "#{mvc_file}s", '*.rb']
|
16
|
-
file_names = files.map{|c| File.basename(c).split(?_).first}.reject{|n| n=='
|
16
|
+
file_names = files.map{|c| File.basename(c).split(?_).first}.reject{|n| n == 'main' }
|
17
17
|
|
18
18
|
if files.empty?
|
19
19
|
Eucalypt::Error.no_mvc(mvc_file)
|
@@ -28,13 +28,13 @@ module Eucalypt
|
|
28
28
|
file_name = mvc_file == :model ? "#{name}.rb" : "#{name}_#{mvc_file}.rb"
|
29
29
|
spec_file_name = mvc_file == :model ? "#{name}_spec.rb" : "#{name}_#{mvc_file}_spec.rb"
|
30
30
|
|
31
|
-
unless file_names.include?
|
31
|
+
unless file_names.include? name
|
32
32
|
Eucalypt::Error.no_mvc(mvc_file)
|
33
33
|
return
|
34
34
|
end
|
35
35
|
else
|
36
36
|
# If name not given
|
37
|
-
files = Dir[File.join directory, 'app', "#{mvc_file}s", "*.rb"].reject{|f| File.basename(f)
|
37
|
+
files = Dir[File.join directory, 'app', "#{mvc_file}s", "*.rb"].reject{|f| File.basename(f) == 'main_controller.rb' }
|
38
38
|
if files.empty?
|
39
39
|
Eucalypt::Error.no_mvc(mvc_file)
|
40
40
|
return
|
data/lib/eucalypt/load.rb
CHANGED
@@ -1,12 +1,18 @@
|
|
1
|
+
class MainController < ApplicationController; end
|
2
|
+
|
3
|
+
require 'eucalypt/core/helpers/assets'
|
1
4
|
Eucalypt.require 'config', '*.rb'
|
2
5
|
Eucalypt.require 'config', 'initializers', '*.rb'
|
3
6
|
|
4
|
-
require 'eucalypt/core/helpers/maintenance'
|
5
7
|
require 'eucalypt/core/helpers/static'
|
6
|
-
|
7
8
|
Eucalypt.require 'app', 'helpers', '{application_helper.rb}'
|
8
|
-
|
9
|
+
ApplicationController.helpers ApplicationHelper if defined? ApplicationHelper
|
10
|
+
|
11
|
+
Eucalypt.require 'app', 'helpers', '{main_helper.rb}'
|
12
|
+
Eucalypt.require 'app', 'controllers', 'main_controller.rb'
|
9
13
|
Eucalypt.require 'app', '{models}', '{roles}', '*.rb'
|
10
14
|
Eucalypt.require 'app', '{models,policies,helpers,controllers}', '*.rb'
|
11
15
|
|
12
|
-
require 'eucalypt/security/permissions'
|
16
|
+
require 'eucalypt/security/permissions'
|
17
|
+
require 'eucalypt/core/helpers/default_index'
|
18
|
+
require 'eucalypt/core/helpers/maintenance'
|
data/lib/eucalypt/version.rb
CHANGED
data/lib/eucalypt.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eucalypt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edwin Onuonga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -233,6 +233,8 @@ files:
|
|
233
233
|
- lib/eucalypt/core/cli/rake.rb
|
234
234
|
- lib/eucalypt/core/cli/test.rb
|
235
235
|
- lib/eucalypt/core/cli/version.rb
|
236
|
+
- lib/eucalypt/core/helpers/assets.rb
|
237
|
+
- lib/eucalypt/core/helpers/default_index.rb
|
236
238
|
- lib/eucalypt/core/helpers/logging.rb
|
237
239
|
- lib/eucalypt/core/helpers/maintenance.rb
|
238
240
|
- lib/eucalypt/core/helpers/manifest.rb
|
@@ -250,8 +252,9 @@ files:
|
|
250
252
|
- lib/eucalypt/core/templates/eucalypt/app/assets/stylesheets/__partials__.scss
|
251
253
|
- lib/eucalypt/core/templates/eucalypt/app/assets/stylesheets/application.scss
|
252
254
|
- lib/eucalypt/core/templates/eucalypt/app/assets/stylesheets/partials/_mixins.scss
|
253
|
-
- lib/eucalypt/core/templates/eucalypt/app/controllers/
|
255
|
+
- lib/eucalypt/core/templates/eucalypt/app/controllers/main_controller.rb
|
254
256
|
- lib/eucalypt/core/templates/eucalypt/app/helpers/application_helper.rb
|
257
|
+
- lib/eucalypt/core/templates/eucalypt/app/helpers/main_helper.rb
|
255
258
|
- lib/eucalypt/core/templates/eucalypt/app/models/.empty_directory
|
256
259
|
- lib/eucalypt/core/templates/eucalypt/app/static/public/maintenance.html
|
257
260
|
- lib/eucalypt/core/templates/eucalypt/app/views/index.erb
|
@@ -263,8 +266,9 @@ files:
|
|
263
266
|
- lib/eucalypt/core/templates/eucalypt/config/initializers/.empty_directory
|
264
267
|
- lib/eucalypt/core/templates/eucalypt/config/logging.rb
|
265
268
|
- lib/eucalypt/core/templates/eucalypt/logs/.empty_directory
|
266
|
-
- lib/eucalypt/core/templates/eucalypt/spec/controllers/
|
269
|
+
- lib/eucalypt/core/templates/eucalypt/spec/controllers/main_controller_spec.rb
|
267
270
|
- lib/eucalypt/core/templates/eucalypt/spec/helpers/application_helper_spec.rb
|
271
|
+
- lib/eucalypt/core/templates/eucalypt/spec/helpers/main_helper_spec.rb
|
268
272
|
- lib/eucalypt/core/templates/eucalypt/spec/models/.empty_directory
|
269
273
|
- lib/eucalypt/core/templates/eucalypt/spec/spec_helper.rb
|
270
274
|
- lib/eucalypt/destroy/helpers.rb
|
@@ -291,7 +295,6 @@ files:
|
|
291
295
|
- lib/eucalypt/generate/namespaces/generate-model/templates/model_spec.tt
|
292
296
|
- lib/eucalypt/generate/namespaces/generate/cli/generate-scaffold.rb
|
293
297
|
- lib/eucalypt/generate/namespaces/generate/cli/generate.rb
|
294
|
-
- lib/eucalypt/guard.rb
|
295
298
|
- lib/eucalypt/helpers.rb
|
296
299
|
- lib/eucalypt/helpers/colorize.rb
|
297
300
|
- lib/eucalypt/helpers/gemfile.rb
|