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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54fd8995c7242de470b93565d009d8cb1d060c803f028a4ee31002189bd09dbe
4
- data.tar.gz: 20caf73b8bef6a241689ccc6b17a4a575cebe8d98d3f29f03d33d441d03c5bf1
3
+ metadata.gz: e095d08a3f53b068ff096822ffd5793befc4ec987c4603f82686236748c4d159
4
+ data.tar.gz: cf09550ec6b23c19b09f63503484e88e15de12168d1c7d2404a318ff42b2e6b8
5
5
  SHA512:
6
- metadata.gz: a84f7047d5a21dab87c48f69d32bb9b162b732b84006b35ad4ccb25f7a63587d2a96ebd4c03186641890985dee9dc067f16e72b1d9b469f992599bd6ba8e9f74
7
- data.tar.gz: 36ce133a9c5535c3ff90352de8167846c731d79c5e4c03afd03c9b1629f5ed3cdf4d3e67904a0cf24fb3850ce061dcaee28524bca5f4c9bf4cc9bbe667f4d5b2
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
- exec (options[:summarized] ? "rspec -fd spec" : "rspec spec")
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
- erb template.to_sym, layout: false, locals: locals
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
@@ -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.deep_symbolize_keys : 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
@@ -1,3 +1,3 @@
1
1
  module Eucalypt
2
- VERSION = '0.3.3'
2
+ VERSION = '0.3.4'
3
3
  end
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.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-06 00:00:00.000000000 Z
11
+ date: 2018-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler