locomotivecms_steam 1.0.0.pre.alpha → 1.0.0.pre.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +49 -34
- data/bin/steam.rb +1 -1
- data/lib/locomotive/steam.rb +8 -6
- data/lib/locomotive/steam/adapters/filesystem/simple_cache_store.rb +4 -0
- data/lib/locomotive/steam/adapters/filesystem/yaml_loaders/content_type.rb +1 -1
- data/lib/locomotive/steam/adapters/filesystem/yaml_loaders/page.rb +32 -10
- data/lib/locomotive/steam/adapters/filesystem/yaml_loaders/theme_asset.rb +31 -1
- data/lib/locomotive/steam/decorators/i18n_decorator.rb +1 -1
- data/lib/locomotive/steam/decorators/template_decorator.rb +1 -0
- data/lib/locomotive/steam/entities/content_entry.rb +9 -1
- data/lib/locomotive/steam/entities/content_type_field.rb +4 -0
- data/lib/locomotive/steam/entities/theme_asset.rb +8 -0
- data/lib/locomotive/steam/initializers/sprockets.rb +49 -0
- data/lib/locomotive/steam/liquid/filters/base.rb +5 -6
- data/lib/locomotive/steam/liquid/tags/editable/base.rb +4 -5
- data/lib/locomotive/steam/liquid/tags/extends.rb +1 -36
- data/lib/locomotive/steam/liquid/tags/inherited_block.rb +10 -4
- data/lib/locomotive/steam/liquid/tags/snippet.rb +8 -9
- data/lib/locomotive/steam/middlewares/dynamic_assets.rb +6 -36
- data/lib/locomotive/steam/middlewares/helpers.rb +9 -2
- data/lib/locomotive/steam/middlewares/site.rb +10 -2
- data/lib/locomotive/steam/models/associations/embedded.rb +1 -1
- data/lib/locomotive/steam/models/mapper.rb +2 -1
- data/lib/locomotive/steam/repositories.rb +1 -1
- data/lib/locomotive/steam/repositories/content_type_field_repository.rb +8 -0
- data/lib/locomotive/steam/repositories/theme_asset_repository.rb +1 -1
- data/lib/locomotive/steam/server.rb +0 -1
- data/lib/locomotive/steam/services.rb +7 -3
- data/lib/locomotive/steam/services/asset_host_service.rb +1 -3
- data/lib/locomotive/steam/services/image_resizer_service.rb +1 -3
- data/lib/locomotive/steam/services/liquid_parser_service.rb +1 -2
- data/lib/locomotive/steam/services/url_builder_service.rb +18 -1
- data/lib/locomotive/steam/version.rb +1 -1
- data/locomotivecms_steam.gemspec +9 -11
- data/spec/integration/repositories/theme_asset_repository_spec.rb +10 -0
- data/spec/support/helpers.rb +1 -0
- data/spec/support/liquid.rb +5 -0
- data/spec/unit/adapters/filesystem/simple_cache_store_spec.rb +27 -0
- data/spec/unit/adapters/filesystem/yaml_loaders/page_spec.rb +2 -0
- data/spec/unit/decorators/i18n_decorator_spec.rb +10 -0
- data/spec/unit/entities/content_entry_spec.rb +2 -2
- data/spec/unit/entities/content_type_field_spec.rb +15 -5
- data/spec/unit/entities/snippet_spec.rb +17 -0
- data/spec/unit/initializers/sprockets_spec.rb +25 -0
- data/spec/unit/liquid/drops/content_entry_collection_spec.rb +2 -0
- data/spec/unit/liquid/filters/html_spec.rb +28 -37
- data/spec/unit/liquid/tags/editable/control_spec.rb +4 -3
- data/spec/unit/liquid/tags/editable/file_spec.rb +7 -4
- data/spec/unit/liquid/tags/editable/text_spec.rb +4 -6
- data/spec/unit/liquid/tags/extends_spec.rb +3 -3
- data/spec/unit/liquid/tags/inherited_block_spec.rb +2 -2
- data/spec/unit/liquid/tags/nav_spec.rb +2 -2
- data/spec/unit/liquid/tags/snippet_spec.rb +3 -3
- data/spec/unit/middlewares/dynamic_assets_spec.rb +18 -9
- data/spec/unit/repositories/content_type_field_repository_spec.rb +51 -0
- data/spec/unit/services/url_builder_service_spec.rb +20 -3
- metadata +39 -56
- data/lib/locomotive/steam/core_ext.rb +0 -6
- data/lib/locomotive/steam/core_ext/array.rb +0 -3
- data/lib/locomotive/steam/core_ext/boolean/false.rb +0 -3
- data/lib/locomotive/steam/core_ext/boolean/true.rb +0 -3
- data/lib/locomotive/steam/core_ext/hash.rb +0 -39
- data/lib/locomotive/steam/core_ext/kernel.rb +0 -14
- data/lib/locomotive/steam/core_ext/string.rb +0 -37
- data/spec/fixtures/default/app/views/pages/songs.liquid +0 -6
- data/spec/unit/core_ext/string_spec.rb +0 -44
@@ -1,39 +0,0 @@
|
|
1
|
-
# Big thanks to Tim Ruffles (https://github.com/timruffles)
|
2
|
-
# https://gist.github.com/timruffles/2780508
|
3
|
-
module HashConverter
|
4
|
-
class << self
|
5
|
-
|
6
|
-
def to_underscore(hash)
|
7
|
-
convert(hash, :underscore)
|
8
|
-
end
|
9
|
-
|
10
|
-
def to_string(hash)
|
11
|
-
convert(hash, :to_s)
|
12
|
-
end
|
13
|
-
|
14
|
-
def to_sym(hash)
|
15
|
-
convert(hash, :to_sym)
|
16
|
-
end
|
17
|
-
|
18
|
-
# FIXME: not sure it will be ever needed
|
19
|
-
# def to_camel_case hash
|
20
|
-
# convert hash, :camelize, :lower
|
21
|
-
# end
|
22
|
-
|
23
|
-
def convert(obj, *method)
|
24
|
-
case obj
|
25
|
-
when Hash
|
26
|
-
obj.inject({}) do |h, (k,v)|
|
27
|
-
v = convert(v, *method)
|
28
|
-
h[k.send(*method)] = v
|
29
|
-
h
|
30
|
-
end
|
31
|
-
when Array
|
32
|
-
obj.map { |m| convert(m, *method) }
|
33
|
-
else
|
34
|
-
obj
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module Kernel
|
2
|
-
|
3
|
-
def require_relative_all(paths, sub = nil)
|
4
|
-
main_path = File.dirname(caller.first.sub(/:\d+$/, ''))
|
5
|
-
main_path = File.join(main_path, sub) if sub
|
6
|
-
|
7
|
-
[*paths].each do |path|
|
8
|
-
Dir[File.join(main_path, path, '*.rb')].each { |file| require file }
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
end
|
13
|
-
|
14
|
-
|
@@ -1,37 +0,0 @@
|
|
1
|
-
unless String.public_instance_methods.include?(:to_bool)
|
2
|
-
class String
|
3
|
-
|
4
|
-
def to_bool
|
5
|
-
return true if self == true || self =~ (/(true|t|yes|y|1)$/i)
|
6
|
-
return false if self == false || self.blank? || self =~ (/(false|f|no|n|0)$/i)
|
7
|
-
|
8
|
-
raise ArgumentError.new("invalid value for Boolean: \"#{self}\"")
|
9
|
-
end
|
10
|
-
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
unless String.public_instance_methods.include?(:permalink)
|
15
|
-
require 'stringex'
|
16
|
-
|
17
|
-
class String
|
18
|
-
|
19
|
-
def permalink(underscore = false)
|
20
|
-
# if the slug includes one "_" at least, we consider that the "_" is used instead of "-".
|
21
|
-
_permalink = if !self.index('_').nil?
|
22
|
-
self.to_url(replace_whitespace_with: '_')
|
23
|
-
else
|
24
|
-
self.to_url
|
25
|
-
end
|
26
|
-
|
27
|
-
underscore ? _permalink.underscore : _permalink
|
28
|
-
end
|
29
|
-
|
30
|
-
def permalink!(underscore = false)
|
31
|
-
replace(self.permalink(underscore))
|
32
|
-
end
|
33
|
-
|
34
|
-
alias :parameterize! :permalink!
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe String do
|
4
|
-
|
5
|
-
describe '#permalink!' do
|
6
|
-
|
7
|
-
let(:string) { 'foo bar' }
|
8
|
-
|
9
|
-
before { string.permalink! }
|
10
|
-
|
11
|
-
it { expect(string).to eq 'foo-bar' }
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
describe '#to_bool' do
|
16
|
-
|
17
|
-
subject { string.to_bool }
|
18
|
-
|
19
|
-
describe 'true values' do
|
20
|
-
|
21
|
-
%w(true t yes y 1).each do |val|
|
22
|
-
let(:string) { val }
|
23
|
-
it { is_expected.to eq true }
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
describe 'false values' do
|
29
|
-
|
30
|
-
(%w(false f no n 0) + ['']).each do |val|
|
31
|
-
let(:string) { val }
|
32
|
-
it { is_expected.to eq false }
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
describe 'no truthy or falsy' do
|
38
|
-
let(:string) { 'foo' }
|
39
|
-
it { expect { subject }.to raise_error(%(invalid value for Boolean: "foo")) }
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|