eucalypt 0.3.5 → 0.4.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/README.md +4 -6
- data/eucalypt.gemspec +1 -1
- data/lib/eucalypt/core/templates/eucalypt/app.rb +7 -2
- data/lib/eucalypt/core/templates/eucalypt/config/logging.rb +7 -3
- data/lib/eucalypt/core/templates/eucalypt/spec/spec_helper.rb +1 -3
- data/lib/eucalypt/static.rb +4 -2
- data/lib/eucalypt/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c60fdfe8acbb3fc20522a15ba2b2ae84ae44e0bf38cac367e0cb8e68ca27d93
|
4
|
+
data.tar.gz: 44a5f0030d260eed36904ff8b25d5604b37168dec7bdc6e0da7a65ef6c4d5838
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4327801d427b9edf24794acac2cf0dc27149aacefdc93c3a2819395237c93fc78dc180119c34cbc9397f7d2730ee2b6b5377f38b81c87d6219ce2abb4e72ef79
|
7
|
+
data.tar.gz: c365dc1bf0e21686501762fb4bb7408e6a1873eec45285fd930f214e1e94501c2b017512c6e10b9a1e9a9726fed6c35f1558abd457074a16e48a7d38b1a62771
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
# Eucalypt
|
10
10
|
|
11
|
-
Micro-framework and CLI wrapped around the Sinatra DSL.
|
11
|
+
Micro-framework, application generator and CLI wrapped around the Sinatra DSL.
|
12
12
|
|
13
13
|
## Installation
|
14
14
|
|
@@ -26,20 +26,18 @@ Initialize a new application with:
|
|
26
26
|
$ eucalypt init my-new-app
|
27
27
|
```
|
28
28
|
|
29
|
-
> Once the setup is complete, make sure the required gems have been installed (without any errors).
|
29
|
+
> Once the setup is complete, make sure the required gems have been installed (without any errors).
|
30
30
|
>
|
31
31
|
> This should have been done automatically unless you used the `--no-bundle` flag during initialization.
|
32
32
|
|
33
|
-
Move into your new application's directory and run the top-level
|
33
|
+
Move into your new application's directory and run the top-level `$ eucalypt` command to display a list of all available commands.
|
34
34
|
|
35
35
|
## Documentation
|
36
36
|
|
37
|
-
|
37
|
+
Full documentation can be found in the form of a GitBook, [here](https://eucalypt.gitbook.io/eucalypt).
|
38
38
|
|
39
39
|
## Features
|
40
40
|
|
41
|
-
Some of these features are pretty set in stone, but it may be possible to change some of them around with a little bit of work.
|
42
|
-
|
43
41
|
| Type | Feature |
|
44
42
|
| -------------------- | ------------------------------------------------------------ |
|
45
43
|
| Core/DSL | [Sinatra](http://sinatrarb.com/) |
|
data/eucalypt.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["Edwin Onuonga"]
|
9
9
|
spec.email = ["edwinonuonga@gmail.com"]
|
10
10
|
|
11
|
-
spec.summary = %q{Micro-framework and CLI wrapped around the Sinatra DSL.}
|
11
|
+
spec.summary = %q{Micro-framework, application generator and CLI wrapped around the Sinatra DSL.}
|
12
12
|
spec.homepage = "https://eucalypt.gitbook.io/eucalypt"
|
13
13
|
spec.license = "MIT"
|
14
14
|
spec.files = Dir.glob('lib/**/*', File::FNM_DOTMATCH) + %w[Gemfile LICENSE README.md Rakefile eucalypt.gemspec bin/eucalypt]
|
@@ -4,8 +4,6 @@ require 'sinatra'
|
|
4
4
|
Bundler.require :default, settings.environment
|
5
5
|
Eucalypt.set_root __dir__
|
6
6
|
|
7
|
-
Static = Eucalypt::Static.new(Eucalypt.path('app', 'static'), symbolize: true).freeze
|
8
|
-
|
9
7
|
class ApplicationController < Sinatra::Base
|
10
8
|
# Set server
|
11
9
|
set :server, %w[thin webrick]
|
@@ -16,6 +14,13 @@ class ApplicationController < Sinatra::Base
|
|
16
14
|
# Set application root directory
|
17
15
|
set :root, Eucalypt.root
|
18
16
|
|
17
|
+
# Set public folder for static files
|
18
|
+
set :public_folder, Eucalypt.path('app', 'static')
|
19
|
+
|
20
|
+
# Allow static files to be served
|
21
|
+
set :static, true
|
22
|
+
::Static = Eucalypt::Static.new(settings.public_folder, symbolize: true).freeze
|
23
|
+
|
19
24
|
# Set views directory
|
20
25
|
set :views, Eucalypt.path('app', 'views')
|
21
26
|
|
@@ -3,12 +3,16 @@ class ApplicationController < Sinatra::Base
|
|
3
3
|
set :logger, Lumberjack::Logger.new
|
4
4
|
helpers { def logger() settings.logger end }
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
configure(:test) { disable :logging }
|
7
|
+
configure(:development) { enable :logging }
|
8
|
+
|
9
|
+
# Environments where STDOUT should be redirected to log file
|
10
|
+
%i[production].each do |app_env|
|
8
11
|
configure app_env do
|
12
|
+
enable :logging
|
9
13
|
use Rack::CommonLogger, $stdout
|
10
14
|
|
11
|
-
time = Time.now.strftime("%Y-%m-%
|
15
|
+
time = Time.now.strftime("%Y-%m-%d_%H-%M-%S")
|
12
16
|
log_path = Eucalypt.path 'log', time.sub(/_\+/, ?p).sub(/_\-/, ?m)
|
13
17
|
FileUtils.mkdir_p log_path
|
14
18
|
|
data/lib/eucalypt/static.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'eucalypt/helpers/inflect'
|
2
|
+
require 'active_support/core_ext/hash'
|
2
3
|
require 'json'
|
3
4
|
require 'yaml'
|
4
5
|
|
@@ -6,7 +7,7 @@ module Eucalypt
|
|
6
7
|
class Static
|
7
8
|
include Eucalypt::Helpers
|
8
9
|
|
9
|
-
FILE_TYPES = {yaml: %w[yml yaml], json: %w[json geojson]}
|
10
|
+
FILE_TYPES = {yaml: %w[yml yaml], json: %w[json geojson], xml: %w[xml]}
|
10
11
|
|
11
12
|
def initialize(directory, symbolize: false)
|
12
13
|
contents = Dir[File.join directory, '*']
|
@@ -23,7 +24,7 @@ module Eucalypt
|
|
23
24
|
extension = File.extname(file).sub /\A./, ''
|
24
25
|
file_type = nil
|
25
26
|
FILE_TYPES.each {|t, e| file_type = t if e.include? extension}
|
26
|
-
|
27
|
+
return if file_type.nil? # Unsupported extension
|
27
28
|
define_singleton_method Inflect.resource_keep_inflection(file_name) do
|
28
29
|
hash = parse(file_type, file)
|
29
30
|
hash = hash ? hash : {}
|
@@ -42,6 +43,7 @@ module Eucalypt
|
|
42
43
|
case file_type
|
43
44
|
when :yaml then YAML.load_file(file)
|
44
45
|
when :json then JSON.parse(File.read file)
|
46
|
+
when :xml then Hash.from_xml(File.read file)
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
data/lib/eucalypt/version.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.4.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: 2018-12-
|
11
|
+
date: 2018-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -377,5 +377,6 @@ rubyforge_project:
|
|
377
377
|
rubygems_version: 2.7.6
|
378
378
|
signing_key:
|
379
379
|
specification_version: 4
|
380
|
-
summary: Micro-framework and CLI wrapped around the Sinatra
|
380
|
+
summary: Micro-framework, application generator and CLI wrapped around the Sinatra
|
381
|
+
DSL.
|
381
382
|
test_files: []
|