locomotivecms_steam 1.0.0.pre.beta.3 → 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/Gemfile +1 -1
  4. data/Gemfile.lock +16 -11
  5. data/Rakefile +14 -2
  6. data/lib/locomotive/steam/adapters/filesystem/yaml_loader.rb +13 -3
  7. data/lib/locomotive/steam/adapters/filesystem/yaml_loaders/content_type.rb +10 -5
  8. data/lib/locomotive/steam/adapters/filesystem/yaml_loaders/page.rb +9 -0
  9. data/lib/locomotive/steam/adapters/filesystem.rb +3 -1
  10. data/lib/locomotive/steam/adapters/memory.rb +6 -1
  11. data/lib/locomotive/steam/adapters/mongodb.rb +3 -1
  12. data/lib/locomotive/steam/decorators/i18n_decorator.rb +16 -0
  13. data/lib/locomotive/steam/entities/content_entry.rb +23 -2
  14. data/lib/locomotive/steam/entities/content_type.rb +9 -0
  15. data/lib/locomotive/steam/entities/content_type_field.rb +9 -0
  16. data/lib/locomotive/steam/entities/editable_element.rb +6 -2
  17. data/lib/locomotive/steam/entities/page.rb +4 -0
  18. data/lib/locomotive/steam/entities/site.rb +11 -3
  19. data/lib/locomotive/steam/liquid/drops/base.rb +4 -0
  20. data/lib/locomotive/steam/liquid/drops/content_entry.rb +23 -0
  21. data/lib/locomotive/steam/liquid/drops/content_entry_collection.rb +7 -1
  22. data/lib/locomotive/steam/liquid/drops/content_types.rb +6 -10
  23. data/lib/locomotive/steam/liquid/filters/json.rb +21 -14
  24. data/lib/locomotive/steam/liquid/tags/editable/base.rb +14 -2
  25. data/lib/locomotive/steam/liquid/tags/editable/text.rb +15 -1
  26. data/lib/locomotive/steam/liquid/tags/google_analytics.rb +8 -12
  27. data/lib/locomotive/steam/middlewares/default_env.rb +3 -1
  28. data/lib/locomotive/steam/middlewares/entry_submission.rb +1 -1
  29. data/lib/locomotive/steam/middlewares/favicon.rb +3 -1
  30. data/lib/locomotive/steam/middlewares/helpers.rb +2 -2
  31. data/lib/locomotive/steam/middlewares/logging.rb +3 -1
  32. data/lib/locomotive/steam/middlewares/page.rb +2 -0
  33. data/lib/locomotive/steam/middlewares/path.rb +4 -2
  34. data/lib/locomotive/steam/middlewares/renderer.rb +1 -1
  35. data/lib/locomotive/steam/middlewares/robots.rb +3 -1
  36. data/lib/locomotive/steam/middlewares/sitemap.rb +1 -1
  37. data/lib/locomotive/steam/middlewares/{threadsafe.rb → thread_safe.rb} +2 -1
  38. data/lib/locomotive/steam/middlewares.rb +1 -1
  39. data/lib/locomotive/steam/models/concerns/to_json.rb +31 -0
  40. data/lib/locomotive/steam/models/entity.rb +1 -0
  41. data/lib/locomotive/steam/models/i18n_field.rb +11 -0
  42. data/lib/locomotive/steam/models.rb +1 -0
  43. data/lib/locomotive/steam/repositories.rb +3 -1
  44. data/lib/locomotive/steam/server.rb +1 -1
  45. data/lib/locomotive/steam/services/asset_host_service.rb +3 -1
  46. data/lib/locomotive/steam/services/csrf_protection_service.rb +3 -1
  47. data/lib/locomotive/steam/services/editable_element_service.rb +3 -1
  48. data/lib/locomotive/steam/services/entry_submission_service.rb +4 -2
  49. data/lib/locomotive/steam/services/image_resizer_service.rb +3 -1
  50. data/lib/locomotive/steam/services/liquid_parser_service.rb +3 -1
  51. data/lib/locomotive/steam/services/page_finder_service.rb +3 -1
  52. data/lib/locomotive/steam/services/site_finder_service.rb +3 -1
  53. data/lib/locomotive/steam/services/snippet_finder_service.rb +3 -1
  54. data/lib/locomotive/steam/services/theme_asset_url_service.rb +3 -1
  55. data/lib/locomotive/steam/services/translator_service.rb +3 -1
  56. data/lib/locomotive/steam/services/url_builder_service.rb +3 -1
  57. data/lib/locomotive/steam/services.rb +4 -2
  58. data/lib/locomotive/steam/version.rb +1 -1
  59. data/locomotivecms_steam.gemspec +3 -3
  60. data/spec/fixtures/default/README +11 -0
  61. data/spec/fixtures/default/app/views/pages/layouts/simple.liquid +14 -0
  62. data/spec/fixtures/default/config/deploy.yml +4 -3
  63. data/spec/fixtures/default/config/site.yml +1 -1
  64. data/spec/fixtures/mongodb/locomotive_accounts.bson +0 -0
  65. data/spec/fixtures/mongodb/locomotive_accounts.metadata.json +1 -1
  66. data/spec/fixtures/mongodb/locomotive_activities.bson +0 -0
  67. data/spec/fixtures/mongodb/locomotive_activities.metadata.json +1 -0
  68. data/spec/fixtures/mongodb/locomotive_content_assets.bson +0 -0
  69. data/spec/fixtures/mongodb/locomotive_content_assets.metadata.json +1 -1
  70. data/spec/fixtures/mongodb/locomotive_content_entries.bson +0 -0
  71. data/spec/fixtures/mongodb/locomotive_content_entries.metadata.json +1 -1
  72. data/spec/fixtures/mongodb/locomotive_content_types.bson +0 -0
  73. data/spec/fixtures/mongodb/locomotive_content_types.metadata.json +1 -1
  74. data/spec/fixtures/mongodb/locomotive_pages.bson +0 -0
  75. data/spec/fixtures/mongodb/locomotive_pages.metadata.json +1 -1
  76. data/spec/fixtures/mongodb/locomotive_sites.bson +0 -0
  77. data/spec/fixtures/mongodb/locomotive_sites.metadata.json +1 -1
  78. data/spec/fixtures/mongodb/locomotive_snippets.bson +0 -0
  79. data/spec/fixtures/mongodb/locomotive_snippets.metadata.json +1 -1
  80. data/spec/fixtures/mongodb/locomotive_theme_assets.bson +0 -0
  81. data/spec/fixtures/mongodb/locomotive_theme_assets.metadata.json +1 -1
  82. data/spec/fixtures/mongodb/locomotive_translations.bson +0 -0
  83. data/spec/fixtures/mongodb/locomotive_translations.metadata.json +1 -1
  84. data/spec/fixtures/mongodb/system.indexes.bson +0 -0
  85. data/spec/integration/liquid/tags/paginate_spec.rb +1 -1
  86. data/spec/integration/repositories/content_entry_repository_spec.rb +2 -2
  87. data/spec/integration/repositories/content_type_repository_spec.rb +1 -1
  88. data/spec/integration/repositories/page_repository_spec.rb +3 -3
  89. data/spec/integration/repositories/site_repository_spec.rb +3 -3
  90. data/spec/integration/repositories/snippet_repository_spec.rb +1 -1
  91. data/spec/integration/repositories/theme_asset_repository_spec.rb +3 -3
  92. data/spec/integration/repositories/translation_repository_spec.rb +1 -1
  93. data/spec/integration/server/contact_form_spec.rb +1 -1
  94. data/spec/integration/server/sitemap_spec.rb +17 -1
  95. data/spec/support/helpers.rb +4 -0
  96. data/spec/support/liquid.rb +5 -1
  97. data/spec/unit/adapters/filesystem/yaml_loaders/content_type_spec.rb +1 -0
  98. data/spec/unit/adapters/filesystem/yaml_loaders/page_spec.rb +7 -4
  99. data/spec/unit/adapters/filesystem/yaml_loaders/site_spec.rb +1 -1
  100. data/spec/unit/decorators/i18n_decorator_spec.rb +9 -0
  101. data/spec/unit/entities/content_entry_spec.rb +29 -0
  102. data/spec/unit/entities/content_type_field_spec.rb +41 -0
  103. data/spec/unit/entities/content_type_spec.rb +10 -0
  104. data/spec/unit/entities/page_spec.rb +24 -0
  105. data/spec/unit/entities/site_spec.rb +44 -6
  106. data/spec/unit/liquid/drops/content_entry_spec.rb +16 -0
  107. data/spec/unit/liquid/filters/json_spec.rb +26 -3
  108. data/spec/unit/liquid/tags/editable/control_spec.rb +1 -1
  109. data/spec/unit/liquid/tags/editable/file_spec.rb +1 -1
  110. data/spec/unit/liquid/tags/editable/model_spec.rb +1 -1
  111. data/spec/unit/liquid/tags/editable/text_spec.rb +32 -6
  112. data/spec/unit/liquid/tags/extends_spec.rb +1 -1
  113. data/spec/unit/liquid/tags/google_analytics_spec.rb +2 -1
  114. data/spec/unit/liquid/tags/inherited_block_spec.rb +1 -1
  115. data/spec/unit/middlewares/locale_redirection_spec.rb +1 -1
  116. data/spec/unit/middlewares/renderer_spec.rb +1 -1
  117. data/spec/unit/middlewares/site_spec.rb +1 -1
  118. data/spec/unit/models/concerns/to_json_spec.rb +81 -0
  119. data/spec/unit/services/asset_host_service_spec.rb +15 -0
  120. data/spec/unit/services/entry_submission_service_spec.rb +9 -1
  121. data/spec/unit/services/translator_service_spec.rb +1 -1
  122. metadata +18 -13
  123. data/spec/fixtures/mongodb/sessions.bson +0 -0
  124. data/spec/fixtures/mongodb/sessions.metadata.json +0 -1
@@ -9,11 +9,21 @@ module Locomotive
9
9
 
10
10
  def render_element(context, element)
11
11
  with_inline_editing(context, element) do
12
- if element.default_content?
12
+ content = if element.default_content?
13
13
  render_default_content
14
14
  else
15
15
  element.content
16
16
  end
17
+
18
+ format_content(content, element.format, context)
19
+ end
20
+ end
21
+
22
+ def format_content(content, format, context)
23
+ case format
24
+ when 'markdown' then markdown_service(context).to_html(content)
25
+ else
26
+ content
17
27
  end
18
28
  end
19
29
 
@@ -43,6 +53,10 @@ module Locomotive
43
53
  ['locomotive-editable-text', block_name, @slug].compact.join('-')
44
54
  end
45
55
 
56
+ def markdown_service(context)
57
+ context.registers[:services].markdown
58
+ end
59
+
46
60
  end
47
61
 
48
62
  ::Liquid::Template.register_tag('editable_text'.freeze, Text)
@@ -19,18 +19,14 @@ module Locomotive
19
19
  def ga_snippet(account_id)
20
20
  %{
21
21
  <script type="text/javascript">
22
-
23
- var _gaq = _gaq || [];
24
- _gaq.push(['_setAccount', '#{account_id}']);
25
- _gaq.push(['_trackPageview']);
26
-
27
- (function() \{
28
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
29
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
30
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
31
- \})();
32
-
33
- </script>}
22
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
23
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
24
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
25
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
26
+ ga('create', '#{account_id}', 'auto');
27
+ ga('send', 'pageview');
28
+ </script>
29
+ }
34
30
  end
35
31
 
36
32
  end
@@ -1,7 +1,9 @@
1
1
  module Locomotive::Steam
2
2
  module Middlewares
3
3
 
4
- class DefaultEnv < Struct.new(:app)
4
+ class DefaultEnv
5
+
6
+ attr_accessor_initialize :app
5
7
 
6
8
  def call(env)
7
9
  request = Rack::Request.new(env)
@@ -123,7 +123,7 @@ module Locomotive::Steam
123
123
  if entry = services.entry_submission.submit(slug, entry_attributes)
124
124
  entry
125
125
  else
126
- raise %{Unknown content type "#{slug}"}
126
+ raise %{Unknown content type "#{slug}" or public_submission_enabled property not true}
127
127
  end
128
128
  end
129
129
 
@@ -1,7 +1,9 @@
1
1
  module Locomotive::Steam
2
2
  module Middlewares
3
3
 
4
- class Favicon < Struct.new(:app)
4
+ class Favicon
5
+
6
+ attr_accessor_initialize :app
5
7
 
6
8
  include Helpers
7
9
 
@@ -13,8 +13,8 @@ module Locomotive::Steam
13
13
  self.request.content_type == 'application/json' || File.extname(self.request.path) == '.json'
14
14
  end
15
15
 
16
- def render_response(content, code = 200, type = 'text/html')
17
- @next_response = [code, { 'Content-Type' => type }, [content]]
16
+ def render_response(content, code = 200, type = nil)
17
+ @next_response = [code, { 'Content-Type' => type || 'text/html' }, [content]]
18
18
  end
19
19
 
20
20
  def redirect_to(location, type = 301)
@@ -3,10 +3,12 @@ module Locomotive::Steam
3
3
 
4
4
  # Track the request into the current logger
5
5
  #
6
- class Logging < Struct.new(:app)
6
+ class Logging
7
7
 
8
8
  include Helpers
9
9
 
10
+ attr_accessor_initialize :app
11
+
10
12
  def call(env)
11
13
  now = Time.now
12
14
 
@@ -9,6 +9,8 @@ module Locomotive::Steam
9
9
  include Helpers
10
10
 
11
11
  def _call
12
+ return env['steam.page'] if env['steam.page']
13
+
12
14
  if page = fetch_page
13
15
  if !page.not_found?
14
16
  log "Found page \"#{page.title}\" [#{page.fullpath}]"
@@ -4,7 +4,9 @@ module Locomotive::Steam
4
4
  # Sanitize the path from the previous middleware in order
5
5
  # to make it work for the renderer.
6
6
  #
7
- class Path < Struct.new(:app)
7
+ class Path
8
+
9
+ attr_accessor_initialize :app
8
10
 
9
11
  def call(env)
10
12
  set_path!(env)
@@ -14,7 +16,7 @@ module Locomotive::Steam
14
16
  protected
15
17
 
16
18
  def set_path!(env)
17
- path = env['steam.path'] || request.path_info
19
+ path = (env['steam.path'] || request.path_info).dup
18
20
 
19
21
  path.gsub!(/\.[a-zA-Z][a-zA-Z0-9]{2,}$/, '')
20
22
  path.gsub!(/^\//, '')
@@ -20,7 +20,7 @@ module Locomotive::Steam
20
20
  redirect_to(page.redirect_url, page.redirect_type)
21
21
  else
22
22
  content = parse_and_render_liquid
23
- render_response(content, page.not_found? ? 404: 200)
23
+ render_response(content, page.not_found? ? 404: 200, page.response_type)
24
24
  end
25
25
  end
26
26
 
@@ -1,10 +1,12 @@
1
1
  module Locomotive::Steam
2
2
  module Middlewares
3
3
 
4
- class Robots < Struct.new(:app, :options)
4
+ class Robots
5
5
 
6
6
  include Helpers
7
7
 
8
+ attr_accessor_initialize :app
9
+
8
10
  def call(env)
9
11
  if env['PATH_INFO'] == '/robots.txt'
10
12
  site = env['steam.site']
@@ -6,7 +6,7 @@ module Locomotive::Steam
6
6
  include Helpers
7
7
 
8
8
  def _call
9
- if env['PATH_INFO'] == '/sitemap.xml'
9
+ if env['PATH_INFO'] == '/sitemap.xml' && (page.nil? || page.not_found?)
10
10
  render_response(build_xml, 200, 'text/plain')
11
11
  end
12
12
  end
@@ -1,7 +1,8 @@
1
1
  module Locomotive::Steam::Middlewares
2
2
 
3
- class ThreadSafe < Struct.new(:app)
3
+ class ThreadSafe
4
4
 
5
+ attr_accessor_initialize :app
5
6
  attr_accessor :env
6
7
 
7
8
  def call(env)
@@ -1,4 +1,4 @@
1
- require_relative 'middlewares/threadsafe'
1
+ require_relative 'middlewares/thread_safe'
2
2
  require_relative 'middlewares/helpers'
3
3
 
4
4
  require_relative_all 'middlewares'
@@ -0,0 +1,31 @@
1
+ module Locomotive
2
+ module Steam
3
+ module Models
4
+ module Concerns
5
+
6
+ module ToJson
7
+
8
+ def to_hash
9
+ {}.tap do |_attributes|
10
+ attributes.each do |key, value|
11
+ next if value && value.respond_to?(:repository) # skip associations
12
+
13
+ _attributes[key.to_s] = value
14
+ end
15
+ end
16
+ end
17
+
18
+ def as_json(options = nil)
19
+ to_hash.as_json(options)
20
+ end
21
+
22
+ def to_json
23
+ as_json.to_json
24
+ end
25
+
26
+ end
27
+
28
+ end
29
+ end
30
+ end
31
+ end
@@ -4,6 +4,7 @@ module Locomotive::Steam
4
4
  module Entity
5
5
 
6
6
  include Locomotive::Steam::Models::Concerns::Validation
7
+ include Locomotive::Steam::Models::Concerns::ToJson
7
8
 
8
9
  attr_accessor :attributes, :associations, :localized_attributes, :base_url
9
10
 
@@ -14,6 +14,11 @@ module Locomotive::Steam
14
14
  self.translations = translations
15
15
  end
16
16
 
17
+ def initialize_copy(field)
18
+ super
19
+ self.translations = field.translations.dup
20
+ end
21
+
17
22
  def [](locale)
18
23
  @translations[locale]
19
24
  end
@@ -36,10 +41,16 @@ module Locomotive::Steam
36
41
 
37
42
  alias :__translations__ :translations
38
43
 
44
+ alias :to_hash :translations
45
+
39
46
  def serialize(attributes)
40
47
  attributes[@name] = @translations
41
48
  end
42
49
 
50
+ def to_json
51
+ to_hash.to_json
52
+ end
53
+
43
54
  end
44
55
 
45
56
  end
@@ -1,4 +1,5 @@
1
1
  require_relative 'models/concerns/validation'
2
+ require_relative 'models/concerns/to_json'
2
3
  require_relative 'models/i18n_field'
3
4
  require_relative 'models/associations/embedded'
4
5
  require_relative 'models/associations/referenced'
@@ -3,10 +3,12 @@ require_relative_all 'repositories'
3
3
  module Locomotive
4
4
  module Steam
5
5
 
6
- class Repositories < Struct.new(:current_site, :locale, :configuration)
6
+ class Repositories
7
7
 
8
8
  include Morphine
9
9
 
10
+ attr_accessor_initialize :current_site, :locale, :configuration
11
+
10
12
  register :adapter do
11
13
  build_adapter(configuration.adapter)
12
14
  end
@@ -56,12 +56,12 @@ module Locomotive::Steam
56
56
  Middlewares::Logging,
57
57
  Middlewares::Robots,
58
58
  Middlewares::Timezone,
59
- Middlewares::Sitemap,
60
59
  Middlewares::EntrySubmission,
61
60
  Middlewares::Locale,
62
61
  Middlewares::LocaleRedirection,
63
62
  Middlewares::Path,
64
63
  Middlewares::Page,
64
+ Middlewares::Sitemap,
65
65
  Middlewares::TemplatizedPage
66
66
  ]
67
67
  end
@@ -14,6 +14,8 @@ module Locomotive
14
14
  def compute(source, timestamp = nil)
15
15
  return source if source.nil?
16
16
 
17
+ timestamp ||= (site.try(:template_version) || site.try(:updated_at)).to_i
18
+
17
19
  return add_timestamp_suffix(source, timestamp) if source =~ Steam::IsHTTP
18
20
 
19
21
  url = self.host ? URI.join(host, source).to_s : source
@@ -28,7 +30,7 @@ module Locomotive
28
30
  if host.respond_to?(:call)
29
31
  host.call(request, site)
30
32
  else
31
- host
33
+ host =~ Steam::IsHTTP ? host : "https://#{host}"
32
34
  end
33
35
  else
34
36
  nil
@@ -1,7 +1,9 @@
1
1
  module Locomotive
2
2
  module Steam
3
3
 
4
- class CsrfProtectionService < Struct.new(:enabled, :field, :token)
4
+ class CsrfProtectionService
5
+
6
+ attr_accessor_initialize :enabled, :field, :token
5
7
 
6
8
  def enabled?
7
9
  !!enabled
@@ -1,10 +1,12 @@
1
1
  module Locomotive
2
2
  module Steam
3
3
 
4
- class EditableElementService < Struct.new(:repository, :locale)
4
+ class EditableElementService
5
5
 
6
6
  include Locomotive::Steam::Services::Concerns::Decorator
7
7
 
8
+ attr_accessor_initialize :repository, :locale
9
+
8
10
  def find(page, block, slug)
9
11
  decorate(Decorators::I18nDecorator) do
10
12
  repository.editable_element_for(page, block, slug).tap do |element|
@@ -3,14 +3,16 @@ require 'sanitize'
3
3
  module Locomotive
4
4
  module Steam
5
5
 
6
- class EntrySubmissionService < Struct.new(:content_type_repository, :repository, :locale)
6
+ class EntrySubmissionService
7
7
 
8
8
  include Locomotive::Steam::Services::Concerns::Decorator
9
9
 
10
+ attr_accessor_initialize :content_type_repository, :repository, :locale
11
+
10
12
  def submit(slug, attributes = {})
11
13
  type = get_type(slug)
12
14
 
13
- return nil if type.nil?
15
+ return nil if type.nil? || type.public_submission_enabled == false
14
16
 
15
17
  clean_attributes(attributes)
16
18
 
@@ -1,7 +1,9 @@
1
1
  module Locomotive
2
2
  module Steam
3
3
 
4
- class ImageResizerService < Struct.new(:resizer, :asset_path)
4
+ class ImageResizerService
5
+
6
+ attr_accessor_initialize :resizer, :asset_path
5
7
 
6
8
  def resize(source, geometry)
7
9
  return nil if disabled? || geometry.blank?
@@ -1,7 +1,9 @@
1
1
  module Locomotive
2
2
  module Steam
3
3
 
4
- class LiquidParserService < Struct.new(:parent_finder, :snippet_finder)
4
+ class LiquidParserService
5
+
6
+ attr_accessor_initialize :parent_finder, :snippet_finder
5
7
 
6
8
  def parse(page)
7
9
  _parse(page,
@@ -1,10 +1,12 @@
1
1
  module Locomotive
2
2
  module Steam
3
3
 
4
- class PageFinderService < Struct.new(:repository)
4
+ class PageFinderService
5
5
 
6
6
  include Locomotive::Steam::Services::Concerns::Decorator
7
7
 
8
+ attr_accessor_initialize :repository
9
+
8
10
  def find(path)
9
11
  decorate do
10
12
  repository.by_fullpath(path)
@@ -1,7 +1,9 @@
1
1
  module Locomotive
2
2
  module Steam
3
3
 
4
- class SiteFinderService < Struct.new(:repository, :request)
4
+ class SiteFinderService
5
+
6
+ attr_accessor_initialize :repository, :request
5
7
 
6
8
  def find
7
9
  repository.by_domain(request.host)
@@ -1,10 +1,12 @@
1
1
  module Locomotive
2
2
  module Steam
3
3
 
4
- class SnippetFinderService < Struct.new(:repository)
4
+ class SnippetFinderService
5
5
 
6
6
  include Locomotive::Steam::Services::Concerns::Decorator
7
7
 
8
+ attr_accessor_initialize :repository
9
+
8
10
  def find(slug)
9
11
  decorate do
10
12
  repository.by_slug(slug)
@@ -1,7 +1,9 @@
1
1
  module Locomotive
2
2
  module Steam
3
3
 
4
- class ThemeAssetUrlService < Struct.new(:repository, :asset_host, :checksum)
4
+ class ThemeAssetUrlService
5
+
6
+ attr_accessor_initialize :repository, :asset_host, :checksum
5
7
 
6
8
  def build(path)
7
9
  # keep the query string safe
@@ -1,7 +1,9 @@
1
1
  module Locomotive
2
2
  module Steam
3
3
 
4
- class TranslatorService < Struct.new(:repository, :current_locale)
4
+ class TranslatorService
5
+
6
+ attr_accessor_initialize :repository, :current_locale
5
7
 
6
8
  # Return the translation described by a key.
7
9
  #
@@ -1,7 +1,9 @@
1
1
  module Locomotive
2
2
  module Steam
3
3
 
4
- class UrlBuilderService < Struct.new(:site, :current_locale, :request)
4
+ class UrlBuilderService
5
+
6
+ attr_accessor_initialize :site, :current_locale, :request
5
7
 
6
8
  def url_for(page, locale = nil)
7
9
  prefix(_url_for(page, locale))
@@ -1,4 +1,4 @@
1
- require 'morphine'
1
+ require 'morphine'
2
2
 
3
3
  require_relative_all %w(concerns .), 'services'
4
4
 
@@ -28,10 +28,12 @@ module Locomotive
28
28
  end
29
29
  end
30
30
 
31
- class Instance < Struct.new(:request)
31
+ class Instance
32
32
 
33
33
  include Morphine
34
34
 
35
+ attr_accessor_initialize :request
36
+
35
37
  register :current_site do
36
38
  repositories.current_site = Defer.new { site_finder.find }
37
39
  end
@@ -3,6 +3,6 @@
3
3
  # 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0
4
4
  module Locomotive
5
5
  module Steam
6
- VERSION = '1.0.0-beta.3'
6
+ VERSION = '1.0.0.rc1'
7
7
  end
8
8
  end
@@ -23,12 +23,12 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_dependency 'sanitize', '~> 4.0.0'
25
25
  spec.add_dependency 'morphine', '~> 0.1.1'
26
- spec.add_dependency 'httparty', '~> 0.13.5'
26
+ spec.add_dependency 'httparty', '~> 0.13.6'
27
27
  spec.add_dependency 'chronic', '~> 0.10.2'
28
28
 
29
29
  spec.add_dependency 'rack-rewrite', '~> 1.5.1'
30
30
  spec.add_dependency 'rack-cache', '~> 1.2'
31
- spec.add_dependency 'dragonfly', '~> 1.0.10'
31
+ spec.add_dependency 'dragonfly', '~> 1.0.12'
32
32
  spec.add_dependency 'moneta', '~> 0.8.0'
33
33
  spec.add_dependency 'rack_csrf', '~> 2.5.0'
34
34
 
@@ -45,7 +45,7 @@ Gem::Specification.new do |spec|
45
45
  spec.add_dependency 'mime-types', '~> 2.6.1'
46
46
 
47
47
  spec.add_dependency 'locomotivecms-solid', '~> 4.0.0.alpha2'
48
- spec.add_dependency 'locomotivecms_common', '~> 0.0.4'
48
+ spec.add_dependency 'locomotivecms_common', '~> 0.0.5'
49
49
 
50
50
  spec.required_ruby_version = '>= 2.0'
51
51
  end
@@ -0,0 +1,11 @@
1
+ [LocomotiveCMS]
2
+
3
+ mongoid.yml: locomotive_engine_wagon_dev
4
+
5
+ > bundle exec rake development:bootstrap
6
+ > bundle exec rails c
7
+ # Locomotive::Site.first.destroy
8
+
9
+ [Steam]
10
+ wagon_dev deploy development -d -v spec/fixtures/default
11
+ bundle exec rake mongodb:test:seed
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: Simple layout
3
+ ---
4
+ <html>
5
+ <head>
6
+ <title>{{ page. title }}</title>
7
+ </head>
8
+ <body>
9
+ {% editable_text body %}
10
+ <h1>Hello world</h1>
11
+ <p>Lorem ipsum</p>
12
+ {% endeditable_text %}
13
+ </body>
14
+ </html>
@@ -1,7 +1,8 @@
1
1
  development:
2
- host: sample.lvh.me:3000
3
- email: john@doe.net
4
- api_key: a9ac1e08c2c22c1b6f3da6db77a70cac4a615bd7
2
+ host: localhost:3000
3
+ handle: sample
4
+ email: admin@locomotivecms.com
5
+ api_key: d49cd50f6f0d2b163f48fc73cb249f0244c37074
5
6
  staging:
6
7
  host: staging.example.com
7
8
  email: john@doe.net
@@ -1,4 +1,4 @@
1
- name: Sample website
1
+ name: Sample site
2
2
 
3
3
  subdomain: sample
4
4
 
@@ -1 +1 @@
1
- { "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "locomotive_engine_2_5_dev.locomotive_accounts" } ] }
1
+ { "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "locomotive_engine_wagon_dev.locomotive_accounts" } ] }
@@ -0,0 +1 @@
1
+ { "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "locomotive_engine_wagon_dev.locomotive_activities" } ] }
@@ -1 +1 @@
1
- { "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "locomotive_engine_2_5_dev.locomotive_content_assets" } ] }
1
+ { "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "locomotive_engine_wagon_dev.locomotive_content_assets" } ] }
@@ -1 +1 @@
1
- { "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "locomotive_engine_2_5_dev.locomotive_content_entries" } ] }
1
+ { "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "locomotive_engine_wagon_dev.locomotive_content_entries" } ] }
@@ -1 +1 @@
1
- { "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "locomotive_engine_2_5_dev.locomotive_content_types" } ] }
1
+ { "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "locomotive_engine_wagon_dev.locomotive_content_types" } ] }
@@ -1 +1 @@
1
- { "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "locomotive_engine_2_5_dev.locomotive_pages" } ] }
1
+ { "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "locomotive_engine_wagon_dev.locomotive_pages" } ] }
@@ -1 +1 @@
1
- { "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "locomotive_engine_2_5_dev.locomotive_sites" } ] }
1
+ { "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "locomotive_engine_wagon_dev.locomotive_sites" } ] }
@@ -1 +1 @@
1
- { "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "locomotive_engine_2_5_dev.locomotive_snippets" } ] }
1
+ { "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "locomotive_engine_wagon_dev.locomotive_snippets" } ] }