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.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Gemfile.lock +49 -34
  4. data/bin/steam.rb +1 -1
  5. data/lib/locomotive/steam.rb +8 -6
  6. data/lib/locomotive/steam/adapters/filesystem/simple_cache_store.rb +4 -0
  7. data/lib/locomotive/steam/adapters/filesystem/yaml_loaders/content_type.rb +1 -1
  8. data/lib/locomotive/steam/adapters/filesystem/yaml_loaders/page.rb +32 -10
  9. data/lib/locomotive/steam/adapters/filesystem/yaml_loaders/theme_asset.rb +31 -1
  10. data/lib/locomotive/steam/decorators/i18n_decorator.rb +1 -1
  11. data/lib/locomotive/steam/decorators/template_decorator.rb +1 -0
  12. data/lib/locomotive/steam/entities/content_entry.rb +9 -1
  13. data/lib/locomotive/steam/entities/content_type_field.rb +4 -0
  14. data/lib/locomotive/steam/entities/theme_asset.rb +8 -0
  15. data/lib/locomotive/steam/initializers/sprockets.rb +49 -0
  16. data/lib/locomotive/steam/liquid/filters/base.rb +5 -6
  17. data/lib/locomotive/steam/liquid/tags/editable/base.rb +4 -5
  18. data/lib/locomotive/steam/liquid/tags/extends.rb +1 -36
  19. data/lib/locomotive/steam/liquid/tags/inherited_block.rb +10 -4
  20. data/lib/locomotive/steam/liquid/tags/snippet.rb +8 -9
  21. data/lib/locomotive/steam/middlewares/dynamic_assets.rb +6 -36
  22. data/lib/locomotive/steam/middlewares/helpers.rb +9 -2
  23. data/lib/locomotive/steam/middlewares/site.rb +10 -2
  24. data/lib/locomotive/steam/models/associations/embedded.rb +1 -1
  25. data/lib/locomotive/steam/models/mapper.rb +2 -1
  26. data/lib/locomotive/steam/repositories.rb +1 -1
  27. data/lib/locomotive/steam/repositories/content_type_field_repository.rb +8 -0
  28. data/lib/locomotive/steam/repositories/theme_asset_repository.rb +1 -1
  29. data/lib/locomotive/steam/server.rb +0 -1
  30. data/lib/locomotive/steam/services.rb +7 -3
  31. data/lib/locomotive/steam/services/asset_host_service.rb +1 -3
  32. data/lib/locomotive/steam/services/image_resizer_service.rb +1 -3
  33. data/lib/locomotive/steam/services/liquid_parser_service.rb +1 -2
  34. data/lib/locomotive/steam/services/url_builder_service.rb +18 -1
  35. data/lib/locomotive/steam/version.rb +1 -1
  36. data/locomotivecms_steam.gemspec +9 -11
  37. data/spec/integration/repositories/theme_asset_repository_spec.rb +10 -0
  38. data/spec/support/helpers.rb +1 -0
  39. data/spec/support/liquid.rb +5 -0
  40. data/spec/unit/adapters/filesystem/simple_cache_store_spec.rb +27 -0
  41. data/spec/unit/adapters/filesystem/yaml_loaders/page_spec.rb +2 -0
  42. data/spec/unit/decorators/i18n_decorator_spec.rb +10 -0
  43. data/spec/unit/entities/content_entry_spec.rb +2 -2
  44. data/spec/unit/entities/content_type_field_spec.rb +15 -5
  45. data/spec/unit/entities/snippet_spec.rb +17 -0
  46. data/spec/unit/initializers/sprockets_spec.rb +25 -0
  47. data/spec/unit/liquid/drops/content_entry_collection_spec.rb +2 -0
  48. data/spec/unit/liquid/filters/html_spec.rb +28 -37
  49. data/spec/unit/liquid/tags/editable/control_spec.rb +4 -3
  50. data/spec/unit/liquid/tags/editable/file_spec.rb +7 -4
  51. data/spec/unit/liquid/tags/editable/text_spec.rb +4 -6
  52. data/spec/unit/liquid/tags/extends_spec.rb +3 -3
  53. data/spec/unit/liquid/tags/inherited_block_spec.rb +2 -2
  54. data/spec/unit/liquid/tags/nav_spec.rb +2 -2
  55. data/spec/unit/liquid/tags/snippet_spec.rb +3 -3
  56. data/spec/unit/middlewares/dynamic_assets_spec.rb +18 -9
  57. data/spec/unit/repositories/content_type_field_repository_spec.rb +51 -0
  58. data/spec/unit/services/url_builder_service_spec.rb +20 -3
  59. metadata +39 -56
  60. data/lib/locomotive/steam/core_ext.rb +0 -6
  61. data/lib/locomotive/steam/core_ext/array.rb +0 -3
  62. data/lib/locomotive/steam/core_ext/boolean/false.rb +0 -3
  63. data/lib/locomotive/steam/core_ext/boolean/true.rb +0 -3
  64. data/lib/locomotive/steam/core_ext/hash.rb +0 -39
  65. data/lib/locomotive/steam/core_ext/kernel.rb +0 -14
  66. data/lib/locomotive/steam/core_ext/string.rb +0 -37
  67. data/spec/fixtures/default/app/views/pages/songs.liquid +0 -6
  68. data/spec/unit/core_ext/string_spec.rb +0 -44
@@ -1,6 +0,0 @@
1
- require_relative 'core_ext/hash'
2
- require_relative 'core_ext/string'
3
- require_relative 'core_ext/array'
4
- require_relative 'core_ext/boolean/true'
5
- require_relative 'core_ext/boolean/false'
6
- require_relative 'core_ext/kernel'
@@ -1,3 +0,0 @@
1
- class Array
2
- def contains?(other) (self & other) == other ; end
3
- end
@@ -1,3 +0,0 @@
1
- class FalseClass
2
- def to_bool() self ; end
3
- end
@@ -1,3 +0,0 @@
1
- class TrueClass
2
- def to_bool() self ; end
3
- end
@@ -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,6 +0,0 @@
1
- ---
2
- title: Songs
3
- listed: false
4
- published: false
5
- position: 14
6
- ---
@@ -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