ecrire 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +20 -0
  3. data/Gemfile +4 -0
  4. data/LICENCE +9 -0
  5. data/README.md +62 -0
  6. data/Rakefile +72 -0
  7. data/bin/ecrire +42 -0
  8. data/ecrire.gemspec +26 -0
  9. data/lib/ecrire/app/assets/javascripts/admin/editor/content.coffee +319 -0
  10. data/lib/ecrire/app/assets/javascripts/admin/editor/ext.coffee +94 -0
  11. data/lib/ecrire/app/assets/javascripts/admin/editor/extensions/clipboard.coffee +98 -0
  12. data/lib/ecrire/app/assets/javascripts/admin/editor/extensions/image.coffee +19 -0
  13. data/lib/ecrire/app/assets/javascripts/admin/editor/navigation/delete.js.coffee +11 -0
  14. data/lib/ecrire/app/assets/javascripts/admin/editor/navigation/draft.js.coffee +42 -0
  15. data/lib/ecrire/app/assets/javascripts/admin/editor/navigation/help.js.coffee +6 -0
  16. data/lib/ecrire/app/assets/javascripts/admin/editor/navigation/save.js.coffee +61 -0
  17. data/lib/ecrire/app/assets/javascripts/admin/editor/navigation/sticky.js.coffee +11 -0
  18. data/lib/ecrire/app/assets/javascripts/admin/editor/navigation/toggle.js.coffee +10 -0
  19. data/lib/ecrire/app/assets/javascripts/admin/editor/parsers/code.coffee +39 -0
  20. data/lib/ecrire/app/assets/javascripts/admin/editor/parsers/heading.coffee +19 -0
  21. data/lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee +129 -0
  22. data/lib/ecrire/app/assets/javascripts/admin/editor/parsers/link.coffee +44 -0
  23. data/lib/ecrire/app/assets/javascripts/admin/editor/parsers/lists.coffee +48 -0
  24. data/lib/ecrire/app/assets/javascripts/admin/editor/parsers/word.coffee +56 -0
  25. data/lib/ecrire/app/assets/javascripts/admin/posts/header.coffee +69 -0
  26. data/lib/ecrire/app/assets/javascripts/admin/posts/new.js.coffee +7 -0
  27. data/lib/ecrire/app/assets/javascripts/admin/posts/title.coffee +15 -0
  28. data/lib/ecrire/app/assets/javascripts/admin.js +5 -0
  29. data/lib/ecrire/app/assets/javascripts/application.js +21 -0
  30. data/lib/ecrire/app/assets/javascripts/shared/overlay.js.coffee +29 -0
  31. data/lib/ecrire/app/assets/javascripts/shared/popup.js.coffee +7 -0
  32. data/lib/ecrire/app/assets/javascripts/vendor/moment.js +3043 -0
  33. data/lib/ecrire/app/assets/javascripts/vendor/prism/prism.ruby.js +25 -0
  34. data/lib/ecrire/app/assets/javascripts/vendor/prism.js +578 -0
  35. data/lib/ecrire/app/assets/stylesheets/admin/base.css.scss +98 -0
  36. data/lib/ecrire/app/assets/stylesheets/admin/documentation.css.scss +28 -0
  37. data/lib/ecrire/app/assets/stylesheets/admin/editor/base.css.scss +41 -0
  38. data/lib/ecrire/app/assets/stylesheets/admin/editor/content.css.scss +57 -0
  39. data/lib/ecrire/app/assets/stylesheets/admin/editor/header.css.scss +62 -0
  40. data/lib/ecrire/app/assets/stylesheets/admin/editor/image.css.scss +58 -0
  41. data/lib/ecrire/app/assets/stylesheets/admin/editor/publish.css.scss +40 -0
  42. data/lib/ecrire/app/assets/stylesheets/admin/editor/save.css.scss +44 -0
  43. data/lib/ecrire/app/assets/stylesheets/admin/images.css.scss +64 -0
  44. data/lib/ecrire/app/assets/stylesheets/admin/loading.css.scss +48 -0
  45. data/lib/ecrire/app/assets/stylesheets/admin/mixins/animations.css.scss +30 -0
  46. data/lib/ecrire/app/assets/stylesheets/admin/mixins/form.css.scss +22 -0
  47. data/lib/ecrire/app/assets/stylesheets/admin/navigation.css.scss +96 -0
  48. data/lib/ecrire/app/assets/stylesheets/admin/posts.css.scss +46 -0
  49. data/lib/ecrire/app/assets/stylesheets/admin/variables.css.scss +7 -0
  50. data/lib/ecrire/app/assets/stylesheets/admin.css.scss +5 -0
  51. data/lib/ecrire/app/assets/stylesheets/application.css.scss +12 -0
  52. data/lib/ecrire/app/assets/stylesheets/sessions.css.scss +97 -0
  53. data/lib/ecrire/app/assets/stylesheets/shared/main.css.scss +5 -0
  54. data/lib/ecrire/app/assets/stylesheets/shared/popup.css.scss +76 -0
  55. data/lib/ecrire/app/assets/stylesheets/vendor/prism/ruby.scss +11 -0
  56. data/lib/ecrire/app/assets/stylesheets/vendor/prism.scss +149 -0
  57. data/lib/ecrire/app/controllers/admin/application_controller.rb +16 -0
  58. data/lib/ecrire/app/controllers/admin/configurations/images_controller.rb +28 -0
  59. data/lib/ecrire/app/controllers/admin/images_controller.rb +35 -0
  60. data/lib/ecrire/app/controllers/admin/labels_controller.rb +18 -0
  61. data/lib/ecrire/app/controllers/admin/partials_controller.rb +43 -0
  62. data/lib/ecrire/app/controllers/admin/posts_controller.rb +90 -0
  63. data/lib/ecrire/app/controllers/admin/properties_controller.rb +35 -0
  64. data/lib/ecrire/app/controllers/application_controller.rb +29 -0
  65. data/lib/ecrire/app/controllers/concerns/.keep +0 -0
  66. data/lib/ecrire/app/controllers/ecrire/posts_controller.rb +42 -0
  67. data/lib/ecrire/app/controllers/images_controller.rb +2 -0
  68. data/lib/ecrire/app/controllers/onboarding/databases_controller.rb +67 -0
  69. data/lib/ecrire/app/controllers/onboarding/users_controller.rb +32 -0
  70. data/lib/ecrire/app/controllers/onboarding_controller.rb +20 -0
  71. data/lib/ecrire/app/controllers/partials_controller.rb +8 -0
  72. data/lib/ecrire/app/controllers/sessions_controller.rb +23 -0
  73. data/lib/ecrire/app/controllers/static_controller.rb +5 -0
  74. data/lib/ecrire/app/forms/admin/image_builder.rb +24 -0
  75. data/lib/ecrire/app/forms/admin/partial_builder.rb +105 -0
  76. data/lib/ecrire/app/forms/admin/post_builder.rb +47 -0
  77. data/lib/ecrire/app/helpers/admin/images_helper.rb +60 -0
  78. data/lib/ecrire/app/helpers/admin/labels_helper.rb +26 -0
  79. data/lib/ecrire/app/helpers/admin/posts_helper.rb +26 -0
  80. data/lib/ecrire/app/helpers/application_helper.rb +64 -0
  81. data/lib/ecrire/app/helpers/content_tag_helper.rb +91 -0
  82. data/lib/ecrire/app/helpers/open_graph_helper.rb +45 -0
  83. data/lib/ecrire/app/helpers/posts_helper.rb +19 -0
  84. data/lib/ecrire/app/models/admin/image.rb +108 -0
  85. data/lib/ecrire/app/models/admin/partial.rb +4 -0
  86. data/lib/ecrire/app/models/admin/post.rb +56 -0
  87. data/lib/ecrire/app/models/concerns/.keep +0 -0
  88. data/lib/ecrire/app/models/image.rb +5 -0
  89. data/lib/ecrire/app/models/label.rb +3 -0
  90. data/lib/ecrire/app/models/partial.rb +3 -0
  91. data/lib/ecrire/app/models/post.rb +90 -0
  92. data/lib/ecrire/app/models/property/image.rb +30 -0
  93. data/lib/ecrire/app/models/property/label.rb +28 -0
  94. data/lib/ecrire/app/models/user.rb +31 -0
  95. data/lib/ecrire/app/strategies/password_strategy.rb +17 -0
  96. data/lib/ecrire/app/views/admin/configurations/images/complete.html.erb +6 -0
  97. data/lib/ecrire/app/views/admin/configurations/images/show.html.erb +14 -0
  98. data/lib/ecrire/app/views/admin/images/_errors.html.erb +14 -0
  99. data/lib/ecrire/app/views/admin/images/_form.html.erb +15 -0
  100. data/lib/ecrire/app/views/admin/images/destroy.js.erb +0 -0
  101. data/lib/ecrire/app/views/admin/images/errors.js.erb +1 -0
  102. data/lib/ecrire/app/views/admin/images/update.js.erb +1 -0
  103. data/lib/ecrire/app/views/admin/posts/_documentation.html.erb +61 -0
  104. data/lib/ecrire/app/views/admin/posts/_list.html.erb +18 -0
  105. data/lib/ecrire/app/views/admin/posts/_post.html.erb +3 -0
  106. data/lib/ecrire/app/views/admin/posts/edit.html.erb +73 -0
  107. data/lib/ecrire/app/views/admin/posts/help.js.erb +1 -0
  108. data/lib/ecrire/app/views/admin/posts/index.js.erb +1 -0
  109. data/lib/ecrire/app/views/admin/posts/title.html.erb +10 -0
  110. data/lib/ecrire/app/views/admin/posts/update/content.js.erb +1 -0
  111. data/lib/ecrire/app/views/admin/posts/update/title.js.erb +1 -0
  112. data/lib/ecrire/app/views/admin/properties/image/create.js.erb +14 -0
  113. data/lib/ecrire/app/views/admin/properties/image/destroy.js.erb +6 -0
  114. data/lib/ecrire/app/views/admin/properties/label/create.js.erb +8 -0
  115. data/lib/ecrire/app/views/admin/properties/label/destroy.js.erb +2 -0
  116. data/lib/ecrire/app/views/layouts/admin/application.html.erb +47 -0
  117. data/lib/ecrire/app/views/partials/show.html.erb +14 -0
  118. data/lib/ecrire/app/views/sessions/_form.html.erb +18 -0
  119. data/lib/ecrire/app/views/sessions/_navigation.html.erb +24 -0
  120. data/lib/ecrire/app/views/sessions/new.html.erb +1 -0
  121. data/lib/ecrire/application.rb +18 -0
  122. data/lib/ecrire/commands/base.rb +9 -0
  123. data/lib/ecrire/commands/console.rb +21 -0
  124. data/lib/ecrire/commands/new.rb +47 -0
  125. data/lib/ecrire/commands/server.rb +27 -0
  126. data/lib/ecrire/commands.rb +19 -0
  127. data/lib/ecrire/config/environment/development.rb +12 -0
  128. data/lib/ecrire/config/environment/production.rb +12 -0
  129. data/lib/ecrire/config/environment/test.rb +3 -0
  130. data/lib/ecrire/config/environment.rb +46 -0
  131. data/lib/ecrire/config/onboarding_routes.rb +11 -0
  132. data/lib/ecrire/config/routes.rb +32 -0
  133. data/lib/ecrire/db/migrate/20131111222709_create_posts.rb +16 -0
  134. data/lib/ecrire/db/migrate/20131113200949_create_users.rb +12 -0
  135. data/lib/ecrire/db/migrate/20131114205041_add_excerpt_to_post.rb +5 -0
  136. data/lib/ecrire/db/migrate/20131221181640_add_javascript_to_posts.rb +5 -0
  137. data/lib/ecrire/db/migrate/20131221195338_create_partials.rb +12 -0
  138. data/lib/ecrire/db/migrate/20140115215122_create_images.rb +12 -0
  139. data/lib/ecrire/db/migrate/20140209144412_add_favorite_flag_to_image.rb +5 -0
  140. data/lib/ecrire/db/migrate/20140617224837_create_labels.rb +12 -0
  141. data/lib/ecrire/db/migrate/20140618321984_add_properties_to_posts.rb +6 -0
  142. data/lib/ecrire/db/migrate/20150113839713_convert_markdown_in_post_content.rb +6 -0
  143. data/lib/ecrire/db/migrate/20150120093481_add_preview_to_posts.rb +8 -0
  144. data/lib/ecrire/db/schema.rb +76 -0
  145. data/lib/ecrire/locales/admin/configurations/images/en.yml +3 -0
  146. data/lib/ecrire/locales/admin/en.yml +26 -0
  147. data/lib/ecrire/locales/admin/images/en.yml +5 -0
  148. data/lib/ecrire/locales/admin/partials/en.yml +18 -0
  149. data/lib/ecrire/locales/admin/posts/en.yml +14 -0
  150. data/lib/ecrire/locales/en.yml +9 -0
  151. data/lib/ecrire/onboarding/assets/images/.keep +0 -0
  152. data/lib/ecrire/onboarding/assets/images/background.png +0 -0
  153. data/lib/ecrire/onboarding/assets/images/github-logo.png +0 -0
  154. data/lib/ecrire/onboarding/assets/images/profile.png +0 -0
  155. data/lib/ecrire/onboarding/assets/images/twitter-logo.png +0 -0
  156. data/lib/ecrire/onboarding/assets/javascripts/base.js +2 -0
  157. data/lib/ecrire/onboarding/assets/javascripts/databases/information.js.coffee +17 -0
  158. data/lib/ecrire/onboarding/assets/javascripts/message.js.coffee +5 -0
  159. data/lib/ecrire/onboarding/assets/stylesheets/base.css.scss +80 -0
  160. data/lib/ecrire/onboarding/assets/stylesheets/complete.css.scss +3 -0
  161. data/lib/ecrire/onboarding/assets/stylesheets/fonts.css.scss +17 -0
  162. data/lib/ecrire/onboarding/assets/stylesheets/form.css.scss +25 -0
  163. data/lib/ecrire/onboarding/assets/stylesheets/message.css.scss +11 -0
  164. data/lib/ecrire/onboarding/assets/stylesheets/terminal.css.scss +16 -0
  165. data/lib/ecrire/onboarding/assets/stylesheets/variables.css.scss +3 -0
  166. data/lib/ecrire/onboarding/assets/stylesheets/welcome.css.scss +62 -0
  167. data/lib/ecrire/onboarding/views/layouts/application.html.erb +16 -0
  168. data/lib/ecrire/onboarding/views/onboarding/complete.html.erb +6 -0
  169. data/lib/ecrire/onboarding/views/onboarding/databases/index.html.erb +34 -0
  170. data/lib/ecrire/onboarding/views/onboarding/users/index.html.erb +16 -0
  171. data/lib/ecrire/onboarding/views/onboarding/welcome.html.erb +12 -0
  172. data/lib/ecrire/railtie/onboarding.rb +63 -0
  173. data/lib/ecrire/railtie/theme.rb +69 -0
  174. data/lib/ecrire/railtie.rb +30 -0
  175. data/lib/ecrire/tasks/assets.rake +15 -0
  176. data/lib/ecrire/tasks/routes.rake +6 -0
  177. data/lib/ecrire/template/Gemfile +31 -0
  178. data/lib/ecrire/template/Rakefile +4 -0
  179. data/lib/ecrire/template/assets/images/.keep +0 -0
  180. data/lib/ecrire/template/assets/javascripts/base.js.coffee +0 -0
  181. data/lib/ecrire/template/assets/javascripts/post.js.coffee +0 -0
  182. data/lib/ecrire/template/assets/stylesheets/base.css.scss +86 -0
  183. data/lib/ecrire/template/assets/stylesheets/code.css.scss +24 -0
  184. data/lib/ecrire/template/assets/stylesheets/footer.css.scss +5 -0
  185. data/lib/ecrire/template/assets/stylesheets/header.css.scss +18 -0
  186. data/lib/ecrire/template/assets/stylesheets/home.css.scss +35 -0
  187. data/lib/ecrire/template/config.ru +4 -0
  188. data/lib/ecrire/template/controllers/posts_controller.rb +2 -0
  189. data/lib/ecrire/template/helpers/blog_helper.rb +2 -0
  190. data/lib/ecrire/template/views/layouts/application.html.erb +35 -0
  191. data/lib/ecrire/template/views/posts/_post.html.erb +9 -0
  192. data/lib/ecrire/template/views/posts/index.html.erb +13 -0
  193. data/lib/ecrire/template/views/posts/show.html.erb +7 -0
  194. data/lib/ecrire/template/views/static/about.html +0 -0
  195. data/lib/ecrire/template/views/static/customize/_helper.html +7 -0
  196. data/lib/ecrire/template/views/static/customize/_helper_used.html +6 -0
  197. data/lib/ecrire/template/views/static/customize/_image.html +1 -0
  198. data/lib/ecrire/template/views/static/customize/_index.html +1 -0
  199. data/lib/ecrire/template/views/static/customize/_javascript.html +1 -0
  200. data/lib/ecrire/template/views/static/customize/_layout.html.erb +15 -0
  201. data/lib/ecrire/template/views/static/customize/_post.html +3 -0
  202. data/lib/ecrire/template/views/static/customize.html +95 -0
  203. data/lib/ecrire/version.rb +3 -0
  204. data/lib/ecrire.rb +24 -0
  205. data/test/editor/controllers/admin/images_controller_test.rb +6 -0
  206. data/test/editor/controllers/admin/posts_controller_test.rb +90 -0
  207. data/test/editor/controllers/base_controller_test.rb +26 -0
  208. data/test/editor/controllers/images_controller_test.rb +2 -0
  209. data/test/editor/controllers/partials_controller_test.rb +2 -0
  210. data/test/editor/controllers/posts_controller_test.rb +21 -0
  211. data/test/editor/controllers/sessions_controller_test.rb +21 -0
  212. data/test/editor/helpers/base_helper_test.rb +19 -0
  213. data/test/editor/helpers/posts_helper_test.rb +3 -0
  214. data/test/editor/models/image_test.rb +33 -0
  215. data/test/editor/models/partial_test.rb +4 -0
  216. data/test/editor/models/post_test.rb +109 -0
  217. data/test/editor/models/user_test.rb +4 -0
  218. data/test/editor/test_helper.rb +28 -0
  219. data/test/fixtures/images.yml +11 -0
  220. data/test/fixtures/partials.yml +9 -0
  221. data/test/fixtures/posts.yml +16 -0
  222. data/test/fixtures/users.yml +9 -0
  223. data/test/initializations/railtie_test.rb +49 -0
  224. data/test/isolation.rb +16 -0
  225. data/test/themes/template/Gemfile +28 -0
  226. data/test/themes/template/assets/javascripts/blog.js.coffee +0 -0
  227. data/test/themes/template/assets/javascripts/post.js.coffee +0 -0
  228. data/test/themes/template/assets/stylesheets/blog.css.scss +0 -0
  229. data/test/themes/template/assets/stylesheets/post.css.scss +0 -0
  230. data/test/themes/template/config.ru +0 -0
  231. data/test/themes/template/views/layouts/application.html.erb +1 -0
  232. data/test/themes/template/views/posts/index.html.erb +0 -0
  233. metadata +275 -0
@@ -0,0 +1,2 @@
1
+ //= require joint
2
+ //= require_tree .
@@ -0,0 +1,17 @@
1
+ Joint.bind 'Database.Information', class
2
+ loaded: =>
3
+ @on 'input', @element().querySelector('form'), @update
4
+
5
+ update: =>
6
+ name = @element().querySelector('input.name').value
7
+ user = @element().querySelector('input.user').value
8
+ password = @element().querySelector('input.password').value
9
+
10
+ for el in @element().querySelectorAll('.terminal .user')
11
+ el.textContent = user
12
+
13
+ for el in @element().querySelectorAll('.terminal .name')
14
+ el.textContent = name
15
+
16
+ for el in @element().querySelectorAll('.terminal .password')
17
+ el.textContent = password
@@ -0,0 +1,5 @@
1
+ Joint.bind 'Message', class
2
+ loaded: =>
3
+
4
+ remove: =>
5
+ @element().remove()
@@ -0,0 +1,80 @@
1
+ @import 'bourbon';
2
+ @import 'variables';
3
+ @import "*";
4
+
5
+ * {
6
+ box-sizing: border-box;
7
+ -moz-box-sizing: border-box;
8
+ }
9
+
10
+ html, body {
11
+ display: flex;
12
+ flex: 1 auto;
13
+ margin: 0;
14
+ padding: 0;
15
+ font-family: Baskerville;
16
+ }
17
+
18
+ html {
19
+ height: 100vh;
20
+ }
21
+
22
+ body {
23
+ @include display(flex);
24
+ @include align-items(center);
25
+ @include justify-content(center);
26
+ }
27
+
28
+ a {
29
+ color: rgb(114, 153, 204);
30
+ }
31
+
32
+ a.button, button {
33
+ @include transition(box-shadow 0.3s);
34
+ padding: 14px 18px;
35
+ background: #9DCC72;
36
+ border-radius: 2px;
37
+ font-size: 1.4em;
38
+ color: #FFF;
39
+ text-decoration: none;
40
+ font-family: courier;
41
+ box-shadow: 0 0 0 0 #436E1C;
42
+ border: none;
43
+ outline: none;
44
+ cursor: pointer;
45
+
46
+ &:hover {
47
+ box-shadow: 0 0 2px 0 #436E1C;
48
+ }
49
+
50
+ &:active {
51
+ box-shadow: inset 0 0 2px 0 #436E1C;
52
+ }
53
+ }
54
+
55
+ body {
56
+ font-size: 13px;
57
+ background: #F3F0EA;
58
+ color: #313126;
59
+ flex-direction: column;
60
+ display: flex;
61
+
62
+ section {
63
+ margin: 0 auto;
64
+ max-width: 900px;
65
+ width: 80%;
66
+ }
67
+ }
68
+
69
+ h1 {
70
+ font-size: 6em;
71
+ font-family: courier;
72
+ font-weight: normal;
73
+ margin: 0;
74
+ }
75
+
76
+ h2 {
77
+ text-align: center;
78
+ font-family: courier;
79
+ }
80
+
@@ -0,0 +1,3 @@
1
+ #OnboardingIndex section.complete {
2
+ font-size: 1.4em;
3
+ }
@@ -0,0 +1,17 @@
1
+ @font-face {
2
+ font-family: 'entypo';
3
+ src: font-url('entypo.eot');
4
+ src: font-url('entypo.eot?#ie') format('embedded-opentype'),
5
+ font-url('entypo.woff') format('woff'),
6
+ font-url('entypo.ttf') format('ttf');
7
+ }
8
+
9
+ @font-face {
10
+ font-family: 'entypo-social';
11
+ src: font-url('entypo-social.eot');
12
+ src: font-url('entypo-social.eot?#ie') format('embedded-opentype'),
13
+ font-url('entypo-social.woff') format('woff'),
14
+ font-url('entypo-social.ttf') format('ttf'),
15
+ font-url('entypo-social.svg#webfont') format('svg');
16
+ }
17
+
@@ -0,0 +1,25 @@
1
+ form {
2
+ @include display(flex);
3
+ @include flex-direction(column);
4
+ margin: 2em auto;
5
+
6
+ input {
7
+ width: 100%;
8
+ font-size: 1.3em;
9
+ margin: 4px 0;
10
+ outline: none;
11
+ padding: 4px;
12
+ }
13
+
14
+ button {
15
+ margin-top: 1em;
16
+ }
17
+
18
+ [as='Message'] {
19
+ border-radius: 2px;
20
+ color: #F4E6E6;
21
+ font-size: 1.3em;
22
+ padding: 0 8px;
23
+ margin: 1em;
24
+ }
25
+ }
@@ -0,0 +1,11 @@
1
+ [as='Message'] {
2
+ @include animation(fadeOut 2s ease 1s forwards);
3
+ background: rgb(213, 84, 84);
4
+ padding: 1em;
5
+ }
6
+
7
+ @include keyframes(fadeOut) {
8
+ to {
9
+ opacity: 0;
10
+ }
11
+ }
@@ -0,0 +1,16 @@
1
+ div.terminal {
2
+ margin-top: 2em;
3
+ padding: 8px 0;
4
+ background: #000;
5
+ border-radius: 3px;
6
+ box-shadow: 0 1px 3px 0 #161616;
7
+ color: #8D8D8D;
8
+
9
+ code {
10
+ background: none;
11
+ color: #FFEDCD;
12
+ padding: 4px 8px;
13
+ display: block;
14
+ }
15
+ }
16
+
@@ -0,0 +1,3 @@
1
+ $header-height: 46px;
2
+ $color-dark: #4B482C;
3
+ $color-light: rgb(201, 198, 183);
@@ -0,0 +1,62 @@
1
+ #OnboardingIndex {
2
+ h1.welcome {
3
+ opacity: 0;
4
+ @include animation(slideIn 3s ease forwards);
5
+ }
6
+
7
+ div.slogan {
8
+ font-size: 1.4em;
9
+ letter-spacing: 2px;
10
+
11
+ span {
12
+ opacity: 0;
13
+ }
14
+
15
+ span:nth-child(1) {
16
+ @include animation(fadeIn 1s ease 2.9s forwards);
17
+ }
18
+
19
+ span:nth-child(2) {
20
+ @include animation(fadeIn 1s ease 3.8s forwards);
21
+ }
22
+
23
+ span:nth-child(3) {
24
+ @include animation(fadeIn 1s ease 4.7s forwards);
25
+ }
26
+ }
27
+
28
+ & > section {
29
+ @include display(flex);
30
+ @include align-items(center);
31
+ @include justify-content(center);
32
+ @include flex-direction(column);
33
+ margin: 3em 0 0 0;
34
+ min-height: 50vh;
35
+ min-width: 60vw;
36
+ &.welcome {
37
+ opacity: 0;
38
+ @include animation(fadeIn 2s ease 6s forwards);
39
+ }
40
+ }
41
+ }
42
+
43
+ @include keyframes(slideIn) {
44
+ 0% {
45
+ opacity: 0;
46
+ }
47
+
48
+ 100% {
49
+ opacity: 1;
50
+ margin-top: -1em;
51
+ }
52
+ }
53
+
54
+ @include keyframes(fadeIn) {
55
+ from {
56
+ opacity: 0;
57
+ }
58
+
59
+ to {
60
+ opacity: 1;
61
+ }
62
+ }
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <head>
5
+ <%= title_tag 'Before you start blogging...' %>
6
+ <%= assets_tags %>
7
+ <%= meta_informations_tags %>
8
+ </head>
9
+
10
+ <%= body_tag class: 'onboarding' do %>
11
+
12
+ <%= yield %>
13
+
14
+ <% end %>
15
+
16
+ </html>
@@ -0,0 +1,6 @@
1
+ <section class='complete'>
2
+ <h2>Before you can start writing</h2>
3
+
4
+ <p>You will need to <strong>restart your server</strong> so Ecrire can run with the new settings.</p>
5
+
6
+ </section>
@@ -0,0 +1,34 @@
1
+ <h1>Ecrire</h1>
2
+ <section as="Database.Information">
3
+ <div class="terminal">
4
+ <code class="language-sql">$ psql -d postgres</code>
5
+
6
+ <code class="language-sql">> CREATE USER <%= content_tag :span, user, class: %w(user) %> WITH PASSWORD '<%= content_tag :span, password, class: %w(password) %>';</code>
7
+
8
+ <code class="language-sql">> CREATE DATABASE <%= content_tag :span, database, class: %w(name) %>;</code>
9
+
10
+ <code class="language-sql">> GRANT ALL PRIVILEGES ON DATABASE <%= content_tag :span, database, class: %w(name) %> to <%= content_tag :span, user, class: %w(user) %>;</code>
11
+
12
+ <code class="language-sql">> \c <%= content_tag :span, database, class: %w(name) %></code>
13
+
14
+ <code class="language-sql">> CREATE EXTENSION IF NOT EXISTS hstore;</code>
15
+ </div>
16
+
17
+
18
+ <%= form_tag onboarding_databases_path, method: :post do %>
19
+
20
+ <% unless @exception.nil? %>
21
+ <div class='error' as='Message'>
22
+ <%= content_tag :p, @exception %>
23
+ </div>
24
+ <% end %>
25
+
26
+ <h2>Connect to your postgresql database</h2>
27
+
28
+ <%= text_field_tag 'database[name]', database, placeholder: "Database name", class: %w(name) %>
29
+ <%= text_field_tag 'database[user]', user, placeholder: "Database user", class: %w(user) %>
30
+ <%= text_field_tag 'database[password]', password, placeholder: "Database password", class: %w(password) %>
31
+
32
+ <%= button_tag 'Connect', value: 'connect' %>
33
+ <% end %>
34
+ </section>
@@ -0,0 +1,16 @@
1
+ <h1>Ecrire</h1>
2
+ <section>
3
+ <h2>Create a user</h2>
4
+
5
+ <%= form_for [:onboarding, user], url: onboarding_users_path, method: :post do |f| %>
6
+ <% if user.errors.any? %>
7
+ <%= content_tag :div, class: %w(error), as: 'Message' do %>
8
+ <%= content_tag :p, user.errors.full_messages.first %>
9
+ <% end %>
10
+ <% end %>
11
+ <%= f.text_field :email, placeholder: 'E-mail' %>
12
+ <%= f.password_field :password, placeholder: 'Password' %>
13
+ <%= f.password_field :password_confirmation, placeholder: 'Confirm your password' %>
14
+ <%= button_tag 'Create' %>
15
+ <% end %>
16
+ </section>
@@ -0,0 +1,12 @@
1
+ <h1 class='welcome'>Ecrire</h1>
2
+ <div class='slogan'>
3
+ <span>Easy.</span>
4
+ <span>Simple.</span>
5
+ <span>Fun.</span>
6
+ </div>
7
+
8
+
9
+ <section class='welcome'>
10
+ <%= link_to 'Configure', onboarding_databases_path, class: %w(button) %>
11
+ </section>
12
+
@@ -0,0 +1,63 @@
1
+ class Ecrire::Railtie
2
+ module Onboarding
3
+ extend ActiveSupport::Concern
4
+ included do
5
+ Rails.application.config.active_record.migration_error = :none
6
+ ActiveRecord::Base.configurations = {}
7
+
8
+ initializer 'ecrire.onboarding.dynamic_settings' do |app|
9
+ app.config.secret_key_base = SecureRandom.hex(16)
10
+ end
11
+
12
+ initializer 'ecrire.onboarding.routes' do |app|
13
+ app.routes.clear!
14
+
15
+ app.paths.add 'config/routes.rb', with: 'config/onboarding_routes.rb'
16
+
17
+ paths = app.paths['config/routes.rb'].existent
18
+ app.routes_reloader.paths.clear.unshift(*paths)
19
+ app.routes_reloader.route_sets << app.routes
20
+ end
21
+
22
+ initializer 'ecrire.view_paths' do |app|
23
+ ActionController::Base.prepend_view_path paths['onboarding:views'].existent
24
+ end
25
+
26
+ initializer 'ecrire.assets' do |app|
27
+ app.config.assets.paths.concat paths['onboarding:assets'].existent
28
+ end
29
+
30
+ def paths
31
+ @paths ||= begin
32
+ paths = Rails::Paths::Root.new(root_path)
33
+ paths.add 'onboarding:views', with: 'views'
34
+ paths.add 'onboarding:assets', with: 'assets', glob: '*'
35
+ paths
36
+ end
37
+ end
38
+
39
+ def root_path
40
+ Pathname.new(__FILE__).dirname + '../onboarding/'
41
+ end
42
+
43
+ # This hack is done because ActiveRecord raise an error that makes
44
+ # Ecrire exit which makes it impossible to have an instance working without a
45
+ # database. By doing this, it becomes possible to Ecrire to load the server and
46
+ # serve the onboarding theme for the user.
47
+ ActiveRecord::Railtie.initializers.select do |initializer|
48
+ initializer.name.eql? 'active_record.initialize_database'
49
+ end.first.instance_variable_set :@block, Proc.new { |app|
50
+ ActiveSupport.on_load(:active_record) do
51
+ begin
52
+ establish_connection
53
+ rescue ActiveRecord::NoDatabaseError, ActiveRecord::AdapterNotSpecified => e
54
+ app.config.middleware.delete 'ActiveRecord::QueryCache'
55
+ app.config.middleware.delete 'ActiveRecord::ConnectionAdapters::ConnectionManagement'
56
+ end
57
+ end
58
+ }
59
+
60
+
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,69 @@
1
+ class Ecrire::Railtie
2
+ module Theme
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+
7
+ initializer 'ecrire.logs', before: :initialize_logger do |app|
8
+ unless Rails.env.test?
9
+ app.paths.add "log", with: "log/#{Rails.env}.log"
10
+ end
11
+ end
12
+
13
+ initializer 'ecrire.locales' do |app|
14
+ config.i18n.railties_load_path.concat(paths['user:locales'].existent)
15
+ end
16
+
17
+ initializer 'ecrire.controllers' do |app|
18
+ if paths['user:controllers'].existent.any?
19
+ app.paths['app/controllers'].concat paths['user:controllers'].existent
20
+ end
21
+ end
22
+
23
+ initializer 'ecrire.helpers' do |app|
24
+ if paths['user:helpers'].existent.any?
25
+ app.paths['app/helpers'].concat paths['user:helpers'].existent
26
+ end
27
+ end
28
+
29
+ initializer 'ecrire.view_paths' do |app|
30
+ ActionController::Base.prepend_view_path paths['user:views'].existent
31
+ end
32
+
33
+ initializer 'ecrire.assets' do |app|
34
+ app.config.assets.paths.concat paths['user:assets'].existent
35
+ end
36
+
37
+ def paths
38
+ @paths ||= begin
39
+ paths = Rails::Paths::Root.new(root_path)
40
+ paths.add 'user:views', with: 'views'
41
+ paths.add 'user:controllers', with: 'controllers', eager_load: true
42
+ paths.add 'user:assets', with: 'assets', glob: '*'
43
+ paths.add 'user:locales', with: 'locales', glob: '**/*.{rb,yml}'
44
+ paths.add 'user:helpers', with: 'helpers', eager_load: true
45
+ paths.add 'public', with: 'tmp/public'
46
+ paths
47
+ end
48
+ end
49
+
50
+ def root_path(file = 'config.ru')
51
+ begin
52
+ pathname = Pathname.pwd
53
+
54
+ while !(pathname + file).exist? do
55
+ pathname = pathname.parent
56
+ if pathname.root?
57
+ raise "Could not find #{file}. Type 'ecrire new blog_name' to create a new blog"
58
+ break
59
+ end
60
+ end
61
+
62
+ pathname
63
+ end
64
+ end
65
+
66
+
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,30 @@
1
+ module Ecrire
2
+ class Railtie < ::Rails::Railtie
3
+ require 'ecrire/railtie/onboarding'
4
+ require 'ecrire/railtie/theme'
5
+
6
+ initializer 'ecrire.secrets', before: :bootstrap_hook do |app|
7
+ app.paths.add 'config/secrets', with: Dir.pwd + '/secrets.yml'
8
+ end
9
+
10
+ initializer 'ecrire.load_paths', before: :bootstrap_hook do |app|
11
+ ActiveSupport::Dependencies.autoload_paths.unshift(*self.paths.autoload_paths)
12
+ ActiveSupport::Dependencies.autoload_once_paths.unshift(*self.paths.autoload_once)
13
+ end
14
+
15
+ initializer 'ecrire.append_paths', before: :set_autoload_paths do |app|
16
+ app.config.eager_load_paths.unshift *paths.eager_load
17
+ app.config.autoload_once_paths.unshift *paths.autoload_once
18
+ app.config.autoload_paths.unshift *paths.autoload_paths
19
+ end
20
+
21
+ Rails.application.paths.add 'config/database', with: Dir.pwd + '/secrets.yml'
22
+
23
+ if File.exist?(Dir.pwd + '/secrets.yml')
24
+ include Ecrire::Railtie::Theme
25
+ else
26
+ include Ecrire::Railtie::Onboarding
27
+ end
28
+
29
+ end
30
+ end
@@ -0,0 +1,15 @@
1
+ namespace :assets do
2
+ task :environment do
3
+ Ecrire::Application.initialize!
4
+ end
5
+ end
6
+
7
+ module Sprockets
8
+ module Rails
9
+ class Task < Rake::SprocketsTask
10
+ def output
11
+ File.join(Ecrire::Railtie.paths['public'].existent.first, app.config.assets.prefix)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,6 @@
1
+ task routes: :environment do
2
+ Rails.application.paths.add 'config/routes.rb', with: 'config/routes.rb', eager_load: true
3
+ Rails.application.paths['config/routes.rb'].existent.each do |path|
4
+ require path
5
+ end
6
+ end
@@ -0,0 +1,31 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'ecrire', '~> 0.1'
4
+
5
+ group :required do
6
+ gem 'rails', '~> 4.2'
7
+ gem 'jointjs', '~> 0.0'
8
+ gem 'warden', '~> 1.2'
9
+ gem 'bcrypt', '~> 3.1'
10
+ gem 'nokogiri', '~> 1.6'
11
+ gem 's3', '~> 0.3'
12
+ gem 'pg', '~> 0.17'
13
+ gem 'kaminari', '~> 0.15'
14
+ gem 'kramdown', '~> 1.5'
15
+
16
+ gem 'sprockets-rails', '~> 2.1'
17
+ gem 'sass-rails', '~> 4.0', '>= 4.0.3'
18
+ gem 'coffee-rails', '~> 4.0'
19
+ gem 'turbolinks', '~> 2.2'
20
+ gem 'bourbon', '~> 3.2'
21
+ gem 'uglifier', '~> 2.5'
22
+ end
23
+
24
+ group :server do
25
+ gem 'thin', '~> 1.6'
26
+ end
27
+
28
+ # Only loaded in development environment.
29
+ group :development do
30
+ gem 'byebug'
31
+ end
@@ -0,0 +1,4 @@
1
+ require 'ecrire'
2
+
3
+ Ecrire::Application.load_tasks
4
+
File without changes
@@ -0,0 +1,86 @@
1
+ @import 'bourbon';
2
+ @import '*';
3
+
4
+ * {
5
+ box-sizing: border-box;
6
+ }
7
+
8
+ html, body {
9
+ @include display(flex);
10
+ @include flex(1);
11
+ margin: 0;
12
+ padding: 0;
13
+ background: #F3F0EA;
14
+ color: rgb(24, 27, 20);
15
+ font-size: 16px;
16
+ }
17
+
18
+ body {
19
+ @include flex-direction(column);
20
+ }
21
+
22
+ main {
23
+ @include display(flex);
24
+ @include flex(1);
25
+ @include flex-direction(column);
26
+
27
+ & > header, & > article {
28
+ max-width: 940px;
29
+ margin: 0 auto;
30
+ width: 80%;
31
+ }
32
+
33
+ & > article {
34
+ @include display(flex);
35
+ @include flex-direction(column);
36
+ @include flex(1);
37
+ padding: 0 3em 6em 3em;
38
+ }
39
+ }
40
+
41
+ a {
42
+ @include transition(color 0.3s ease);
43
+ color: #192330;
44
+ &:hover {
45
+ color: #72a0db;
46
+ }
47
+ }
48
+
49
+ h1, h2, h3, h4, h5 {
50
+ margin: 0.66em 0 0.33em 0;
51
+ a {
52
+ color: inherit;
53
+ text-decoration: none;
54
+ }
55
+ }
56
+
57
+ h1 {
58
+ line-height: 1em;
59
+ font-weight: lighter;
60
+ font-size: 3.0em;
61
+ text-align: center;
62
+ }
63
+
64
+ h2 {
65
+ font-size: 2.6em;
66
+ }
67
+
68
+ h3 {
69
+ font-size: 2.2em;
70
+ }
71
+
72
+ h4 {
73
+ font-size: 2.0em;
74
+ }
75
+
76
+ h5 {
77
+ font-size: 1.7em;
78
+ }
79
+
80
+ h6 {
81
+ font-size: 1.5em;
82
+ }
83
+
84
+ p {
85
+ line-height: 1.3em;
86
+ }