website_builder_engine 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. data/.gitignore +6 -0
  2. data/Gemfile +20 -0
  3. data/Gemfile.lock +173 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.textile +260 -0
  6. data/Rakefile +26 -0
  7. data/app/assets/images/website_builder_engine/.gitkeep +0 -0
  8. data/app/assets/javascripts/website_builder_engine/application.js +9 -0
  9. data/app/assets/javascripts/website_builder_engine/articles.js.coffee +3 -0
  10. data/app/assets/javascripts/website_builder_engine/home.js.coffee +3 -0
  11. data/app/assets/javascripts/website_builder_engine/jqueryui.js +406 -0
  12. data/app/assets/javascripts/website_builder_engine/modernizr.js +4 -0
  13. data/app/assets/javascripts/website_builder_engine/offerpages.js.coffee +3 -0
  14. data/app/assets/javascripts/website_builder_engine/respond.js +2 -0
  15. data/app/assets/javascripts/website_builder_engine/settings.js.coffee +3 -0
  16. data/app/assets/javascripts/website_builder_engine/tabs.js +41 -0
  17. data/app/assets/stylesheets/website_builder_engine/application.css +33 -0
  18. data/app/assets/stylesheets/website_builder_engine/articles.css.scss +87 -0
  19. data/app/assets/stylesheets/website_builder_engine/base.css.scss +336 -0
  20. data/app/assets/stylesheets/website_builder_engine/home.css.scss +7 -0
  21. data/app/assets/stylesheets/website_builder_engine/layout.css.scss +64 -0
  22. data/app/assets/stylesheets/website_builder_engine/normalize.css.scss +413 -0
  23. data/app/assets/stylesheets/website_builder_engine/offerpages.css.scss +232 -0
  24. data/app/assets/stylesheets/website_builder_engine/scaffolds.css.scss +56 -0
  25. data/app/assets/stylesheets/website_builder_engine/settings.css.scss +7 -0
  26. data/app/assets/stylesheets/website_builder_engine/skeleton.css.scss +237 -0
  27. data/app/controllers/website_builder_engine/application_controller.rb +5 -0
  28. data/app/controllers/website_builder_engine/articles_controller.rb +113 -0
  29. data/app/controllers/website_builder_engine/home_controller.rb +7 -0
  30. data/app/controllers/website_builder_engine/offerpages_controller.rb +98 -0
  31. data/app/controllers/website_builder_engine/settings_controller.rb +85 -0
  32. data/app/helpers/website_builder_engine/application_helper.rb +4 -0
  33. data/app/models/article.rb +13 -0
  34. data/app/models/offerpage.rb +15 -0
  35. data/app/models/setting.rb +13 -0
  36. data/app/views/layouts/website_builder_engine/application.html.haml +22 -0
  37. data/app/views/layouts/website_builder_engine/home.html.haml +24 -0
  38. data/app/views/shared/_navigation.html.haml +3 -0
  39. data/app/views/website_builder_engine/articles/_form.html.haml +47 -0
  40. data/app/views/website_builder_engine/articles/edit.html.haml +7 -0
  41. data/app/views/website_builder_engine/articles/index.html.haml +16 -0
  42. data/app/views/website_builder_engine/articles/new.html.haml +5 -0
  43. data/app/views/website_builder_engine/articles/publish.html.haml +7 -0
  44. data/app/views/website_builder_engine/articles/show.html.haml +36 -0
  45. data/app/views/website_builder_engine/articles/template.html.haml +72 -0
  46. data/app/views/website_builder_engine/home/index.html.haml +26 -0
  47. data/app/views/website_builder_engine/offerpages/_form.html.haml +49 -0
  48. data/app/views/website_builder_engine/offerpages/edit.html.haml +7 -0
  49. data/app/views/website_builder_engine/offerpages/index.html.haml +16 -0
  50. data/app/views/website_builder_engine/offerpages/new.html.haml +5 -0
  51. data/app/views/website_builder_engine/offerpages/publish.html.haml +7 -0
  52. data/app/views/website_builder_engine/offerpages/show.html.haml +37 -0
  53. data/app/views/website_builder_engine/offerpages/template.html.haml +71 -0
  54. data/app/views/website_builder_engine/settings/_form.html.haml +40 -0
  55. data/app/views/website_builder_engine/settings/edit.html.haml +7 -0
  56. data/app/views/website_builder_engine/settings/index.html.haml +19 -0
  57. data/app/views/website_builder_engine/settings/new.html.haml +5 -0
  58. data/app/views/website_builder_engine/settings/show.html.haml +34 -0
  59. data/app/views/website_builder_engine/welcome/template.html.haml +66 -0
  60. data/config/routes.rb +19 -0
  61. data/db/seeds.rb +68 -0
  62. data/lib/tasks/website_builder_engine_tasks.rake +4 -0
  63. data/lib/website_builder_engine.rb +4 -0
  64. data/lib/website_builder_engine/engine.rb +5 -0
  65. data/script/rails +6 -0
  66. data/spec/dummy/Rakefile +7 -0
  67. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  68. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  69. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  70. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  71. data/spec/dummy/app/mailers/.gitkeep +0 -0
  72. data/spec/dummy/app/models/.gitkeep +0 -0
  73. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  74. data/spec/dummy/config.ru +4 -0
  75. data/spec/dummy/config/application.rb +51 -0
  76. data/spec/dummy/config/boot.rb +10 -0
  77. data/spec/dummy/config/database.yml +25 -0
  78. data/spec/dummy/config/environment.rb +5 -0
  79. data/spec/dummy/config/environments/development.rb +27 -0
  80. data/spec/dummy/config/environments/production.rb +51 -0
  81. data/spec/dummy/config/environments/test.rb +39 -0
  82. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  83. data/spec/dummy/config/initializers/inflections.rb +10 -0
  84. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  85. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  86. data/spec/dummy/config/initializers/session_store.rb +8 -0
  87. data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
  88. data/spec/dummy/config/locales/en.yml +5 -0
  89. data/spec/dummy/config/mongoid.yml +20 -0
  90. data/spec/dummy/config/routes.rb +3 -0
  91. data/spec/dummy/db/seeds.rb +68 -0
  92. data/spec/dummy/lib/assets/.gitkeep +0 -0
  93. data/spec/dummy/log/.gitkeep +0 -0
  94. data/spec/dummy/public/404.html +26 -0
  95. data/spec/dummy/public/422.html +26 -0
  96. data/spec/dummy/public/500.html +26 -0
  97. data/spec/dummy/public/favicon.ico +0 -0
  98. data/spec/dummy/script/rails +6 -0
  99. data/spec/spec_helper.rb +41 -0
  100. data/version.rb +3 -0
  101. data/website_builder_engine.gemspec +31 -0
  102. metadata +381 -0
@@ -0,0 +1,6 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ spec/dummy/db/*.sqlite3
5
+ spec/dummy/log/*.log
6
+ spec/dummy/tmp/
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'rails', '3.1.0.rc5'
4
+ group :assets do
5
+ gem 'sass-rails', "~> 3.1.0.rc"
6
+ gem 'coffee-rails', "~> 3.1.0.rc"
7
+ gem 'uglifier'
8
+ end
9
+ gem 'jquery-rails'
10
+ gem "haml", ">= 3.1.2"
11
+ gem "haml-rails", ">= 0.3.4", :group => :development
12
+ gem "bson_ext", ">= 1.3.1"
13
+ gem "mongoid", ">= 2.1.5"
14
+ gem "frontend-helpers"
15
+ gem 'RedCloth'
16
+ gem 'bourbon'
17
+ gem 'html2textile', :git => 'git://github.com/jystewart/html2textile.git'
18
+
19
+ # Specify the gem's dependencies in website_builder_engine.gemspec
20
+ gemspec
@@ -0,0 +1,173 @@
1
+ GIT
2
+ remote: git://github.com/jystewart/html2textile.git
3
+ revision: dd83495eed4bc46fc12df09ffa163056b58269ca
4
+ specs:
5
+ html2textile (1.0.0.beta2)
6
+
7
+ PATH
8
+ remote: .
9
+ specs:
10
+ website_builder_engine (0.0.1)
11
+ RedCloth
12
+ bourbon
13
+ bson_ext
14
+ frontend-helpers
15
+ haml
16
+ html2textile
17
+ mongoid
18
+
19
+ GEM
20
+ remote: http://rubygems.org/
21
+ specs:
22
+ RedCloth (4.2.7)
23
+ actionmailer (3.1.0.rc5)
24
+ actionpack (= 3.1.0.rc5)
25
+ mail (~> 2.3.0)
26
+ actionpack (3.1.0.rc5)
27
+ activemodel (= 3.1.0.rc5)
28
+ activesupport (= 3.1.0.rc5)
29
+ builder (~> 3.0.0)
30
+ erubis (~> 2.7.0)
31
+ i18n (~> 0.6)
32
+ rack (~> 1.3.1)
33
+ rack-cache (~> 1.0.2)
34
+ rack-mount (~> 0.8.1)
35
+ rack-test (~> 0.6.0)
36
+ sprockets (~> 2.0.0.beta.12)
37
+ activemodel (3.1.0.rc5)
38
+ activesupport (= 3.1.0.rc5)
39
+ bcrypt-ruby (~> 2.1.4)
40
+ builder (~> 3.0.0)
41
+ i18n (~> 0.6)
42
+ activerecord (3.1.0.rc5)
43
+ activemodel (= 3.1.0.rc5)
44
+ activesupport (= 3.1.0.rc5)
45
+ arel (~> 2.1.4)
46
+ tzinfo (~> 0.3.29)
47
+ activeresource (3.1.0.rc5)
48
+ activemodel (= 3.1.0.rc5)
49
+ activesupport (= 3.1.0.rc5)
50
+ activesupport (3.1.0.rc5)
51
+ multi_json (~> 1.0)
52
+ arel (2.1.4)
53
+ bcrypt-ruby (2.1.4)
54
+ bourbon (0.1.3)
55
+ sass (>= 3.1)
56
+ bson (1.3.1)
57
+ bson_ext (1.3.1)
58
+ builder (3.0.0)
59
+ coffee-rails (3.1.0.rc.5)
60
+ actionpack (~> 3.1.0.rc1)
61
+ coffee-script (>= 2.2.0)
62
+ railties (~> 3.1.0.rc1)
63
+ sprockets (>= 2.0.0.beta.9)
64
+ coffee-script (2.2.0)
65
+ coffee-script-source
66
+ execjs
67
+ coffee-script-source (1.1.2)
68
+ diff-lcs (1.1.2)
69
+ erubis (2.7.0)
70
+ execjs (1.2.4)
71
+ multi_json (~> 1.0)
72
+ frontend-helpers (0.0.5)
73
+ haml-rails (~> 0.3.4)
74
+ rails (~> 3.1.0.rc4)
75
+ sass-rails (~> 3.1.0.rc)
76
+ sprockets (~> 2.0.0.beta.10)
77
+ haml (3.1.2)
78
+ haml-rails (0.3.4)
79
+ actionpack (~> 3.0)
80
+ activesupport (~> 3.0)
81
+ haml (~> 3.0)
82
+ railties (~> 3.0)
83
+ hike (1.2.0)
84
+ i18n (0.6.0)
85
+ jquery-rails (1.0.12)
86
+ railties (~> 3.0)
87
+ thor (~> 0.14)
88
+ mail (2.3.0)
89
+ i18n (>= 0.4.0)
90
+ mime-types (~> 1.16)
91
+ treetop (~> 1.4.8)
92
+ mime-types (1.16)
93
+ mongo (1.3.1)
94
+ bson (>= 1.3.1)
95
+ mongoid (2.1.5)
96
+ activemodel (~> 3.0)
97
+ mongo (~> 1.3)
98
+ tzinfo (~> 0.3.22)
99
+ multi_json (1.0.3)
100
+ polyglot (0.3.2)
101
+ rack (1.3.2)
102
+ rack-cache (1.0.2)
103
+ rack (>= 0.4)
104
+ rack-mount (0.8.1)
105
+ rack (>= 1.0.0)
106
+ rack-ssl (1.3.2)
107
+ rack
108
+ rack-test (0.6.1)
109
+ rack (>= 1.0)
110
+ rails (3.1.0.rc5)
111
+ actionmailer (= 3.1.0.rc5)
112
+ actionpack (= 3.1.0.rc5)
113
+ activerecord (= 3.1.0.rc5)
114
+ activeresource (= 3.1.0.rc5)
115
+ activesupport (= 3.1.0.rc5)
116
+ bundler (~> 1.0)
117
+ railties (= 3.1.0.rc5)
118
+ railties (3.1.0.rc5)
119
+ actionpack (= 3.1.0.rc5)
120
+ activesupport (= 3.1.0.rc5)
121
+ rack-ssl (~> 1.3.2)
122
+ rake (>= 0.8.7)
123
+ rdoc (~> 3.4)
124
+ thor (~> 0.14.6)
125
+ rake (0.9.2)
126
+ rdoc (3.9.1)
127
+ rspec (2.6.0)
128
+ rspec-core (~> 2.6.0)
129
+ rspec-expectations (~> 2.6.0)
130
+ rspec-mocks (~> 2.6.0)
131
+ rspec-core (2.6.4)
132
+ rspec-expectations (2.6.0)
133
+ diff-lcs (~> 1.1.2)
134
+ rspec-mocks (2.6.0)
135
+ sass (3.1.7)
136
+ sass-rails (3.1.0.rc.5)
137
+ actionpack (~> 3.1.0.rc1)
138
+ railties (~> 3.1.0.rc1)
139
+ sass (>= 3.1.4)
140
+ sprockets (>= 2.0.0.beta.9)
141
+ sprockets (2.0.0.beta.13)
142
+ hike (~> 1.2)
143
+ rack (~> 1.0)
144
+ tilt (!= 1.3.0, ~> 1.1)
145
+ thor (0.14.6)
146
+ tilt (1.3.2)
147
+ treetop (1.4.10)
148
+ polyglot
149
+ polyglot (>= 0.3.1)
150
+ tzinfo (0.3.29)
151
+ uglifier (1.0.0)
152
+ execjs (>= 0.3.0)
153
+ multi_json (>= 1.0.2)
154
+
155
+ PLATFORMS
156
+ ruby
157
+
158
+ DEPENDENCIES
159
+ RedCloth
160
+ bourbon
161
+ bson_ext (>= 1.3.1)
162
+ coffee-rails (~> 3.1.0.rc)
163
+ frontend-helpers
164
+ haml (>= 3.1.2)
165
+ haml-rails (>= 0.3.4)
166
+ html2textile!
167
+ jquery-rails
168
+ mongoid (>= 2.1.5)
169
+ rails (= 3.1.0.rc5)
170
+ rspec (~> 2.6)
171
+ sass-rails (~> 3.1.0.rc)
172
+ uglifier
173
+ website_builder_engine!
@@ -0,0 +1,20 @@
1
+ Copyright 2011 Daniel Kehoe
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,260 @@
1
+ h1. Website Builder Engine
2
+
3
+ Add this Rails 3.1 engine to any Rails 3.1 application and generate static HTML5 web pages. It creates a simple website suitable for a typical Internet marketing campaign, with a home page, a template page for an offer (for example, to sell a product or capture an email address), plus template pages for related articles.
4
+
5
+ Any issues? Please create a "GitHub issue":https://github.com/DanielKehoe/website_builder_engine/issues.
6
+
7
+ h2. Intended Use
8
+
9
+ The goal of this project is to streamline the process of producing a simple web "microsite."
10
+
11
+ It is suitable for experienced Rails developers who want a speedy way to produce simple web sites.
12
+
13
+ h4. For Simple Microsites
14
+
15
+ Web developers often are asked to produce a simple site composed of a home page, a few articles (for search engine optimization), plus a landing page for a product or service offer.
16
+
17
+ h4. For Free Hosting on Heroku
18
+
19
+ This engine can be added to any simple Rails application and hosted on Heroku for free.
20
+
21
+ h4. Copy, Paste, and Publish
22
+
23
+ Text for the web pages is entered into simple forms, saved into a database, "poured" into well-structured templates, and published as static HTML5 web pages.
24
+
25
+ h4. Requires Textile for Content Markup
26
+
27
+ Textile markup is required for content. Requiring Textile imposes consistency. Textile is easy for a writer to format in a text editor. HTML can be copied from existing sites and will be saved in the database as Textile (eliminating any inconsistent or substandard HTML markup).
28
+
29
+ h4. Easily Customized Web Pages
30
+
31
+ After publishing, generated web pages are saved as well-structured, standard HTML5 files. The generated files can be downloaded, customized as needed, and hosted anywhere. It's easier to edit a well-formed HTML file than to create it from scratch.
32
+
33
+ h2. Other Approaches
34
+
35
+ Web developers can build a simple microsite in HTML/CSS with a text editor or WYSIWYG editor. Or they can use Wordpress. This Rails engine offers an alternative for Rails developers who don't want to write raw HTML from scratch or use Wordpress.
36
+
37
+ h4. Versus Writing HTML From Scratch
38
+
39
+ * It is tedious to build a site from scratch using HTML
40
+ * It can be difficult to find an example of well-structured, clean, current HTML5 to use as a template
41
+
42
+ h4. An Alternative to Wordpress
43
+
44
+ * The engine uses a templating language that is familar to Rails developers (ERB or Haml)
45
+ * Generated code is well-structured HTML5 and easy to edit for customization
46
+ * A site be hosted for free on Heroku
47
+ * Static HTML5 files offer a faster site response
48
+ * Website versions can be saved to GitHub for Git-based version control
49
+
50
+ h2. Dependencies
51
+
52
+ Before running this app, you will need:
53
+
54
+ * The Ruby language (version 1.9.2)
55
+ ** @$ ruby -v@
56
+ * Rails 3.1
57
+ ** @$ rails -v@
58
+ * A working installation of "MongoDB":http://www.mongodb.org/ (version 1.6.0 or newer)
59
+
60
+ See "Installing Rails 3.1":http://railsapps.github.com/installing-rails-3-1.html and "Managing Rails Versions and Gems":http://railsapps.github.com/managing-rails-versions-gems.html for detailed instructions and advice.
61
+
62
+ h4. Installing MongoDB
63
+
64
+ If you don't have MongoDB installed on your computer, you'll need to install it and set it up to be always running on your computer (run at launch). On Mac OS X, the easiest way to install MongoDB is to install "Homebrew":http://mxcl.github.com/homebrew/ and then run the following:
65
+
66
+ <pre>
67
+ brew install mongodb
68
+ </pre>
69
+
70
+ Homebrew will provide post-installation instructions to get MongoDB running. The last line of the installation output shows you the MongoDB install location (for example, */usr/local/Cellar/mongodb/1.8.0-x86_64*). You'll find the MongoDB configuration file there. After an installation using Homebrew, the default data directory will be */usr/local/var/mongodb*.
71
+
72
+ h4. Your Parent Application
73
+
74
+ This gem provides an "app within an app" (a Rails engine). You must create your application and then add the Website Builder Engine to it. You may simply use the @rails new@ comand to create an application. For a full-featured and compatible starter app, I recommend creating an application using the application template supplied for the "RailsApps Rails3-Mongoid-Devise":https://github.com/RailsApps/rails3-mongoid-devise project. You can create a ready-to-use application with this command:
75
+
76
+ <pre>
77
+ $ rails new APP_NAME -m https://github.com/RailsApps/rails3-application-templates/raw/master/rails3-mongoid-devise-template.rb -T -O
78
+ </pre>
79
+
80
+ Use the -T -O flags to skip Test::Unit files and Active Record files. See the "Rails3-Mongoid-Devise":https://github.com/RailsApps/rails3-mongoid-devise documentation for instructions.
81
+
82
+ h2. Gems
83
+
84
+ Add the Website Builder Engine gem to your application's Gemfile. You'll need several other gems as well.
85
+
86
+ <pre>
87
+ gem "website_builder_engine"
88
+ gem "frontend-helpers"
89
+ gem 'RedCloth'
90
+ gem 'bourbon'
91
+ gem 'html2textile', :git => 'git://github.com/jystewart/html2textile.git'
92
+ </pre>
93
+
94
+ If you intend to deploy to Heroku, add:
95
+
96
+ <pre>
97
+ gem "thin", :group => :production
98
+ gem "heroku"
99
+ </pre>
100
+
101
+ See an example "Rails 3.1 Gemfile":http://railsapps.github.com/rails-3-1-example-gemfile.html.
102
+
103
+ h2. Install the Required Gems
104
+
105
+ Install the required gems on your computer:
106
+
107
+ @$ bundle install@
108
+
109
+ You can check which gems are installed on your computer with:
110
+
111
+ @$ gem list --local@
112
+
113
+ Keep in mind that you have installed these gems locally. When you deploy the app to another server, the same gems (and versions) must be available.
114
+
115
+ h2. Mount the Engine
116
+
117
+ If you don't restrict access, anyone can change the generated web pages if they know the administrative interface's URL.
118
+
119
+ The examples below make the website-building administrative interface available at "http://localhost:3000/builder":http://localhost:3000/builder but you can provide any path you'd like.
120
+
121
+ h4. Without Authentication (Not Recommended)
122
+
123
+ Install the engine in your application by adding to your *config/routes.rb* file:
124
+
125
+ <pre>
126
+ mount WebsiteBuilderEngine::Engine, :at => '/builder'
127
+ </pre>
128
+
129
+ h4. With Authentication (Using Devise)
130
+
131
+ If you application is using Devise for authentication, it is easy to restrict access to the engine's administrative interface using routes-based authentication:
132
+
133
+ <pre>
134
+ authenticate :user do
135
+ mount WebsiteBuilderEngine::Engine, :at => '/builder'
136
+ end
137
+ </pre>
138
+
139
+ If necessary, you can build your own routes-based authentication (but use Devise, it's easier).
140
+
141
+ h2. Add Stylesheet Files
142
+
143
+ This step should be implemented with a Rails generator. But it's not. So...
144
+
145
+ Copy the following files from the GitHub repository to the *app/assets/stylesheets* directory:
146
+
147
+ <pre>
148
+ $ cd app/assets/stylesheets
149
+ $ curl -o articles.css.scss https://raw.github.com/DanielKehoe/website_builder_engine/master/app/assets/stylesheets/website_builder_engine/articles.css.scss
150
+ $ curl -o offerpages.css.scss https://github.com/DanielKehoe/website_builder_engine/blob/master/app/assets/stylesheets/website_builder_engine/offerpages.css.scss
151
+ </pre>
152
+
153
+ h2. Initialize the Database
154
+
155
+ h4. Set Up a Database Seed File
156
+
157
+ If you are using Devise, you may want to set up a default user so you can easily log in to test the app. You may also want to add default data for the web pages you'll generate. You can see an example of a "default db/seeds.rb file":https://github.com/DanielKehoe/website_builder_engine/blob/master/db/seeds.rb.
158
+
159
+ h4. Seed the Database
160
+
161
+ Initialize the MongoDB database by running the command:
162
+
163
+ <pre>
164
+ $ rake db:seed
165
+ </pre>
166
+
167
+ h2. Test the App
168
+
169
+ You can check that your app runs properly by entering the command
170
+
171
+ <pre>
172
+ $ rails server
173
+ </pre>
174
+
175
+ To see the engine in action, open a browser window and navigate to "http://localhost:3000/builder":http://localhost:3000/builder.
176
+
177
+ h2. Usage
178
+
179
+ In its current form, the engine provides links to create "offer pages" and "articles".
180
+
181
+ For example, you can navigate to "http://localhost:3000/builder/articles/new":http://localhost:3000/builder/articles/new and enter data for a new article. Fields that are text areas can be populated with text in the "Textile":http://redcloth.org/textile/ markup format. Or you can enter HTML and the engine will downgrade it to Textile (useful if you are copying from an existing website).
182
+
183
+ After you save data for an article, you'll find a link you can use to "Publish" the article. Clicking "Publish" pours the data into an HTML5 template and saves the file as a static web page. After publishing, you can follow a link to the static web page to inspect the results.
184
+
185
+ Publishing any "article" page also generates a home page at "http://localhost:3000/index.html":http://localhost:3000/index.html.
186
+
187
+ h2. Customizing Web Pages
188
+
189
+ Published web pages are well-structured standard HTML5 files generated from template files that Rails can parse (either ERB or Haml templating languages).
190
+
191
+ h4. Modify a Stylesheet
192
+
193
+ You can modify the look and feel of the web pages by changing the corresponding CSS files:
194
+
195
+ * *app/assets/stylesheets/articles.css.scss*
196
+ * *app/assets/stylesheets/offerpages.css.scss*
197
+
198
+ h4. Modify a Template File
199
+
200
+ You change the structure of the files by overriding the engine's template files. Copy the originals from the GitHub repository:
201
+
202
+ <pre>
203
+ $ curl -o app/views/website_builder_engine/articles/template.html.haml https://github.com/DanielKehoe/website_builder_engine/blob/master/app/views/website_builder_engine/articles/template.html.haml
204
+ $ curl -o app/views/website_builder_engine/offerpages/template.html.haml https://github.com/DanielKehoe/website_builder_engine/blob/master/app/views/website_builder_engine/offerpages/template.html.haml
205
+ </pre>
206
+
207
+ Modify or replace the originals with templates of your own design.
208
+
209
+ h4. Create Additional Pages
210
+
211
+ In its current form, the engine only generates "offer pages" and "articles" (plus a home page). If you want other types of pages (for example, "about" or "contact"), you can fork the project. Make a pull request and I will add your additional pages to the gem.
212
+
213
+ You can use a forked vesion of the gem to publish pages locally. If you wish to deploy to Heroku, you'll need to publish (release) a new gem (or submit your contributions and I'll release a new version of this gem).
214
+
215
+ h2. Deploy to Heroku
216
+
217
+ For your convenience, here are "instructions for deploying your app to Heroku":http://railsapps.github.com/rails-heroku-tutorial.html. Heroku provides low cost, easily configured Rails application hosting.
218
+
219
+ h2. Issues
220
+
221
+ Please create an "issue on GitHub":https://github.com/DanielKehoe/website_builder_engine/issues if you identify any problems or have suggestions for improvements.
222
+
223
+ h2. Contributing
224
+
225
+ If you make improvements to this application, please share with others.
226
+
227
+ Send the author a message, create an "issue":https://github.com/DanielKehoe/website_builder_engine/issues, or fork the project and submit a pull request.
228
+
229
+ If you add functionality to this gem, create an alternative implementation, or release an gem that is similar, please contact me and I'll add a note to the README so that others can find your work.
230
+
231
+ h2. Credits
232
+
233
+ Daniel Kehoe ("http://danielkehoe.com/":http://danielkehoe.com/) implemented the gem.
234
+
235
+ Is the gem useful to you? Follow me on Twitter:
236
+ "@rails_apps":http://twitter.com/rails_apps
237
+ and tweet some praise. I'd love to know you were helped out by what I've put together.
238
+
239
+ h2. MIT License
240
+
241
+ Copyright 2011 Daniel Kehoe
242
+
243
+ Permission is hereby granted, free of charge, to any person obtaining
244
+ a copy of this software and associated documentation files (the
245
+ "Software"), to deal in the Software without restriction, including
246
+ without limitation the rights to use, copy, modify, merge, publish,
247
+ distribute, sublicense, and/or sell copies of the Software, and to
248
+ permit persons to whom the Software is furnished to do so, subject to
249
+ the following conditions:
250
+
251
+ The above copyright notice and this permission notice shall be
252
+ included in all copies or substantial portions of the Software.
253
+
254
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
255
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
256
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
257
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
258
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
259
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
260
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.