spontaneous 0.2.0.beta5 → 0.2.0.beta6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (227) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +39 -0
  4. data/Gemfile +2 -0
  5. data/Readme.markdown +4 -4
  6. data/application/css/core.css.scss +144 -43
  7. data/application/css/definitions.css.scss +50 -16
  8. data/application/css/dialogue.css.scss +5 -2
  9. data/application/css/editing.css.scss +7 -7
  10. data/application/css/font.css.scss +1 -1
  11. data/application/css/meta.css.scss +6 -6
  12. data/application/css/popover.css.scss +6 -6
  13. data/application/css/top.css.scss +8 -1
  14. data/application/js/add_alias_dialogue.js +137 -36
  15. data/application/js/add_home_dialogue.js +10 -10
  16. data/application/js/ajax.js +26 -26
  17. data/application/js/authentication.js +2 -2
  18. data/application/js/box.js +21 -10
  19. data/application/js/box_container.js +13 -7
  20. data/application/js/compatibility.js +19 -17
  21. data/application/js/conflicted_field_dialogue.js +5 -5
  22. data/application/js/content.js +22 -16
  23. data/application/js/content_area.js +62 -33
  24. data/application/js/dialogue.js +16 -16
  25. data/application/js/dom.js +9 -10
  26. data/application/js/edit_panel.js +25 -20
  27. data/application/js/editing.js +21 -8
  28. data/application/js/entry.js +1 -1
  29. data/application/js/extensions.js +11 -11
  30. data/application/js/field/boolean.js +6 -6
  31. data/application/js/field/date.js +1 -1
  32. data/application/js/field/file.js +17 -17
  33. data/application/js/field/image.js +27 -27
  34. data/application/js/field/markdown.js +72 -71
  35. data/application/js/field/select.js +9 -9
  36. data/application/js/field/string.js +3 -3
  37. data/application/js/field/webvideo.js +2 -2
  38. data/application/js/field_preview.js +3 -0
  39. data/application/js/init.js +3 -2
  40. data/application/js/jquery-selection-position.js +13 -13
  41. data/application/js/location.js +17 -12
  42. data/application/js/login.js +2 -2
  43. data/application/js/meta_view/user_admin.js +101 -101
  44. data/application/js/metadata.js +1 -1
  45. data/application/js/page.js +2 -2
  46. data/application/js/page_browser.js +13 -13
  47. data/application/js/page_entry.js +1 -1
  48. data/application/js/panel/root_menu.js +10 -10
  49. data/application/js/popover.js +6 -5
  50. data/application/js/popover_view.js +5 -5
  51. data/application/js/preview.js +10 -4
  52. data/application/js/progress.js +6 -6
  53. data/application/js/properties.js +35 -6
  54. data/application/js/publish.js +43 -43
  55. data/application/js/require.js +14 -14
  56. data/application/js/services.js +3 -3
  57. data/application/js/sharded_upload.js +9 -8
  58. data/application/js/side_bar.js +5 -5
  59. data/application/js/state.js +2 -2
  60. data/application/js/status_bar.js +6 -6
  61. data/application/js/top_bar.js +97 -65
  62. data/application/js/types.js +9 -6
  63. data/application/js/upload.js +4 -4
  64. data/application/js/upload_manager.js +21 -21
  65. data/application/js/user.js +1 -1
  66. data/application/js/vendor/jquery.velocity.min.js +7 -0
  67. data/application/js/views.js +32 -8
  68. data/application/js/views/box_view.js +51 -31
  69. data/application/js/views/page_piece_view.js +17 -15
  70. data/application/js/views/page_view.js +54 -43
  71. data/application/js/views/piece_view.js +44 -37
  72. data/application/static/font/fontawesome-webfont-4f0022f25672c7f501c339cbf98d9117.ttf +0 -0
  73. data/application/views/index.erb +1 -0
  74. data/db/migrations/20130114120000_create_revision_tables.rb +2 -1
  75. data/db/migrations/20130813111009_increase_path_length.rb +11 -2
  76. data/db/migrations/20140506171823_add_index_to_target_id.rb +11 -0
  77. data/db/migrations/20140514090204_add_content_hash.rb +59 -0
  78. data/db/migrations/20140519150253_add_content_hash_timestamp.rb +20 -0
  79. data/lib/spontaneous.rb +0 -1
  80. data/lib/spontaneous/asset/environment.rb +77 -15
  81. data/lib/spontaneous/box.rb +21 -0
  82. data/lib/spontaneous/capistrano/deploy.rb +1 -1
  83. data/lib/spontaneous/capistrano/sync.rb +8 -7
  84. data/lib/spontaneous/change.rb +4 -2
  85. data/lib/spontaneous/cli/fields.rb +7 -3
  86. data/lib/spontaneous/cli/generate.rb +2 -0
  87. data/lib/spontaneous/cli/init.rb +24 -93
  88. data/lib/spontaneous/cli/init/db.rb +94 -0
  89. data/lib/spontaneous/cli/init/mysql.rb +17 -0
  90. data/lib/spontaneous/cli/init/postgresql.rb +33 -0
  91. data/lib/spontaneous/cli/init/sqlite.rb +14 -0
  92. data/lib/spontaneous/cli/site.rb +45 -20
  93. data/lib/spontaneous/collections/box_set.rb +3 -0
  94. data/lib/spontaneous/collections/entry_set.rb +43 -4
  95. data/lib/spontaneous/collections/field_set.rb +14 -2
  96. data/lib/spontaneous/data_mapper.rb +40 -7
  97. data/lib/spontaneous/data_mapper/content_model.rb +1 -1
  98. data/lib/spontaneous/data_mapper/content_model/associations.rb +63 -12
  99. data/lib/spontaneous/data_mapper/content_model/timestamps.rb +9 -14
  100. data/lib/spontaneous/data_mapper/content_table.rb +4 -2
  101. data/lib/spontaneous/data_mapper/dataset.rb +31 -2
  102. data/lib/spontaneous/data_mapper/scope.rb +37 -20
  103. data/lib/spontaneous/errors.rb +6 -0
  104. data/lib/spontaneous/facet.rb +20 -10
  105. data/lib/spontaneous/field/base.rb +8 -1
  106. data/lib/spontaneous/field/file.rb +28 -3
  107. data/lib/spontaneous/field/image.rb +2 -0
  108. data/lib/spontaneous/field/update.rb +6 -0
  109. data/lib/spontaneous/field/webvideo/vimeo.rb +6 -1
  110. data/lib/spontaneous/field/webvideo/vine.rb +1 -1
  111. data/lib/spontaneous/field/webvideo/youtube.rb +1 -1
  112. data/lib/spontaneous/generators/site.rb +6 -4
  113. data/lib/spontaneous/generators/site/.gitignore +1 -0
  114. data/lib/spontaneous/generators/site/Gemfile.tt +3 -3
  115. data/lib/spontaneous/generators/site/config/{indexes.rb.tt → initializers/indexes.rb.tt} +0 -0
  116. data/lib/spontaneous/generators/site/config/initializers/publishing.rb.tt +78 -0
  117. data/lib/spontaneous/generators/site/{config/database.yml.tt → db/mysql2.yml.tt} +7 -6
  118. data/lib/spontaneous/generators/site/db/postgres.yml.tt +25 -0
  119. data/lib/spontaneous/generators/site/db/sqlite3.yml.tt +18 -0
  120. data/lib/spontaneous/generators/site/public/humans.txt.tt +14 -0
  121. data/lib/spontaneous/generators/site/templates/layouts/standard.html.cut.tt +51 -0
  122. data/lib/spontaneous/loader.rb +1 -1
  123. data/lib/spontaneous/logger.rb +1 -1
  124. data/lib/spontaneous/media/image/optimizer.rb +1 -1
  125. data/lib/spontaneous/media/image/processor.rb +11 -2
  126. data/lib/spontaneous/media/image/renderable.rb +2 -0
  127. data/lib/spontaneous/model.rb +3 -0
  128. data/lib/spontaneous/model/box/allowed_types.rb +17 -4
  129. data/lib/spontaneous/model/core.rb +36 -3
  130. data/lib/spontaneous/model/core/aliases.rb +5 -2
  131. data/lib/spontaneous/model/core/boxes.rb +6 -0
  132. data/lib/spontaneous/model/core/cascading_change.rb +38 -0
  133. data/lib/spontaneous/model/core/content_hash.rb +171 -0
  134. data/lib/spontaneous/model/core/entries.rb +0 -19
  135. data/lib/spontaneous/model/core/fields.rb +11 -0
  136. data/lib/spontaneous/model/core/modifications.rb +22 -21
  137. data/lib/spontaneous/model/core/render.rb +3 -0
  138. data/lib/spontaneous/model/core/serialisation.rb +18 -17
  139. data/lib/spontaneous/model/page.rb +35 -8
  140. data/lib/spontaneous/model/page/page_tree.rb +20 -8
  141. data/lib/spontaneous/model/page/paths.rb +79 -50
  142. data/lib/spontaneous/model/page/singleton.rb +71 -0
  143. data/lib/spontaneous/model/page/site_map.rb +2 -1
  144. data/lib/spontaneous/model/page/site_timestamps.rb +2 -2
  145. data/lib/spontaneous/model/piece.rb +10 -0
  146. data/lib/spontaneous/output/context.rb +13 -6
  147. data/lib/spontaneous/output/format.rb +30 -5
  148. data/lib/spontaneous/output/helpers/script_helper.rb +8 -0
  149. data/lib/spontaneous/output/helpers/stylesheet_helper.rb +7 -0
  150. data/lib/spontaneous/output/renderable.rb +16 -0
  151. data/lib/spontaneous/output/store.rb +1 -1
  152. data/lib/spontaneous/output/template/renderer.rb +2 -2
  153. data/lib/spontaneous/page_piece.rb +25 -1
  154. data/lib/spontaneous/prototypes/box_prototype.rb +13 -0
  155. data/lib/spontaneous/prototypes/field_prototype.rb +7 -4
  156. data/lib/spontaneous/publishing.rb +10 -5
  157. data/lib/spontaneous/publishing/immediate.rb +32 -349
  158. data/lib/spontaneous/publishing/pipeline.rb +43 -0
  159. data/lib/spontaneous/publishing/progress.rb +186 -0
  160. data/lib/spontaneous/publishing/publish.rb +107 -0
  161. data/lib/spontaneous/publishing/rerender.rb +17 -0
  162. data/lib/spontaneous/publishing/revision.rb +53 -18
  163. data/lib/spontaneous/publishing/simultaneous.rb +1 -1
  164. data/lib/spontaneous/publishing/steps.rb +154 -0
  165. data/lib/spontaneous/publishing/steps/activate_revision.rb +45 -0
  166. data/lib/spontaneous/publishing/steps/archive_old_revisions.rb +22 -0
  167. data/lib/spontaneous/publishing/steps/base_step.rb +49 -0
  168. data/lib/spontaneous/publishing/steps/copy_static_files.rb +74 -0
  169. data/lib/spontaneous/publishing/steps/create_revision_directory.rb +24 -0
  170. data/lib/spontaneous/publishing/steps/generate_rackup_file.rb +51 -0
  171. data/lib/spontaneous/publishing/steps/generate_search_indexes.rb +24 -0
  172. data/lib/spontaneous/publishing/steps/render_revision.rb +69 -0
  173. data/lib/spontaneous/publishing/steps/write_revision_file.rb +43 -0
  174. data/lib/spontaneous/rack/back.rb +3 -1
  175. data/lib/spontaneous/rack/back/alias.rb +9 -8
  176. data/lib/spontaneous/rack/front.rb +1 -1
  177. data/lib/spontaneous/rack/middleware.rb +7 -4
  178. data/lib/spontaneous/rack/middleware/transaction.rb +14 -0
  179. data/lib/spontaneous/rack/page_controller.rb +23 -8
  180. data/lib/spontaneous/revision.rb +5 -10
  181. data/lib/spontaneous/schema.rb +5 -0
  182. data/lib/spontaneous/server.rb +3 -1
  183. data/lib/spontaneous/site.rb +17 -10
  184. data/lib/spontaneous/site/publishing.rb +25 -3
  185. data/lib/spontaneous/site/state.rb +7 -3
  186. data/lib/spontaneous/tasks/database.rake +5 -10
  187. data/lib/spontaneous/utils/database/mysql_dumper.rb +5 -1
  188. data/lib/spontaneous/version.rb +1 -1
  189. data/spontaneous.gemspec +4 -3
  190. data/test/fixtures/example_application/config/initializers/initializer1.rb +1 -0
  191. data/test/fixtures/example_application/config/initializers/initializer2.rb +1 -0
  192. data/test/fixtures/example_application/config/initializers/publishing.rb +13 -0
  193. data/test/fixtures/search/config/{indexes.rb → initializers/indexes.rb} +0 -0
  194. data/test/fixtures/serialisation/root_hash.yaml.erb +10 -4
  195. data/test/functional/test_application.rb +10 -0
  196. data/test/functional/test_back.rb +23 -5
  197. data/test/functional/test_cli.rb +98 -34
  198. data/test/functional/test_front.rb +7 -3
  199. data/test/test_helper.rb +35 -28
  200. data/test/unit/test_alias.rb +20 -3
  201. data/test/unit/test_assets.rb +58 -30
  202. data/test/unit/test_changesets.rb +20 -12
  203. data/test/unit/test_content_hash.rb +496 -0
  204. data/test/unit/test_context.rb +28 -1
  205. data/test/unit/test_controllers.rb +96 -61
  206. data/test/unit/test_crypt.rb +1 -8
  207. data/test/unit/test_datamapper.rb +95 -19
  208. data/test/unit/test_features.rb +1 -4
  209. data/test/unit/test_fields.rb +61 -12
  210. data/test/unit/test_generators.rb +39 -2
  211. data/test/unit/test_images.rb +3 -1
  212. data/test/unit/test_modifications.rb +224 -219
  213. data/test/unit/test_output_store.rb +10 -0
  214. data/test/unit/{test_formats.rb → test_outputs.rb} +75 -6
  215. data/test/unit/test_page.rb +61 -15
  216. data/test/unit/test_plugins.rb +2 -42
  217. data/test/unit/test_publishing_pipeline.rb +1050 -0
  218. data/test/unit/test_render.rb +30 -0
  219. data/test/unit/test_revisions.rb +110 -2
  220. data/test/unit/test_schema.rb +4 -0
  221. data/test/unit/test_search.rb +1 -1
  222. data/test/unit/test_serialisation.rb +6 -1
  223. data/test/unit/test_singletons.rb +159 -0
  224. data/test/unit/test_site.rb +71 -44
  225. metadata +140 -86
  226. data/application/static/font/fontawesome-webfont-1c66a4738b40ef0f6b1abca0ba9a796d.ttf +0 -0
  227. data/test/unit/test_publishing.rb +0 -330
@@ -1,6 +1,7 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  require 'tempfile'
4
+ require 'digest/md5'
4
5
 
5
6
  module Spontaneous::Field
6
7
  class File < Base
@@ -56,15 +57,27 @@ module Spontaneous::Field
56
57
 
57
58
  def preprocess(image, site)
58
59
  file, filename, mimetype = fileinfo(image)
59
- return "" if file.nil?
60
- return file unless ::File.exist?(file)
60
+ if file.nil?
61
+ set_unprocessed_value(["", ""].to_json)
62
+ return ""
63
+ end
64
+ unless ::File.exist?(file)
65
+ set_unprocessed_value([file, ""].to_json)
66
+ return file
67
+ end
68
+ set_unprocessed_value([filename, file_digest(file)].to_json)
61
69
 
62
70
  media_file = site.file(owner, filename, storage_headers(mimetype, filename))
63
71
  media_file.copy(file)
64
- set_unprocessed_value(media_file.path)
65
72
  media_file
66
73
  end
67
74
 
75
+ def file_digest(file)
76
+ Digest::MD5.file(file).hexdigest
77
+ rescue Errno::ENOENT => e
78
+ ""
79
+ end
80
+
68
81
  def fileinfo(fileinfo)
69
82
  file = filename = mimetype = nil
70
83
  case fileinfo
@@ -108,6 +121,18 @@ module Spontaneous::Field
108
121
  })
109
122
  end
110
123
 
124
+ def original_filename
125
+ file_info[0]
126
+ end
127
+
128
+ def file_hash
129
+ file_info[1]
130
+ end
131
+
132
+ def file_info
133
+ @file_info ||= Spontaneous::JSON.parse(unprocessed_value)
134
+ end
135
+
111
136
  def path
112
137
  value(:html)
113
138
  end
@@ -106,6 +106,8 @@ module Spontaneous::Field
106
106
  sizes[:original].src
107
107
  end
108
108
 
109
+ alias_method :processed_value, :value
110
+
109
111
  def set_value!(value, process = true, site = nil)
110
112
  @sizes = nil
111
113
  super
@@ -77,6 +77,12 @@ module Spontaneous::Field
77
77
  end
78
78
 
79
79
  def run
80
+ @site.transaction do
81
+ run!
82
+ end
83
+ end
84
+
85
+ def run!
80
86
  @fields.each do |field|
81
87
  field.process_pending_value(@site)
82
88
  end
@@ -33,6 +33,11 @@ module Spontaneous::Field
33
33
  metadata = (metadata || [{}]).first || {}
34
34
  end
35
35
 
36
+ # TODO: define what's a sensible fallback response
37
+ def fallback_response
38
+ {}
39
+ end
40
+
36
41
  def to_html(options = {})
37
42
  params = player_attributes(options)
38
43
  attributes = hash_to_attributes(params[:attr])
@@ -104,7 +109,7 @@ module Spontaneous::Field
104
109
  "player_id" => o[:player_id] }
105
110
  params.update("color" => o[:color]) if o.key?(:color)
106
111
  params = ::Rack::Utils.build_query(params)
107
- "http://player.vimeo.com/video/#{video_id}?#{params}"
112
+ "//player.vimeo.com/video/#{video_id}?#{params}"
108
113
  end
109
114
  end
110
115
 
@@ -84,7 +84,7 @@ module Spontaneous::Field
84
84
  # "player_id" => o[:player_id] }
85
85
  # params.update("color" => o[:color]) if o.key?(:color)
86
86
  # params = ::Rack::Utils.build_query(params)
87
- "https://vine.co/v/#{video_id}/card"
87
+ "//vine.co/v/#{video_id}/card"
88
88
  end
89
89
  end
90
90
 
@@ -101,7 +101,7 @@ module Spontaneous::Field
101
101
  "autohide" => o[:autohide],
102
102
  "rel" => o[:rel],
103
103
  "enablejsapi" => o[:api] })
104
- "http://www.youtube.com/embed/#{video_id}?#{params}"
104
+ "//www.youtube.com/embed/#{video_id}?#{params}"
105
105
  end
106
106
 
107
107
  def download_metadata
@@ -6,9 +6,10 @@ module Spontaneous
6
6
  module Generators
7
7
  class Site < Thor::Group
8
8
  def self.available_dbs
9
- postgres = { :gem => "sequel_pg", :adapter => "postgres", :user => nil }
10
- { "mysql" => { :gem => "mysql2", :adapter => "mysql2", :user => "root" },
11
- "pg" => postgres, "postgresql" => postgres, "postgres" => postgres }
9
+ postgres = { :gem => "sequel_pg", :adapter => "postgres", :user => ENV["USER"] }
10
+ { "sqlite" => { gem: "sqlite3", adapter: "sqlite3" },
11
+ "mysql" => { gem: "mysql2", adapter: "mysql2", user: "root" },
12
+ "pg" => postgres, "postgresql" => postgres, "postgres" => postgres }
12
13
  end
13
14
 
14
15
  def self.source_root; File.expand_path(File.dirname(__FILE__) + "/site"); end
@@ -19,7 +20,7 @@ module Spontaneous
19
20
  argument :domain, :type => :string, :desc => "The domain name of the site to generate"
20
21
 
21
22
  class_option :root, :desc => "The root destination", :aliases => '-r', :default => ".", :type => :string
22
- class_option :database, :desc => "The database to use ('postgres' (default) or 'mysql')", :aliases => %w(-d --db), :default => "postgres", :type => :string
23
+ class_option :database, :desc => "The database to use ('sqlite' (default), 'postgres' or 'mysql')", :aliases => %w(-d --db), :default => "sqlite", :type => :string
23
24
  class_option :user, :desc => "The database account to use", :aliases => '-u', :type => :string
24
25
  class_option :password, :desc => "The password for the database user", :aliases => %w(-p), :default => "", :type => :string
25
26
  class_option :host, :desc => "The database host", :aliases => %w(-h), :type => :string
@@ -59,6 +60,7 @@ module Spontaneous
59
60
  template "Gemfile.tt", "Gemfile"
60
61
  template "Capfile.tt", "Capfile"
61
62
  template "Rakefile.tt", "Rakefile"
63
+ template "db/#{@database[:adapter]}.yml.tt", "config/database.yml"
62
64
  # template "lib/site.rb.tt", "lib/site.rb"
63
65
  # empty_directory "lib/tasks"
64
66
  empty_directory "log"
@@ -1,5 +1,6 @@
1
1
  log/*
2
2
  tmp/*
3
3
  cache/*
4
+ assets/tmp/*
4
5
  .irb_history
5
6
 
@@ -3,13 +3,13 @@ source "https://rubygems.org"
3
3
  # You can either fix the version of Spontaneous that this site uses
4
4
  gem 'spontaneous', '~> <%= Spontaneous::VERSION %>'
5
5
  # Or point it at a git repository to use the cutting edge or your custom version
6
- # gem 'spontaneous', :git => "https://github.com/SpontaneousCMS/spontaneous.git"
6
+ # gem 'spontaneous', git: 'https://github.com/SpontaneousCMS/spontaneous.git'
7
7
 
8
8
  gem '<%= @database[:gem].name %>', '<%= @database[:gem].requirement %>'<%
9
9
  if (requires = @database[:gem].autorequire) && (requires.length > 0)
10
10
  requires = requires.first if requires.length == 1 -%>
11
11
  , require: '<%= requires %>'
12
- <%- end -%>
12
+ <%- end %>
13
13
 
14
14
  # Your favorite ExecJS compatible engine
15
15
  gem 'therubyracer', '~> 0.11.1'
@@ -20,7 +20,7 @@ gem 'capistrano', '~> 2.9'
20
20
  # If you want to enable the built in search functionality then you must un-comment
21
21
  # the xapian-ruby dependency below. It is not included by default
22
22
  # because the xapian library takes a very long time to build.
23
- #gem 'xapian-ruby', "~> 1.2.12"
23
+ #gem 'xapian-ruby', '~> 1.2.12'
24
24
 
25
25
  # group :production do
26
26
  # gem 'thin', '~> 1.3.1'
@@ -0,0 +1,78 @@
1
+ # Configure the template filesystem.
2
+ #
3
+ # Spontaneous accepts any Moneta[1] compatible key-value store as a
4
+ # template destination. The arguments to #output_store should be
5
+ # identical to those you would use to configure a Moneta instance,
6
+ # e.g.
7
+ #
8
+ # Site.output_store(:Memcached, server: 'localhost:11211)
9
+ #
10
+ # [1]: https://github.com/minad/moneta
11
+
12
+ Site.output_store(:File, dir: Site.revision_root)
13
+
14
+ # Configure the site publishing pipeline
15
+ #
16
+ # `run` inserts a step in the publishing pipeline.
17
+
18
+ # The core steps can be referenced by a symbol that is mapped to
19
+ # the corresponding step class.
20
+ #
21
+ # Custom steps *must* respond to `call` with four parameters:
22
+ #
23
+ # site: the current site instance
24
+ # revision: the revision that is being created
25
+ # pages: the list of pages that are being published
26
+ # progress: a progress object
27
+ #
28
+ # `call` can optionally return an object that responds to #rollback
29
+ # which should undo any actions made by the #call method.
30
+ #
31
+ # They can also, optionally, respond to:
32
+ #
33
+ # #count(site, revision, pages, progress): returns the number of
34
+ # discrete actions that this step comprises. During the #call
35
+ # the step *must* call progress#step exactly the number of times
36
+ # returned by this call
37
+ #
38
+ # Examples:
39
+ #
40
+ # Run a proc as part of the publishing process:
41
+ # run proc { |site, revision, pages, progress| puts "Publishing revision #revision}" }
42
+ #
43
+ # Run a custom publishing step:
44
+ #
45
+ # class NotifyMe
46
+ # def initialize(options)
47
+ # @options = options
48
+ # end
49
+ # def count(site, revision, pages, progress)
50
+ # 1
51
+ # end
52
+ # def call(site, revision, pages, progress)
53
+ # # send me a tweet when the site publishes...
54
+ # end
55
+ # end
56
+ #
57
+ # Site.publish do
58
+ # run NotifyMe.new(handle: "my_twitter_name")
59
+ # end
60
+ #
61
+
62
+ # NOTE: Do not remove or re-order the core steps declared below
63
+ # unless you are really sure of what you're doing
64
+ Site.publish do
65
+ # List of notification targets.
66
+ # If you remove the :browser target then publishing progress will not
67
+ # be shown in the browser
68
+ <%- Spontaneous::Publishing::Steps::CORE_PROGRESS.each do |progress| -%>
69
+ notify <%= progress.inspect %>
70
+ <%- end -%>
71
+ # Start core steps
72
+ <%- Spontaneous::Publishing::Steps::CORE_STEPS.each do |step| -%>
73
+ run <%= step.inspect %>
74
+ <%- end -%>
75
+ # Finish core steps
76
+ # At this point the site is published & most probably live to the public
77
+ # This is a good place to run any notification steps
78
+ end
@@ -1,13 +1,17 @@
1
1
  ---
2
- :development: &defaults
3
- :adapter: <%= @database[:adapter] %>
4
- :database: <%= @site_name %>
2
+ :defaults: &defaults
3
+ :adapter: mysql2
4
+ :encoding: UTF-8
5
5
  :user: <%= @database[:user] %>
6
6
  :password: <%= @database[:password] %>
7
7
  <% unless (host = @database[:host]).blank? -%>
8
8
  :host: <%= host %>
9
9
  <% end %>
10
10
 
11
+ :development:
12
+ <<: *defaults
13
+ :database: <%= @site_name %>
14
+
11
15
  :test:
12
16
  <<: *defaults
13
17
  :database: <%= @site_name %>_test
@@ -18,7 +22,4 @@
18
22
  :user: <%= @site_name %>
19
23
  :password: <%= @database[:password] %>
20
24
 
21
- :rake:
22
- <<: *defaults
23
-
24
25
 
@@ -0,0 +1,25 @@
1
+ ---
2
+ :defaults: &defaults
3
+ :adapter: postgres
4
+ :encoding: UTF-8
5
+ :user: <%= @database[:user] %>
6
+ :password: <%= @database[:password] %>
7
+ <% unless (host = @database[:host]).blank? -%>
8
+ :host: <%= host %>
9
+ <% end %>
10
+
11
+ :development:
12
+ <<: *defaults
13
+ :database: <%= @site_name %>
14
+
15
+ :test:
16
+ <<: *defaults
17
+ :database: <%= @site_name %>_test
18
+
19
+ :production:
20
+ <<: *defaults
21
+ :database: <%= @site_name %>
22
+ :user: <%= @site_name %>
23
+ :password: <%= @database[:password] %>
24
+
25
+
@@ -0,0 +1,18 @@
1
+ ---
2
+ :default: &default
3
+ :adapter: sqlite
4
+
5
+ :development:
6
+ <<: *default
7
+ :database: db/development.sqlite3
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ :test:
13
+ <<: *default
14
+ :database: db/test.sqlite3
15
+
16
+ :production:
17
+ <<: *default
18
+ :database: db/production.sqlite3
@@ -0,0 +1,14 @@
1
+ # humanstxt.org/
2
+ # The humans responsible & technology colophon
3
+
4
+ # TEAM
5
+
6
+ <name> -- <role> -- <twitter>
7
+
8
+ # THANKS
9
+
10
+ <name>
11
+
12
+ # TECHNOLOGY COLOPHON
13
+
14
+ Spontaneous CMS v<%= Spontaneous::VERSION %>, HTML5, CSS3
@@ -7,15 +7,66 @@
7
7
  <head>
8
8
  <meta charset="UTF-8">
9
9
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
10
+ !{
11
+
12
+ A quick guide to spontaneous templating:
13
+
14
+ ${ ... } inserts a value, e.g. `${ title }` inserts the value of the page's title field
15
+
16
+ %{ ... } creates a code block with no output into the template,
17
+ e.g. `%{ total_entries = boxes.map { |box| box.length }.sum }`
18
+
19
+ !{ ... } inserts a comment, e.g. `!{ this is a comment }`
20
+
21
+ Adding a '-' before the closing bracket removes whitespace after the tag, e.g. `${ title -}`
22
+
23
+ }
10
24
  <title>${ title } ­ <%= @domain %></title>
25
+
26
+ !{ inserts a CSS link to assets/css/site.css which is a Sprockets 'manifest' file }
27
+
11
28
  ${ stylesheets 'css/site' }
29
+
12
30
  </head>
13
31
  <body>
14
32
  %{ block :content }
15
33
  <h2>Welcome to <%= @domain %></h2>
34
+
35
+ !{ 'fields' dumps all the page fields into the template with no layout
36
+ you won't be wanting to do this in your actual templates but its useful
37
+ for instant feedback in the early stages... }
38
+
16
39
  ${ fields }
40
+
41
+ !{ 'boxes' is useful however:
42
+
43
+ `${ boxes }` is the same as doing
44
+
45
+ %{ boxes.each do |box| }
46
+ ${ box }
47
+ %{ end }
48
+
49
+ Which is different to:
50
+
51
+ %{ boxes.each do |box| }
52
+ %{ box.each do |entry| }
53
+ ${ entry }
54
+ %{ end }
55
+ %{ end }
56
+
57
+ because it also renders any template that belongs to the box.
58
+
59
+ Since the default template for a box is `${ contents }` you will always get a valid output
60
+ from `${ box }`.
61
+ }
62
+
17
63
  ${ boxes }
64
+
18
65
  %{ endblock :content }
66
+
67
+ !{ inserts a script tag pointing to assets/js/site.js which is a Sprockets 'manifest' file }
68
+
19
69
  ${ scripts %w(js/site) }
70
+
20
71
  </body>
21
72
  </html>
@@ -385,7 +385,7 @@ module Spontaneous
385
385
  end
386
386
 
387
387
  def is_schema_class?(klass)
388
- (klass < Spontaneous::Content or klass < Content::Box)
388
+ (klass < schema.site.model or klass < schema.site.model::Box)
389
389
  end
390
390
 
391
391
  def remove_constant(const)
@@ -180,7 +180,7 @@ module Spontaneous
180
180
  @log.sync = true
181
181
  @mutex = @@mutex[@log] ||= Mutex.new
182
182
  @format_datetime = options[:format_datetime] || "%d/%b/%Y %H:%M:%S"
183
- @format_message = options[:format_message] || "%s - [%s] \"%s\""
183
+ @format_message = options[:format_message] || "%s - [%s] %s"
184
184
  end
185
185
 
186
186
  ##