eucalypt 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eucalypt/core/cli/test.rb +6 -1
- data/lib/eucalypt/core/helpers/partial.rb +2 -1
- data/lib/eucalypt/static.rb +39 -1
- data/lib/eucalypt/version.rb +1 -1
- 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: e095d08a3f53b068ff096822ffd5793befc4ec987c4603f82686236748c4d159
|
4
|
+
data.tar.gz: cf09550ec6b23c19b09f63503484e88e15de12168d1c7d2404a318ff42b2e6b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3011e09e93df78d55cb17b3138fe30e5c27bba68bd1cf6ae2406830f17a03d5be968464fdc1a23431ebc78fc99eb470d75374a10c107c39f6e2bd312da1cea18
|
7
|
+
data.tar.gz: b59a8e0567d390a499764021b83e7ce911b1b33d5b33f396826b1e1225dd633b9b469966f2dee2dd0b734e55e9339c1e77f6c8de9bffc4f88152b6c6334928c4
|
@@ -1,13 +1,18 @@
|
|
1
1
|
require_relative '__base__'
|
2
2
|
module Eucalypt
|
3
3
|
class CLI < Thor
|
4
|
+
using String::Builder
|
4
5
|
using Colorize
|
5
6
|
option :summarized, type: :boolean, default: false, aliases: '-s', desc: 'rspec -fd spec'
|
6
7
|
desc "test", "Run all application tests".colorize(:grey)
|
7
8
|
def test
|
8
9
|
directory = File.expand_path('.')
|
9
10
|
if Eucalypt.app? directory
|
10
|
-
|
11
|
+
cmd = 'bundle exec rspec '.build do |s|
|
12
|
+
s << '-fd ' if options[:summarized]
|
13
|
+
s << 'spec'
|
14
|
+
end
|
15
|
+
exec cmd
|
11
16
|
else
|
12
17
|
Eucalypt::Error.wrong_directory
|
13
18
|
end
|
@@ -2,7 +2,8 @@ require 'sinatra'
|
|
2
2
|
class ApplicationController < Sinatra::Base
|
3
3
|
helpers do
|
4
4
|
def partial(template, **locals)
|
5
|
-
|
5
|
+
path = template.to_s.start_with?('partials/') ? template : "partials/#{template}"
|
6
|
+
erb path.to_sym, layout: false, locals: locals
|
6
7
|
end
|
7
8
|
end
|
8
9
|
end
|
data/lib/eucalypt/static.rb
CHANGED
@@ -27,7 +27,7 @@ module Eucalypt
|
|
27
27
|
define_singleton_method Inflect.resource_keep_inflection(file_name) do
|
28
28
|
hash = parse(file_type, file)
|
29
29
|
hash = hash ? hash : {}
|
30
|
-
symbolize ? hash
|
30
|
+
symbolize ? symbolize_keys(hash) : hash
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -44,5 +44,43 @@ module Eucalypt
|
|
44
44
|
when :json then JSON.parse(File.read file)
|
45
45
|
end
|
46
46
|
end
|
47
|
+
|
48
|
+
def symbolize_keys(obj)
|
49
|
+
|
50
|
+
case obj
|
51
|
+
|
52
|
+
when Array
|
53
|
+
obj.inject([]){|res, val|
|
54
|
+
res << case val
|
55
|
+
when Hash, Array
|
56
|
+
symbolize_keys(val)
|
57
|
+
else
|
58
|
+
val
|
59
|
+
end
|
60
|
+
res
|
61
|
+
}
|
62
|
+
|
63
|
+
when Hash
|
64
|
+
obj.inject({}){|res, (key, val)|
|
65
|
+
nkey = case key
|
66
|
+
when String
|
67
|
+
key.to_sym
|
68
|
+
else
|
69
|
+
key
|
70
|
+
end
|
71
|
+
nval = case val
|
72
|
+
when Hash, Array
|
73
|
+
symbolize_keys(val)
|
74
|
+
else
|
75
|
+
val
|
76
|
+
end
|
77
|
+
res[nkey] = nval
|
78
|
+
res
|
79
|
+
}
|
80
|
+
else
|
81
|
+
obj
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
47
85
|
end
|
48
86
|
end
|
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.3.
|
4
|
+
version: 0.3.4
|
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-
|
11
|
+
date: 2018-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|