phoenixbricks 3.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/Gemfile +7 -0
  4. data/LICENSE.txt +674 -0
  5. data/README.md +85 -0
  6. data/bin/rbricks +5 -0
  7. data/lib/railsbricks.rb +115 -0
  8. data/lib/railsbricks/app_generator.rb +352 -0
  9. data/lib/railsbricks/assets/config/admin_post_routes.rbr +3 -0
  10. data/lib/railsbricks/assets/config/application.yml +9 -0
  11. data/lib/railsbricks/assets/config/contact_routes.rbr +2 -0
  12. data/lib/railsbricks/assets/config/initializers/devise_email/devise.rb +267 -0
  13. data/lib/railsbricks/assets/config/initializers/devise_username/devise.rb +267 -0
  14. data/lib/railsbricks/assets/config/post_routes.rbr +2 -0
  15. data/lib/railsbricks/assets/config/routes.rb +15 -0
  16. data/lib/railsbricks/assets/config/unicorn.rb +22 -0
  17. data/lib/railsbricks/assets/controllers/admin/base_controller.rb +10 -0
  18. data/lib/railsbricks/assets/controllers/admin/devise_email/users_controller.rb +66 -0
  19. data/lib/railsbricks/assets/controllers/admin/devise_username/users_controller.rb +69 -0
  20. data/lib/railsbricks/assets/controllers/admin/posts_controller.rb +73 -0
  21. data/lib/railsbricks/assets/controllers/brick_contact.rbr +23 -0
  22. data/lib/railsbricks/assets/controllers/devise_email/application_controller.rb +54 -0
  23. data/lib/railsbricks/assets/controllers/devise_username/application_controller.rb +56 -0
  24. data/lib/railsbricks/assets/controllers/pages_controller.rb +13 -0
  25. data/lib/railsbricks/assets/controllers/posts_controller.rbr +10 -0
  26. data/lib/railsbricks/assets/database/postgresql.yml +12 -0
  27. data/lib/railsbricks/assets/database/sqlite3.yml +8 -0
  28. data/lib/railsbricks/assets/gemfile/Gemfile +44 -0
  29. data/lib/railsbricks/assets/git/gitignore +30 -0
  30. data/lib/railsbricks/assets/javascripts/analytics.js.coffee +5 -0
  31. data/lib/railsbricks/assets/lib/markdown_writer.rb +19 -0
  32. data/lib/railsbricks/assets/mailers/contact_mailer.rb +13 -0
  33. data/lib/railsbricks/assets/migrations/20141010133702_create_posts.rb +17 -0
  34. data/lib/railsbricks/assets/migrations/devise_email/20141010133701_devise_create_users.rb +48 -0
  35. data/lib/railsbricks/assets/migrations/devise_username/20141010133701_devise_create_users.rb +54 -0
  36. data/lib/railsbricks/assets/models/devise_email/user.rb +41 -0
  37. data/lib/railsbricks/assets/models/devise_username/user.rb +57 -0
  38. data/lib/railsbricks/assets/models/post.rb +30 -0
  39. data/lib/railsbricks/assets/procfile/Procfile +1 -0
  40. data/lib/railsbricks/assets/seeds/devise_email/seeds_no_test_users.rb +11 -0
  41. data/lib/railsbricks/assets/seeds/devise_email/seeds_test_users.rb +24 -0
  42. data/lib/railsbricks/assets/seeds/devise_username/seeds_no_test_users.rb +12 -0
  43. data/lib/railsbricks/assets/seeds/devise_username/seeds_test_users.rb +26 -0
  44. data/lib/railsbricks/assets/stylesheets/application.scss +6 -0
  45. data/lib/railsbricks/assets/stylesheets/railsbricks_custom.scss +562 -0
  46. data/lib/railsbricks/assets/views/admin/base/admin_posts_link.rbr +1 -0
  47. data/lib/railsbricks/assets/views/admin/base/devise_email/index.html.erb +41 -0
  48. data/lib/railsbricks/assets/views/admin/base/devise_username/index.html.erb +41 -0
  49. data/lib/railsbricks/assets/views/admin/posts/_form.html.erb +54 -0
  50. data/lib/railsbricks/assets/views/admin/posts/dashboard.html.erb +9 -0
  51. data/lib/railsbricks/assets/views/admin/posts/drafts.html.erb +23 -0
  52. data/lib/railsbricks/assets/views/admin/posts/edit.html.erb +10 -0
  53. data/lib/railsbricks/assets/views/admin/posts/index.html.erb +23 -0
  54. data/lib/railsbricks/assets/views/admin/posts/new.html.erb +6 -0
  55. data/lib/railsbricks/assets/views/admin/users/devise_email/edit.html.erb +65 -0
  56. data/lib/railsbricks/assets/views/admin/users/devise_email/index.html.erb +54 -0
  57. data/lib/railsbricks/assets/views/admin/users/devise_username/edit.html.erb +74 -0
  58. data/lib/railsbricks/assets/views/admin/users/devise_username/index.html.erb +56 -0
  59. data/lib/railsbricks/assets/views/contact_mailer/contact_message.html.erb +5 -0
  60. data/lib/railsbricks/assets/views/devise/allow_signup_links.rbr +11 -0
  61. data/lib/railsbricks/assets/views/devise/devise_email/confirmations/new.html.erb +31 -0
  62. data/lib/railsbricks/assets/views/devise/devise_email/mailer/confirmation_instructions.html.erb +12 -0
  63. data/lib/railsbricks/assets/views/devise/devise_email/mailer/reset_password_instructions.html.erb +15 -0
  64. data/lib/railsbricks/assets/views/devise/devise_email/passwords/edit.html.erb +43 -0
  65. data/lib/railsbricks/assets/views/devise/devise_email/passwords/new.html.erb +31 -0
  66. data/lib/railsbricks/assets/views/devise/devise_email/registrations/edit.html.erb +63 -0
  67. data/lib/railsbricks/assets/views/devise/devise_email/registrations/new.html.erb +49 -0
  68. data/lib/railsbricks/assets/views/devise/devise_email/sessions/new.html.erb +49 -0
  69. data/lib/railsbricks/assets/views/devise/devise_email/shared/_links.erb +19 -0
  70. data/lib/railsbricks/assets/views/devise/devise_username/confirmations/new.html.erb +31 -0
  71. data/lib/railsbricks/assets/views/devise/devise_username/mailer/confirmation_instructions.html.erb +12 -0
  72. data/lib/railsbricks/assets/views/devise/devise_username/mailer/reset_password_instructions.html.erb +15 -0
  73. data/lib/railsbricks/assets/views/devise/devise_username/passwords/edit.html.erb +43 -0
  74. data/lib/railsbricks/assets/views/devise/devise_username/passwords/new.html.erb +31 -0
  75. data/lib/railsbricks/assets/views/devise/devise_username/registrations/edit.html.erb +63 -0
  76. data/lib/railsbricks/assets/views/devise/devise_username/registrations/new.html.erb +58 -0
  77. data/lib/railsbricks/assets/views/devise/devise_username/sessions/new.html.erb +49 -0
  78. data/lib/railsbricks/assets/views/devise/devise_username/shared/_links.erb +19 -0
  79. data/lib/railsbricks/assets/views/layouts/_navigation_links.html.erb +15 -0
  80. data/lib/railsbricks/assets/views/layouts/brick_analytics.rbr +11 -0
  81. data/lib/railsbricks/assets/views/pages/contact.html.erb +46 -0
  82. data/lib/railsbricks/assets/views/pages/inside.html.erb +4 -0
  83. data/lib/railsbricks/assets/views/pages/posts.html.erb +18 -0
  84. data/lib/railsbricks/assets/views/pages/show_post.html.erb +6 -0
  85. data/lib/railsbricks/auth_builder.rb +147 -0
  86. data/lib/railsbricks/config_helpers.rb +27 -0
  87. data/lib/railsbricks/config_values.rb +14 -0
  88. data/lib/railsbricks/errors.rb +18 -0
  89. data/lib/railsbricks/file_helpers.rb +54 -0
  90. data/lib/railsbricks/foundation/README.md +24 -0
  91. data/lib/railsbricks/foundation/Rakefile +6 -0
  92. data/lib/railsbricks/foundation/app/assets/images/.keep +0 -0
  93. data/lib/railsbricks/foundation/app/assets/images/apple-touch-icon-precomposed.png +0 -0
  94. data/lib/railsbricks/foundation/app/assets/images/apple-touch-icon.png +0 -0
  95. data/lib/railsbricks/foundation/app/assets/images/favicon.ico +0 -0
  96. data/lib/railsbricks/foundation/app/assets/javascripts/application.js +17 -0
  97. data/lib/railsbricks/foundation/app/assets/javascripts/common.js +7 -0
  98. data/lib/railsbricks/foundation/app/controllers/application_controller.rb +5 -0
  99. data/lib/railsbricks/foundation/app/controllers/concerns/.keep +0 -0
  100. data/lib/railsbricks/foundation/app/controllers/pages_controller.rb +7 -0
  101. data/lib/railsbricks/foundation/app/helpers/application_helper.rb +7 -0
  102. data/lib/railsbricks/foundation/app/helpers/email_helper.rb +5 -0
  103. data/lib/railsbricks/foundation/app/mailers/.keep +0 -0
  104. data/lib/railsbricks/foundation/app/models/.keep +0 -0
  105. data/lib/railsbricks/foundation/app/models/concerns/.keep +0 -0
  106. data/lib/railsbricks/foundation/app/views/layouts/_footer.html.erb +18 -0
  107. data/lib/railsbricks/foundation/app/views/layouts/_messages.html.erb +9 -0
  108. data/lib/railsbricks/foundation/app/views/layouts/_navigation.html.erb +18 -0
  109. data/lib/railsbricks/foundation/app/views/layouts/_navigation_links.html.erb +3 -0
  110. data/lib/railsbricks/foundation/app/views/layouts/application.html.erb +38 -0
  111. data/lib/railsbricks/foundation/app/views/pages/home.html.erb +2 -0
  112. data/lib/railsbricks/foundation/bin/bundle +3 -0
  113. data/lib/railsbricks/foundation/bin/rails +4 -0
  114. data/lib/railsbricks/foundation/bin/rake +4 -0
  115. data/lib/railsbricks/foundation/config.ru +4 -0
  116. data/lib/railsbricks/foundation/config/application.rb +34 -0
  117. data/lib/railsbricks/foundation/config/boot.rb +4 -0
  118. data/lib/railsbricks/foundation/config/environment.rb +5 -0
  119. data/lib/railsbricks/foundation/config/environments/development.rb +41 -0
  120. data/lib/railsbricks/foundation/config/environments/production.rb +95 -0
  121. data/lib/railsbricks/foundation/config/environments/test.rb +51 -0
  122. data/lib/railsbricks/foundation/config/initializers/backtrace_silencers.rb +7 -0
  123. data/lib/railsbricks/foundation/config/initializers/date_format.rb +27 -0
  124. data/lib/railsbricks/foundation/config/initializers/filter_parameter_logging.rb +4 -0
  125. data/lib/railsbricks/foundation/config/initializers/friendly_id.rb +88 -0
  126. data/lib/railsbricks/foundation/config/initializers/inflections.rb +16 -0
  127. data/lib/railsbricks/foundation/config/initializers/kaminari_config.rb +10 -0
  128. data/lib/railsbricks/foundation/config/initializers/mime_types.rb +5 -0
  129. data/lib/railsbricks/foundation/config/initializers/secret_token.rb +25 -0
  130. data/lib/railsbricks/foundation/config/initializers/session_store.rb +3 -0
  131. data/lib/railsbricks/foundation/config/initializers/wrap_parameters.rb +14 -0
  132. data/lib/railsbricks/foundation/config/locales/en.yml +23 -0
  133. data/lib/railsbricks/foundation/config/routes.rb +7 -0
  134. data/lib/railsbricks/foundation/db/migrate/20131103142222_create_friendly_id_slugs.rb +15 -0
  135. data/lib/railsbricks/foundation/db/schema.rb +29 -0
  136. data/lib/railsbricks/foundation/db/seeds.rb +0 -0
  137. data/lib/railsbricks/foundation/lib/assets/.keep +0 -0
  138. data/lib/railsbricks/foundation/lib/tasks/.keep +0 -0
  139. data/lib/railsbricks/foundation/public/404.html +58 -0
  140. data/lib/railsbricks/foundation/public/422.html +58 -0
  141. data/lib/railsbricks/foundation/public/500.html +57 -0
  142. data/lib/railsbricks/foundation/public/favicon.ico +0 -0
  143. data/lib/railsbricks/foundation/public/robots.txt +5 -0
  144. data/lib/railsbricks/foundation/vendor/assets/javascripts/.keep +0 -0
  145. data/lib/railsbricks/foundation/vendor/assets/stylesheets/.keep +0 -0
  146. data/lib/railsbricks/gemfile_builder.rb +118 -0
  147. data/lib/railsbricks/menu.rb +533 -0
  148. data/lib/railsbricks/post_builder.rb +103 -0
  149. data/lib/railsbricks/string_helpers.rb +39 -0
  150. data/lib/railsbricks/style_builder.rb +97 -0
  151. data/lib/railsbricks/ui_helpers.rb +11 -0
  152. data/lib/railsbricks/validator.rb +68 -0
  153. data/lib/railsbricks/version.rb +34 -0
  154. data/railsbricks.gemspec +16 -0
  155. metadata +198 -0
@@ -0,0 +1,103 @@
1
+ require "fileutils"
2
+ require_relative "ui_helpers"
3
+ require_relative "version"
4
+ require_relative "string_helpers"
5
+ require_relative "file_helpers"
6
+ require_relative "config_values"
7
+
8
+ module PostBuilder
9
+
10
+ def self.build_post(app_dir, options)
11
+ new_line(2)
12
+ wputs "----> Generating Post resources ...", :info
13
+
14
+ rbricks_dir = File.dirname(__FILE__)
15
+ add_string = ""
16
+
17
+ # Migration
18
+ FileUtils.cp_r(rbricks_dir + "/assets/migrations/20141010133702_create_posts.rb", app_dir + "/db/migrate")
19
+ wputs "--> Migration created."
20
+
21
+ # Markdown helper
22
+ FileUtils.cp_r(rbricks_dir + "/assets/lib/markdown_writer.rb", app_dir + "/lib")
23
+ wputs "--> MarkdownWriter helper created."
24
+
25
+ # Routes
26
+ FileHelpers.replace_string(/BRICK_POST_ROUTES/, FileHelpers.get_file(:brick_post_routes), app_dir + "/config/routes.rb")
27
+ FileHelpers.replace_string(/BRICK_ADMIN_POST_ROUTES/, FileHelpers.get_file(:brick_admin_post_routes), app_dir + "/config/routes.rb")
28
+ wputs "--> Routes updated."
29
+
30
+ # Views
31
+ FileUtils.cp_r(rbricks_dir + "/assets/views/pages/posts.html.erb", app_dir + "/app/views/pages")
32
+ FileUtils.cp_r(rbricks_dir + "/assets/views/pages/show_post.html.erb", app_dir + "/app/views/pages")
33
+ wputs "--> Views created."
34
+
35
+ # Pages controller
36
+ FileHelpers.replace_string(/BRICK_POSTS_CONTROLLER/, FileHelpers.get_file(:brick_posts_controller), app_dir + "/app/controllers/pages_controller.rb")
37
+ wputs "--> Pages controller updated."
38
+
39
+ # Navigation links
40
+ FileHelpers.replace_string(/BRICK_POSTS/, '<li><%= link_to "Posts", posts_path %></li>', app_dir + "/app/views/layouts/_navigation_links.html.erb")
41
+ wputs "--> Navigation links updated."
42
+
43
+ # Base controller
44
+ FileHelpers.replace_string(/BRICK_POST_COUNT/, '@post_count = Post.count', app_dir + "/app/controllers/admin/base_controller.rb")
45
+ wputs "--> Base controller updated."
46
+
47
+ # Admin views
48
+ FileHelpers.replace_string(/BRICK_POSTS_LINK/, FileHelpers.get_file(:brick_admin_posts_link), app_dir + "/app/views/admin/base/index.html.erb")
49
+ wputs "--> Admin view updated."
50
+
51
+ # Admin posts controller
52
+ FileUtils.cp_r(rbricks_dir + "/assets/controllers/admin/posts_controller.rb", app_dir + "/app/controllers/admin")
53
+ wputs "--> Admin posts controller created."
54
+
55
+ # Admin posts views
56
+ FileUtils.mkdir_p(app_dir + "/app/views/admin/posts")
57
+ FileUtils.cp_r(rbricks_dir + "/assets/views/admin/posts/.", app_dir + "/app/views/admin/posts")
58
+ wputs "--> Admin posts views created."
59
+
60
+ # Models
61
+ FileHelpers.replace_string(/BRICK_POSTS_RELATION/, "\n# Relations\nhas_many :posts\n", app_dir + "/app/models/user.rb")
62
+ FileUtils.cp_r(rbricks_dir + "/assets/models/post.rb", app_dir + "/app/models")
63
+ wputs "--> Models created and updated."
64
+
65
+ new_line
66
+ wputs "----> Post resources generated.", :info
67
+
68
+ rescue
69
+ Errors.display_error("Something went wrong and the post resources couldn't be generated. Stopping app creation.", true)
70
+ abort
71
+
72
+ end
73
+
74
+ def self.clean(app_dir)
75
+ # Routes
76
+ FileHelpers.replace_string(/BRICK_POST_ROUTES/, '', app_dir + "/config/routes.rb")
77
+ FileHelpers.replace_string(/BRICK_ADMIN_POST_ROUTES/, '', app_dir + "/config/routes.rb")
78
+ # Pages controller
79
+ FileHelpers.replace_string(/BRICK_POSTS_CONTROLLER/, '', app_dir + "/app/controllers/pages_controller.rb")
80
+ # Navigation links
81
+ FileHelpers.replace_string(/BRICK_POSTS/, '', app_dir + "/app/views/layouts/_navigation_links.html.erb")
82
+ # Base controller
83
+ FileHelpers.replace_string(/BRICK_POST_COUNT/, '', app_dir + "/app/controllers/admin/base_controller.rb")
84
+ # Admin views
85
+ FileHelpers.replace_string(/BRICK_POSTS_LINK/, '', app_dir + "/app/views/admin/base/index.html.erb")
86
+ # Models
87
+ FileHelpers.replace_string(/BRICK_POSTS_RELATION/, '', app_dir + "/app/models/user.rb")
88
+
89
+ rescue
90
+ Errors.display_error("Something went wrong and some clean up tasks couldn't be performed. Stopping app creation.", true)
91
+ abort
92
+
93
+ end
94
+
95
+ def self.wputs(text, highlight = :none)
96
+ StringHelpers.wputs(text, highlight)
97
+ end
98
+
99
+ def self.new_line(lines=1)
100
+ StringHelpers.new_line(lines)
101
+ end
102
+
103
+ end
@@ -0,0 +1,39 @@
1
+ require_relative "ui_helpers"
2
+
3
+ module StringHelpers
4
+
5
+ # replaces special characters with '_'
6
+ def self.sanitize(value)
7
+ value.tr('^A-Za-z0-9', '_')
8
+ end
9
+
10
+ # simply displays empty lines
11
+ def self.new_line(lines=1)
12
+ lines.times { puts }
13
+ end
14
+
15
+ # convert a string to a valid Rails app name
16
+ def self.convert_to_app_name(value)
17
+ if value.scan(/\_|\-/).size > 0
18
+ value.split(/\_|\-/).map(&:capitalize).join
19
+ else
20
+ value.slice(0,1).capitalize + value.slice(1..-1)
21
+ end
22
+ end
23
+
24
+ # Wraps output text at 79 columns.
25
+ # Outputs in green if highlight = :info / red if :error / blue if :help
26
+ def self.wputs(text, highlight = :none)
27
+ text = text.gsub(/\n/, ' ').gsub(/(.{1,#{79}})(\s+|$)/, "\\1\n").strip
28
+ if highlight == :info
29
+ puts UiHelpers.colorize(text, UiHelpers::GREEN)
30
+ elsif highlight == :error
31
+ puts UiHelpers.colorize(text, UiHelpers::RED)
32
+ elsif highlight == :help
33
+ puts UiHelpers.colorize(text, UiHelpers::BLUE)
34
+ else
35
+ puts text
36
+ end
37
+ end
38
+
39
+ end
@@ -0,0 +1,97 @@
1
+ require "fileutils"
2
+ require_relative "ui_helpers"
3
+ require_relative "version"
4
+ require_relative "string_helpers"
5
+ require_relative "file_helpers"
6
+ require_relative "config_values"
7
+
8
+ module StyleBuilder
9
+
10
+ def self.build_style(app_dir, options)
11
+ new_line(2)
12
+ wputs "----> Generating stylesheets ...", :info
13
+
14
+ rbricks_dir = File.dirname(__FILE__)
15
+ add_style = ""
16
+
17
+ # Copy base stylesheets
18
+ FileUtils.cp_r(rbricks_dir + "/assets/stylesheets/.", app_dir + "/app/assets/stylesheets")
19
+
20
+ # Theme background
21
+ if options[:ui][:theme_background] == "light"
22
+ FileHelpers.replace_string(/BRICK_BODY_COLOR/, "#ffffff", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
23
+ FileHelpers.replace_string(/BRICK_TEXT_COLOR/, "#373737", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
24
+ FileHelpers.replace_string(/BRICK_HEADINGS_SMALL_COLOR/, "#bbbbbb", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
25
+ else
26
+ FileHelpers.replace_string(/BRICK_BODY_COLOR/, "#2b2b2b", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
27
+ FileHelpers.replace_string(/BRICK_TEXT_COLOR/, "#eeeeee", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
28
+ FileHelpers.replace_string(/BRICK_HEADINGS_SMALL_COLOR/, "#cccccc", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
29
+ end
30
+
31
+ # Theme navbar
32
+ if options[:ui][:theme_navbar] == "dark"
33
+ FileHelpers.replace_string(/BRICK_NAVBAR_COLOR/, "navbar-inverse", app_dir + "/app/views/layouts/_navigation.html.erb")
34
+ else
35
+ FileHelpers.replace_string(/BRICK_NAVBAR_COLOR/, "navbar-default", app_dir + "/app/views/layouts/_navigation.html.erb")
36
+ end
37
+
38
+ # Theme footer
39
+ if options[:ui][:theme_footer] == "dark"
40
+ FileHelpers.replace_string(/BRICK_FOOTER_BACKGROUND_COLOR/, "#222222", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
41
+ FileHelpers.replace_string(/BRICK_FOOTER_COLOR/, "#eeeeee", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
42
+ else
43
+ FileHelpers.replace_string(/BRICK_FOOTER_BACKGROUND_COLOR/, "#ffffff", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
44
+ FileHelpers.replace_string(/BRICK_FOOTER_COLOR/, "#373737", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
45
+ end
46
+
47
+ # Brand color
48
+ FileHelpers.replace_string(/BRICK_BRAND_COLOR/, "#{options[:ui][:color]}", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
49
+
50
+ # Font
51
+ if options[:ui][:font] == "arial"
52
+ FileHelpers.replace_string(/BRICK_FONT_IMPORT/, "// Import fonts with: @import url(http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,700);", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
53
+ FileHelpers.replace_string(/BRICK_FONT_SANS_SERIF/, "Arial, Helvetica, sans-serif", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
54
+ FileHelpers.replace_string(/BRICK_FONT_SERIF/, "Georgia, 'Times New Roman', Times, serif", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
55
+ FileHelpers.replace_string(/BRICK_FONT_MONOSPACE/, "'Menlo','Monaco','Consolas','Courier New', monospace", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
56
+ FileHelpers.replace_string(/BRICK_FONT_BASE/, "$font-family-sans-serif", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
57
+
58
+ elsif options[:ui][:font] == "gentium"
59
+ FileHelpers.replace_string(/BRICK_FONT_IMPORT/, "@import url(http://fonts.googleapis.com/css?family=Gentium+Basic:400,700,400italic,700italic);", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
60
+ FileHelpers.replace_string(/BRICK_FONT_SANS_SERIF/, "Arial, Helvetica, sans-serif", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
61
+ FileHelpers.replace_string(/BRICK_FONT_SERIF/, "'Gentium Basic', Times New Roman, serif", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
62
+ FileHelpers.replace_string(/BRICK_FONT_MONOSPACE/, "'Menlo','Monaco','Consolas','Courier New', monospace", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
63
+ FileHelpers.replace_string(/BRICK_FONT_BASE/, "$font-family-serif", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
64
+
65
+ elsif options[:ui][:font] == "anonymous"
66
+ FileHelpers.replace_string(/BRICK_FONT_IMPORT/, "@import url(http://fonts.googleapis.com/css?family=Anonymous+Pro:400,400italic,700,700italic);", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
67
+ FileHelpers.replace_string(/BRICK_FONT_SANS_SERIF/, "Arial, Helvetica, sans-serif", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
68
+ FileHelpers.replace_string(/BRICK_FONT_SERIF/, "Georgia, 'Times New Roman', Times, serif", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
69
+ FileHelpers.replace_string(/BRICK_FONT_MONOSPACE/, "'Anonymous Pro', Courier New, monospace", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
70
+ FileHelpers.replace_string(/BRICK_FONT_BASE/, "$font-family-monospace", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
71
+
72
+ else
73
+ FileHelpers.replace_string(/BRICK_FONT_IMPORT/, "@import url(http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700);", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
74
+ FileHelpers.replace_string(/BRICK_FONT_SANS_SERIF/, "'Open Sans', Helvetica, Arial, sans-serif", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
75
+ FileHelpers.replace_string(/BRICK_FONT_SERIF/, "Georgia, 'Times New Roman', Times, serif", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
76
+ FileHelpers.replace_string(/BRICK_FONT_MONOSPACE/, "'Menlo','Monaco','Consolas','Courier New', monospace", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
77
+ FileHelpers.replace_string(/BRICK_FONT_BASE/, "$font-family-sans-serif", app_dir + "/app/assets/stylesheets/railsbricks_custom.scss")
78
+ end
79
+
80
+ new_line
81
+ wputs "----> Stylesheets generated.", :info
82
+
83
+ rescue
84
+ Errors.display_error("Something went wrong and the stylesheets couldn't be generated. Stopping app creation.", true)
85
+ abort
86
+
87
+ end
88
+
89
+ def self.wputs(text, highlight = :none)
90
+ StringHelpers.wputs(text, highlight)
91
+ end
92
+
93
+ def self.new_line(lines=1)
94
+ StringHelpers.new_line(lines)
95
+ end
96
+
97
+ end
@@ -0,0 +1,11 @@
1
+ module UiHelpers
2
+
3
+ RED = 31
4
+ GREEN = 32
5
+ BLUE = 36
6
+
7
+ def self.colorize(text, color_code)
8
+ "\e[#{color_code}m#{text}\e[0m"
9
+ end
10
+
11
+ end
@@ -0,0 +1,68 @@
1
+ # TODO: finish the Validator class and use it!
2
+ require_relative "ui_helpers"
3
+ require_relative "version"
4
+ require_relative "string_helpers"
5
+
6
+
7
+ class Validator
8
+
9
+ attr_accessor :log
10
+
11
+ def initialize(options = {})
12
+ @log = []
13
+ @options = options
14
+ end
15
+
16
+ def validate(validate = :script, abort_on_error = true)
17
+ add_error("RailsBricks version not set") if @options[:railsbricks_version].to_s == ''
18
+ add_error("Rails version not set") if @options[:rails_version].to_s == ''
19
+ add_error("App name not set") if @options[:app_name].to_s == ''
20
+ add_error("Rails app name not set") if @options[:rails_app_name].to_s == ''
21
+ add_error("Ruby version not set") if @options[:ruby_version].to_s == ''
22
+ add_error("Gem command not set") if @options[:gem_command].to_s == ''
23
+ add_error("Rake command not set") if @options[:rake_command].to_s == ''
24
+ add_error("Database engine not set") if @options[:development_db].to_s == ''
25
+
26
+ if @options[:development_db].to_s == "postgresql"
27
+ add_error("PostgreSQL server not set") if @options[:db_config][:server].to_s == ''
28
+ add_error("PostgreSQL port not set") if @options[:db_config][:port].to_s == ''
29
+ add_error("PostgreSQL database name not set") if @options[:db_config][:name].to_s == ''
30
+ add_error("PostgreSQL username not set") if @options[:db_config][:username].to_s == ''
31
+ end
32
+
33
+ add_error("Local Git option not set") if @options[:local_git].nil?
34
+ add_error("Remote Git option not set") if @options[:remote_git].nil?
35
+
36
+ if @options[:remote_git]
37
+ add_error("Remote Git URL not set") if @options[:git_url].to_s == ''
38
+ end
39
+
40
+ add_error("Devise option not set") if @options[:devise].nil?
41
+
42
+ if @options[:devise]
43
+
44
+ end
45
+
46
+ end
47
+
48
+ # Shortcut/alias methods
49
+
50
+ private
51
+
52
+ def add_error(msg = "")
53
+ if msg.to_s == ''
54
+ @log << "Unspecified error found"
55
+ else
56
+ @log << "Error: #{msg}"
57
+ end
58
+ end
59
+
60
+ def wputs(text, highlight = :none)
61
+ StringHelpers.wputs(text, highlight)
62
+ end
63
+
64
+ def new_line(lines=1)
65
+ StringHelpers.new_line(lines)
66
+ end
67
+
68
+ end
@@ -0,0 +1,34 @@
1
+ module Version
2
+
3
+ MAJOR = 3
4
+ MINOR = 2
5
+ PATCH = 6
6
+ PRE = nil
7
+
8
+ YEAR = "2015"
9
+ MONTH = "06"
10
+ DAY = "27"
11
+
12
+ def self.to_s
13
+ [MAJOR, MINOR, PATCH, PRE].compact.join(".")
14
+ end
15
+
16
+ def self.current
17
+ to_s
18
+ end
19
+
20
+ def self.current_date
21
+ "#{YEAR}-#{MONTH}-#{DAY}"
22
+ end
23
+
24
+ def self.version_to_h(version)
25
+ version_array = version.split(/\./)
26
+ version_hash = {}
27
+ version_hash[:major] = version_array[0]
28
+ version_hash[:minor] = version_array[1]
29
+ version_hash[:patch] = version_array[2]
30
+ version_hash[:pre] = version_array[3]
31
+ version_hash
32
+ end
33
+
34
+ end
@@ -0,0 +1,16 @@
1
+ require "./lib/railsbricks/version"
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = 'phoenixbricks'
5
+ s.version = Version.current
6
+ s.required_ruby_version = '>= 2.0'
7
+ s.executables << 'rbricks'
8
+ s.date = Version.current_date
9
+ s.summary = "Create Rails apps. Faster."
10
+ s.description = "RailsBricks enables you to create Rails apps much faster by automating mundane setup tasks and configuring useful common gems for you. "
11
+ s.authors = ["Nico Schuele"]
12
+ s.email = 'nicoschuele@gmail.com'
13
+ s.files = `git ls-files`.split($/)
14
+ s.homepage = 'http://www.railsbricks.net'
15
+ s.license = 'GNU GPL-3'
16
+ end
metadata ADDED
@@ -0,0 +1,198 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: phoenixbricks
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.2.6
5
+ platform: ruby
6
+ authors:
7
+ - Nico Schuele
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-27 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: 'RailsBricks enables you to create Rails apps much faster by automating
14
+ mundane setup tasks and configuring useful common gems for you. '
15
+ email: nicoschuele@gmail.com
16
+ executables:
17
+ - rbricks
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - ".gitignore"
22
+ - Gemfile
23
+ - LICENSE.txt
24
+ - README.md
25
+ - bin/rbricks
26
+ - lib/railsbricks.rb
27
+ - lib/railsbricks/app_generator.rb
28
+ - lib/railsbricks/assets/config/admin_post_routes.rbr
29
+ - lib/railsbricks/assets/config/application.yml
30
+ - lib/railsbricks/assets/config/contact_routes.rbr
31
+ - lib/railsbricks/assets/config/initializers/devise_email/devise.rb
32
+ - lib/railsbricks/assets/config/initializers/devise_username/devise.rb
33
+ - lib/railsbricks/assets/config/post_routes.rbr
34
+ - lib/railsbricks/assets/config/routes.rb
35
+ - lib/railsbricks/assets/config/unicorn.rb
36
+ - lib/railsbricks/assets/controllers/admin/base_controller.rb
37
+ - lib/railsbricks/assets/controllers/admin/devise_email/users_controller.rb
38
+ - lib/railsbricks/assets/controllers/admin/devise_username/users_controller.rb
39
+ - lib/railsbricks/assets/controllers/admin/posts_controller.rb
40
+ - lib/railsbricks/assets/controllers/brick_contact.rbr
41
+ - lib/railsbricks/assets/controllers/devise_email/application_controller.rb
42
+ - lib/railsbricks/assets/controllers/devise_username/application_controller.rb
43
+ - lib/railsbricks/assets/controllers/pages_controller.rb
44
+ - lib/railsbricks/assets/controllers/posts_controller.rbr
45
+ - lib/railsbricks/assets/database/postgresql.yml
46
+ - lib/railsbricks/assets/database/sqlite3.yml
47
+ - lib/railsbricks/assets/gemfile/Gemfile
48
+ - lib/railsbricks/assets/git/gitignore
49
+ - lib/railsbricks/assets/javascripts/analytics.js.coffee
50
+ - lib/railsbricks/assets/lib/markdown_writer.rb
51
+ - lib/railsbricks/assets/mailers/contact_mailer.rb
52
+ - lib/railsbricks/assets/migrations/20141010133702_create_posts.rb
53
+ - lib/railsbricks/assets/migrations/devise_email/20141010133701_devise_create_users.rb
54
+ - lib/railsbricks/assets/migrations/devise_username/20141010133701_devise_create_users.rb
55
+ - lib/railsbricks/assets/models/devise_email/user.rb
56
+ - lib/railsbricks/assets/models/devise_username/user.rb
57
+ - lib/railsbricks/assets/models/post.rb
58
+ - lib/railsbricks/assets/procfile/Procfile
59
+ - lib/railsbricks/assets/seeds/devise_email/seeds_no_test_users.rb
60
+ - lib/railsbricks/assets/seeds/devise_email/seeds_test_users.rb
61
+ - lib/railsbricks/assets/seeds/devise_username/seeds_no_test_users.rb
62
+ - lib/railsbricks/assets/seeds/devise_username/seeds_test_users.rb
63
+ - lib/railsbricks/assets/stylesheets/application.scss
64
+ - lib/railsbricks/assets/stylesheets/railsbricks_custom.scss
65
+ - lib/railsbricks/assets/views/admin/base/admin_posts_link.rbr
66
+ - lib/railsbricks/assets/views/admin/base/devise_email/index.html.erb
67
+ - lib/railsbricks/assets/views/admin/base/devise_username/index.html.erb
68
+ - lib/railsbricks/assets/views/admin/posts/_form.html.erb
69
+ - lib/railsbricks/assets/views/admin/posts/dashboard.html.erb
70
+ - lib/railsbricks/assets/views/admin/posts/drafts.html.erb
71
+ - lib/railsbricks/assets/views/admin/posts/edit.html.erb
72
+ - lib/railsbricks/assets/views/admin/posts/index.html.erb
73
+ - lib/railsbricks/assets/views/admin/posts/new.html.erb
74
+ - lib/railsbricks/assets/views/admin/users/devise_email/edit.html.erb
75
+ - lib/railsbricks/assets/views/admin/users/devise_email/index.html.erb
76
+ - lib/railsbricks/assets/views/admin/users/devise_username/edit.html.erb
77
+ - lib/railsbricks/assets/views/admin/users/devise_username/index.html.erb
78
+ - lib/railsbricks/assets/views/contact_mailer/contact_message.html.erb
79
+ - lib/railsbricks/assets/views/devise/allow_signup_links.rbr
80
+ - lib/railsbricks/assets/views/devise/devise_email/confirmations/new.html.erb
81
+ - lib/railsbricks/assets/views/devise/devise_email/mailer/confirmation_instructions.html.erb
82
+ - lib/railsbricks/assets/views/devise/devise_email/mailer/reset_password_instructions.html.erb
83
+ - lib/railsbricks/assets/views/devise/devise_email/passwords/edit.html.erb
84
+ - lib/railsbricks/assets/views/devise/devise_email/passwords/new.html.erb
85
+ - lib/railsbricks/assets/views/devise/devise_email/registrations/edit.html.erb
86
+ - lib/railsbricks/assets/views/devise/devise_email/registrations/new.html.erb
87
+ - lib/railsbricks/assets/views/devise/devise_email/sessions/new.html.erb
88
+ - lib/railsbricks/assets/views/devise/devise_email/shared/_links.erb
89
+ - lib/railsbricks/assets/views/devise/devise_username/confirmations/new.html.erb
90
+ - lib/railsbricks/assets/views/devise/devise_username/mailer/confirmation_instructions.html.erb
91
+ - lib/railsbricks/assets/views/devise/devise_username/mailer/reset_password_instructions.html.erb
92
+ - lib/railsbricks/assets/views/devise/devise_username/passwords/edit.html.erb
93
+ - lib/railsbricks/assets/views/devise/devise_username/passwords/new.html.erb
94
+ - lib/railsbricks/assets/views/devise/devise_username/registrations/edit.html.erb
95
+ - lib/railsbricks/assets/views/devise/devise_username/registrations/new.html.erb
96
+ - lib/railsbricks/assets/views/devise/devise_username/sessions/new.html.erb
97
+ - lib/railsbricks/assets/views/devise/devise_username/shared/_links.erb
98
+ - lib/railsbricks/assets/views/layouts/_navigation_links.html.erb
99
+ - lib/railsbricks/assets/views/layouts/brick_analytics.rbr
100
+ - lib/railsbricks/assets/views/pages/contact.html.erb
101
+ - lib/railsbricks/assets/views/pages/inside.html.erb
102
+ - lib/railsbricks/assets/views/pages/posts.html.erb
103
+ - lib/railsbricks/assets/views/pages/show_post.html.erb
104
+ - lib/railsbricks/auth_builder.rb
105
+ - lib/railsbricks/config_helpers.rb
106
+ - lib/railsbricks/config_values.rb
107
+ - lib/railsbricks/errors.rb
108
+ - lib/railsbricks/file_helpers.rb
109
+ - lib/railsbricks/foundation/README.md
110
+ - lib/railsbricks/foundation/Rakefile
111
+ - lib/railsbricks/foundation/app/assets/images/.keep
112
+ - lib/railsbricks/foundation/app/assets/images/apple-touch-icon-precomposed.png
113
+ - lib/railsbricks/foundation/app/assets/images/apple-touch-icon.png
114
+ - lib/railsbricks/foundation/app/assets/images/favicon.ico
115
+ - lib/railsbricks/foundation/app/assets/javascripts/application.js
116
+ - lib/railsbricks/foundation/app/assets/javascripts/common.js
117
+ - lib/railsbricks/foundation/app/controllers/application_controller.rb
118
+ - lib/railsbricks/foundation/app/controllers/concerns/.keep
119
+ - lib/railsbricks/foundation/app/controllers/pages_controller.rb
120
+ - lib/railsbricks/foundation/app/helpers/application_helper.rb
121
+ - lib/railsbricks/foundation/app/helpers/email_helper.rb
122
+ - lib/railsbricks/foundation/app/mailers/.keep
123
+ - lib/railsbricks/foundation/app/models/.keep
124
+ - lib/railsbricks/foundation/app/models/concerns/.keep
125
+ - lib/railsbricks/foundation/app/views/layouts/_footer.html.erb
126
+ - lib/railsbricks/foundation/app/views/layouts/_messages.html.erb
127
+ - lib/railsbricks/foundation/app/views/layouts/_navigation.html.erb
128
+ - lib/railsbricks/foundation/app/views/layouts/_navigation_links.html.erb
129
+ - lib/railsbricks/foundation/app/views/layouts/application.html.erb
130
+ - lib/railsbricks/foundation/app/views/pages/home.html.erb
131
+ - lib/railsbricks/foundation/bin/bundle
132
+ - lib/railsbricks/foundation/bin/rails
133
+ - lib/railsbricks/foundation/bin/rake
134
+ - lib/railsbricks/foundation/config.ru
135
+ - lib/railsbricks/foundation/config/application.rb
136
+ - lib/railsbricks/foundation/config/boot.rb
137
+ - lib/railsbricks/foundation/config/environment.rb
138
+ - lib/railsbricks/foundation/config/environments/development.rb
139
+ - lib/railsbricks/foundation/config/environments/production.rb
140
+ - lib/railsbricks/foundation/config/environments/test.rb
141
+ - lib/railsbricks/foundation/config/initializers/backtrace_silencers.rb
142
+ - lib/railsbricks/foundation/config/initializers/date_format.rb
143
+ - lib/railsbricks/foundation/config/initializers/filter_parameter_logging.rb
144
+ - lib/railsbricks/foundation/config/initializers/friendly_id.rb
145
+ - lib/railsbricks/foundation/config/initializers/inflections.rb
146
+ - lib/railsbricks/foundation/config/initializers/kaminari_config.rb
147
+ - lib/railsbricks/foundation/config/initializers/mime_types.rb
148
+ - lib/railsbricks/foundation/config/initializers/secret_token.rb
149
+ - lib/railsbricks/foundation/config/initializers/session_store.rb
150
+ - lib/railsbricks/foundation/config/initializers/wrap_parameters.rb
151
+ - lib/railsbricks/foundation/config/locales/en.yml
152
+ - lib/railsbricks/foundation/config/routes.rb
153
+ - lib/railsbricks/foundation/db/migrate/20131103142222_create_friendly_id_slugs.rb
154
+ - lib/railsbricks/foundation/db/schema.rb
155
+ - lib/railsbricks/foundation/db/seeds.rb
156
+ - lib/railsbricks/foundation/lib/assets/.keep
157
+ - lib/railsbricks/foundation/lib/tasks/.keep
158
+ - lib/railsbricks/foundation/public/404.html
159
+ - lib/railsbricks/foundation/public/422.html
160
+ - lib/railsbricks/foundation/public/500.html
161
+ - lib/railsbricks/foundation/public/favicon.ico
162
+ - lib/railsbricks/foundation/public/robots.txt
163
+ - lib/railsbricks/foundation/vendor/assets/javascripts/.keep
164
+ - lib/railsbricks/foundation/vendor/assets/stylesheets/.keep
165
+ - lib/railsbricks/gemfile_builder.rb
166
+ - lib/railsbricks/menu.rb
167
+ - lib/railsbricks/post_builder.rb
168
+ - lib/railsbricks/string_helpers.rb
169
+ - lib/railsbricks/style_builder.rb
170
+ - lib/railsbricks/ui_helpers.rb
171
+ - lib/railsbricks/validator.rb
172
+ - lib/railsbricks/version.rb
173
+ - railsbricks.gemspec
174
+ homepage: http://www.railsbricks.net
175
+ licenses:
176
+ - GNU GPL-3
177
+ metadata: {}
178
+ post_install_message:
179
+ rdoc_options: []
180
+ require_paths:
181
+ - lib
182
+ required_ruby_version: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: '2.0'
187
+ required_rubygems_version: !ruby/object:Gem::Requirement
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ version: '0'
192
+ requirements: []
193
+ rubyforge_project:
194
+ rubygems_version: 2.4.8
195
+ signing_key:
196
+ specification_version: 4
197
+ summary: Create Rails apps. Faster.
198
+ test_files: []