aura 0.0.1.pre10
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/.travis.yml +3 -0
- data/Gemfile +2 -0
- data/HISTORY.md +95 -0
- data/README.md +53 -0
- data/Rakefile +27 -0
- data/Scribefile +8 -0
- data/app/css/_utilities.scss +88 -0
- data/app/css/admin.scss +21 -0
- data/app/css/admin/_settings.scss +136 -0
- data/app/css/admin/chrome.scss +208 -0
- data/app/css/admin/common.scss +78 -0
- data/app/css/admin/forms.scss +342 -0
- data/app/css/admin/jquery_wysiwyg.scss +96 -0
- data/app/css/admin/loading.scss +18 -0
- data/app/css/admin/meta.scss +42 -0
- data/app/css/admin/reset.scss +46 -0
- data/app/css/admin/sections.scss +79 -0
- data/app/css/admin/setup.scss +22 -0
- data/app/css/admin/sidebar.scss +136 -0
- data/app/css/admin/slug.scss +78 -0
- data/app/css/admin/uiscreen.scss +22 -0
- data/app/css/admin/wysiwyg_field.scss +11 -0
- data/app/css/admin_watermark.scss +23 -0
- data/app/css/default_home_page.scss +13 -0
- data/app/css/login.scss +47 -0
- data/app/helpers/admin_helpers.rb +59 -0
- data/app/helpers/flash_helpers.rb +86 -0
- data/app/helpers/form_builder_helpers.rb +9 -0
- data/app/helpers/html_helpers.rb +27 -0
- data/app/helpers/jquery_helpers.rb +26 -0
- data/app/helpers/main_helpers.rb +67 -0
- data/app/helpers/page_helpers.rb +92 -0
- data/app/helpers/template_helpers.rb +94 -0
- data/app/helpers/user_helpers.rb +45 -0
- data/app/init/admin.rb +34 -0
- data/app/init/extensions.rb +18 -0
- data/app/init/pistol.rb +11 -0
- data/app/init/sequel.rb +11 -0
- data/app/main.rb +106 -0
- data/app/migrations/page.rb +29 -0
- data/app/migrations/settings.rb +11 -0
- data/app/migrations/user.rb +13 -0
- data/app/models/page.rb +116 -0
- data/app/models/page_seed.rb +47 -0
- data/app/models/settings.rb +59 -0
- data/app/models/user.rb +60 -0
- data/app/routes/admin.rb +44 -0
- data/app/routes/css_js.rb +53 -0
- data/app/routes/design_tests.rb +15 -0
- data/app/routes/editor.rb +152 -0
- data/app/routes/site.rb +33 -0
- data/app/routes/user.rb +48 -0
- data/app/views/admin/_back_to_dashboard.haml +3 -0
- data/app/views/admin/dashboard.haml +46 -0
- data/app/views/admin/layout.haml +73 -0
- data/app/views/admin/settings.haml +40 -0
- data/app/views/admin/settings/database.haml +42 -0
- data/app/views/base/crumbs.haml +50 -0
- data/app/views/base/delete.haml +19 -0
- data/app/views/base/edit.haml +61 -0
- data/app/views/base/errors.haml +10 -0
- data/app/views/base/form.haml +11 -0
- data/app/views/base/list.haml +14 -0
- data/app/views/base/list_actions.haml +4 -0
- data/app/views/base/list_item.haml +7 -0
- data/app/views/base/nav.haml +36 -0
- data/app/views/base/new.haml +36 -0
- data/app/views/base/preview.haml +28 -0
- data/app/views/base/tabs.haml +12 -0
- data/app/views/default_home_page.haml +15 -0
- data/app/views/design_tests/admin_styles.haml +58 -0
- data/app/views/form_builder/builder.haml +29 -0
- data/app/views/page/edit.haml +29 -0
- data/app/views/page/form.haml +22 -0
- data/app/views/page/meta_form.haml +22 -0
- data/app/views/page/new.haml +26 -0
- data/app/views/user/edit.haml +52 -0
- data/app/views/user/form.haml +43 -0
- data/app/views/user/list.haml +11 -0
- data/app/views/user/login.haml +33 -0
- data/app/views/user/new.haml +25 -0
- data/app/views/user/welcome.haml +29 -0
- data/app/views/watermark/watermark.haml +16 -0
- data/aura.gemspec +36 -0
- data/bin/aura +8 -0
- data/config/database.rb +12 -0
- data/config/extensions.rb +5 -0
- data/config/scss.rb +14 -0
- data/config/user.rb +10 -0
- data/default/.gitignore +6 -0
- data/default/Gemfile +11 -0
- data/default/README.md +24 -0
- data/default/Rakefile +8 -0
- data/default/app/README +3 -0
- data/default/app/css/.gitignore +0 -0
- data/default/app/helpers/helpers.rb.example +9 -0
- data/default/app/js/.gitignore +0 -0
- data/default/app/migrations/model.rb.example +20 -0
- data/default/app/models/model.rb.example +11 -0
- data/default/app/models/page-ext.rb.example +17 -0
- data/default/app/routes/site.rb.example +5 -0
- data/default/app/views/hello.haml.example +1 -0
- data/default/config.ru +3 -0
- data/default/config/.gitignore +0 -0
- data/default/config/database.rb.example +30 -0
- data/default/config/extensions.rb +5 -0
- data/default/config/user.rb.example +10 -0
- data/default/db/.gitignore +0 -0
- data/default/init.rb +15 -0
- data/default/public/.gitignore +0 -0
- data/extensions/contact_form/migrations/contact_form.rb +13 -0
- data/extensions/contact_form/models/contact_form.rb +13 -0
- data/extensions/contact_form/routes/contact_form.rb +11 -0
- data/extensions/contact_form/views/contact_form/edit.haml +8 -0
- data/extensions/contact_form/views/contact_form/form.haml +3 -0
- data/extensions/contact_form/views/contact_form/nav.haml +42 -0
- data/extensions/contact_form/views/contact_form/responses.haml +20 -0
- data/extensions/contact_form/views/contact_form/tabs.haml +8 -0
- data/extensions/default_theme/css/theme/_settings.scss +3 -0
- data/extensions/default_theme/css/theme/chrome.scss +66 -0
- data/extensions/default_theme/css/theme/reset.scss +34 -0
- data/extensions/default_theme/css/theme/style.scss +3 -0
- data/extensions/default_theme/info.yml +2 -0
- data/extensions/default_theme/public/browse.png +0 -0
- data/extensions/default_theme/views/base/id_portfolio.haml +32 -0
- data/extensions/default_theme/views/base/show.haml +31 -0
- data/extensions/default_theme/views/errors/error.haml +9 -0
- data/extensions/default_theme/views/errors/not_found.haml +11 -0
- data/extensions/default_theme/views/layout.haml +33 -0
- data/lib/aura.rb +315 -0
- data/lib/aura/admin.rb +41 -0
- data/lib/aura/app.rb +4 -0
- data/lib/aura/cli.rb +19 -0
- data/lib/aura/cli/base.rb +89 -0
- data/lib/aura/cli/helpers.rb +32 -0
- data/lib/aura/editor.rb +30 -0
- data/lib/aura/extension.rb +189 -0
- data/lib/aura/files.rb +38 -0
- data/lib/aura/menu.rb +142 -0
- data/lib/aura/models.rb +80 -0
- data/lib/aura/public.rb +68 -0
- data/lib/aura/rendering.rb +134 -0
- data/lib/aura/seeder.rb +38 -0
- data/lib/aura/slugs.rb +87 -0
- data/lib/aura/subtype.rb +48 -0
- data/lib/aura/tasks.rb +24 -0
- data/lib/aura/tasks/common.rb +17 -0
- data/lib/aura/tasks/db.rake +54 -0
- data/lib/aura/utils.rb +81 -0
- data/lib/aura/version.rb +25 -0
- data/lib/core/hasharray.rb +65 -0
- data/lib/core/object_ext.rb +9 -0
- data/lib/sequel/plugins/aura_custom.rb +16 -0
- data/lib/sequel/plugins/aura_editable.rb +39 -0
- data/lib/sequel/plugins/aura_hierarchy.rb +82 -0
- data/lib/sequel/plugins/aura_model.rb +271 -0
- data/lib/sequel/plugins/aura_renderable.rb +42 -0
- data/lib/sequel/plugins/aura_sluggable.rb +103 -0
- data/lib/sequel/plugins/aura_subtyped.rb +83 -0
- data/lib/terra.rb +185 -0
- data/lib/terra/ext.rb +16 -0
- data/lib/terra/field.rb +98 -0
- data/lib/terra/fields.rb +122 -0
- data/lib/terra/fieldset.rb +93 -0
- data/lib/terra/form.rb +111 -0
- data/manual/configuration.md +42 -0
- data/manual/extensions.md +45 -0
- data/manual/files.md +70 -0
- data/manual/helpers.md +39 -0
- data/manual/index.md +65 -0
- data/manual/models.md +58 -0
- data/manual/recipes.md +38 -0
- data/manual/recipes/bundling_sample_data.md +30 -0
- data/manual/recipes/creating_themes.md +10 -0
- data/manual/recipes/using_markdown_or_textile.md +24 -0
- data/manual/routes.md +39 -0
- data/manual/theming.md +55 -0
- data/manual/views.md +128 -0
- data/public/hi.html +0 -0
- data/public/images/admin/back.png +0 -0
- data/public/images/admin/browse.png +0 -0
- data/public/images/admin/mock-bg.png +0 -0
- data/public/images/admin/top-loader.gif +0 -0
- data/public/images/admin/uiscreen-loader.gif +0 -0
- data/public/images/admin_icons/add.png +0 -0
- data/public/images/admin_icons/contact.png +0 -0
- data/public/images/admin_icons/dashboard.png +0 -0
- data/public/images/admin_icons/generic.png +0 -0
- data/public/images/admin_icons/home-12.png +0 -0
- data/public/images/admin_icons/page.png +0 -0
- data/public/images/admin_icons/settings.png +0 -0
- data/public/images/jquery.wysiwyg.gif +0 -0
- data/public/js/admin.form_builder.js +15 -0
- data/public/js/admin.js +62 -0
- data/public/js/admin.layout.js +53 -0
- data/public/js/admin.nav.js +241 -0
- data/public/js/admin.slug.js +46 -0
- data/public/js/admin.subpage.js +15 -0
- data/public/js/jquery.hashlisten.js +85 -0
- data/public/js/jquery.js +166 -0
- data/public/js/jquery.livenavigate.js +58 -0
- data/public/js/jquery.livequery.js +226 -0
- data/public/js/jquery.quickvalidate.js +164 -0
- data/public/js/jquery.tmpl.js +486 -0
- data/public/js/jquery.uiscreen.js +150 -0
- data/public/js/jquery.wysiwyg.js +2339 -0
- data/public/js/jqueryui.js +766 -0
- data/public/js/lib.dirty.js +11 -0
- data/public/js/lib.loading.js +23 -0
- data/public/js/lib.wysiwyg.js +155 -0
- data/public/js/underscore-1.1.7.js +27 -0
- data/test/app/app/css/test_raw.css +1 -0
- data/test/app/app/css/test_sass.sass +3 -0
- data/test/app/app/damogram.txt +1 -0
- data/test/app/app/js/test_coffee.coffee +4 -0
- data/test/app/app/js/test_javascript.js +4 -0
- data/test/app/init.rb +5 -0
- data/test/stories/admin_css_story.rb +18 -0
- data/test/stories/css_js_story.rb +29 -0
- data/test/stories/first_login_story.rb +29 -0
- data/test/stories/visit_story.rb +39 -0
- data/test/stories_helper.rb +58 -0
- data/test/test_cli_helper.rb +31 -0
- data/test/test_helper.rb +111 -0
- data/test/test_temp_helper.rb +9 -0
- data/test/unit/cli_test.rb +38 -0
- data/test/unit/dump_test.rb +14 -0
- data/test/unit/extensions_test.rb +18 -0
- data/test/unit/files_test.rb +14 -0
- data/test/unit/flash_helper_test.rb +36 -0
- data/test/unit/html_helper_test.rb +29 -0
- data/test/unit/jquery_helper_test.rb +18 -0
- data/test/unit/model_test.rb +34 -0
- data/test/unit/page_helpers_test.rb +36 -0
- data/test/unit/seeder_test.rb +15 -0
- data/test/unit/settings_test.rb +29 -0
- data/test/unit/slug_test.rb +39 -0
- data/test/unit/ss_migration_test.rb +14 -0
- data/test/unit/terra_test.rb +125 -0
- data/test/unit/utils_test.rb +11 -0
- data/vendor/sinatra-sequel/.gitignore +3 -0
- data/vendor/sinatra-sequel/COPYING +18 -0
- data/vendor/sinatra-sequel/README.md +84 -0
- data/vendor/sinatra-sequel/Rakefile +67 -0
- data/vendor/sinatra-sequel/lib/sinatra/sequel.rb +73 -0
- data/vendor/sinatra-sequel/sinatra-sequel.gemspec +39 -0
- data/vendor/sinatra-sequel/spec/spec_sinatra_sequel.rb +70 -0
- metadata +536 -0
@@ -0,0 +1,93 @@
|
|
1
|
+
# Class: Fieldset (Terra)
|
2
|
+
# A fieldset.
|
3
|
+
#
|
4
|
+
# ## Description
|
5
|
+
# See {Terra} for information on how to use the form builder.
|
6
|
+
#
|
7
|
+
module Terra
|
8
|
+
class Fieldset
|
9
|
+
def initialize(form, id, name=nil, options={})
|
10
|
+
@form = form
|
11
|
+
@id = id
|
12
|
+
@name = name
|
13
|
+
@fields = Array.new
|
14
|
+
end
|
15
|
+
|
16
|
+
# Method: field (Terra::Fieldset)
|
17
|
+
# Add (or get?) a field.
|
18
|
+
#
|
19
|
+
def field(type, id=nil, title=nil, options={})
|
20
|
+
return @fields.detect { |f| f.name == type } if id.nil?
|
21
|
+
@fields << Field.create(self, type, id, title, options)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Attribute: name (Terra::Fieldset)
|
25
|
+
# The name of the field.
|
26
|
+
#
|
27
|
+
# ## Description
|
28
|
+
# This is also callable as `#to_s`.
|
29
|
+
#
|
30
|
+
def name
|
31
|
+
@name || @id.to_s.capitalize
|
32
|
+
end
|
33
|
+
|
34
|
+
alias to_s name
|
35
|
+
|
36
|
+
def clear
|
37
|
+
@fields = Array.new
|
38
|
+
end
|
39
|
+
|
40
|
+
def inspect
|
41
|
+
"#<Fieldset #{@id.inspect} [fields: #{fields.inspect}]>"
|
42
|
+
end
|
43
|
+
|
44
|
+
# Method: default? (Terra::Fieldset)
|
45
|
+
# Returns true if the fieldset is the default fieldset of the form.
|
46
|
+
def default?
|
47
|
+
@id == :default
|
48
|
+
end
|
49
|
+
|
50
|
+
# Method: to_html (Terra::Fieldset)
|
51
|
+
# Returns the HTML code for the entire fieldset.
|
52
|
+
#
|
53
|
+
# ## Description
|
54
|
+
# This calls puts together {Terra::Fieldset#legend_html} and
|
55
|
+
# {Terra::Fieldset#fields_html} inside a `<fieldset>` tag.
|
56
|
+
#
|
57
|
+
def to_html(item=nil)
|
58
|
+
[ "<fieldset name='#{id}'>",
|
59
|
+
legend_html, fields_html(item),
|
60
|
+
"</fieldset>" ].compact.join("\n")
|
61
|
+
end
|
62
|
+
|
63
|
+
# Method: fields_html (Terra::Fieldset)
|
64
|
+
# Returns the HTML code for the fields in the fieldset.
|
65
|
+
def fields_html(item=nil)
|
66
|
+
fields.map { |f| f.to_html(item.try(f.name.to_sym), item) }.join("\n")
|
67
|
+
end
|
68
|
+
|
69
|
+
# Method: legend_html (Terra::Fieldset)
|
70
|
+
# Returns the HTML code for the fields in the fieldset.
|
71
|
+
def legend_html
|
72
|
+
"<h3 class='legend'>#{self.to_s}</h3>" unless default?
|
73
|
+
end
|
74
|
+
|
75
|
+
# Attribute: fields (Terra::Fieldset)
|
76
|
+
# The list of fields.
|
77
|
+
attr_reader :fields
|
78
|
+
|
79
|
+
# Attribute: id (Terra::Fieldset)
|
80
|
+
# The symbol name of the field.
|
81
|
+
attr_reader :id
|
82
|
+
|
83
|
+
# Attribute: form (Terra::Fieldset)
|
84
|
+
# The parent Form.
|
85
|
+
attr_reader :form
|
86
|
+
|
87
|
+
# Shortcuts for text, textarea, password..
|
88
|
+
def method_missing(meth, *args, &blk)
|
89
|
+
super unless Fields.all.include?(meth)
|
90
|
+
field meth, *args
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
data/lib/terra/form.rb
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
# Class: Form (Terra)
|
2
|
+
# Terra is an HTML form generator.
|
3
|
+
#
|
4
|
+
# ## Description
|
5
|
+
# See {Terra} for information on how to use the form builder.
|
6
|
+
#
|
7
|
+
module Terra
|
8
|
+
class Form
|
9
|
+
def initialize
|
10
|
+
@fieldsets = Hash.new
|
11
|
+
fieldset(:default) { }
|
12
|
+
end
|
13
|
+
|
14
|
+
# Method: configure (Terra::Form)
|
15
|
+
# Usage: form.configure { ... }
|
16
|
+
#
|
17
|
+
# Adds fields to a form.
|
18
|
+
#
|
19
|
+
def configure(*a, &blk)
|
20
|
+
instance_eval *a, &blk
|
21
|
+
self
|
22
|
+
end
|
23
|
+
|
24
|
+
# Method: fieldset (Terra::Form)
|
25
|
+
# Usage: fieldset(id, name=nil, options={}, &block)
|
26
|
+
#
|
27
|
+
# Defines a fieldset.
|
28
|
+
#
|
29
|
+
def fieldset(id, name=nil, options={}, &block)
|
30
|
+
return @fieldsets[id] unless block_given?
|
31
|
+
|
32
|
+
@fieldsets[id] ||= Fieldset.new(self, id, name, options)
|
33
|
+
@fieldsets[id].clear
|
34
|
+
@fieldsets[id].instance_eval &block
|
35
|
+
end
|
36
|
+
|
37
|
+
# Method: field (Terra::Form)
|
38
|
+
# Usage: field name, options
|
39
|
+
# Defines a field.
|
40
|
+
#
|
41
|
+
# See {Terra::Fieldset.field} for details on how to use this.
|
42
|
+
#
|
43
|
+
def field(name, *a)
|
44
|
+
if a.empty?
|
45
|
+
set = fieldsets.detect { |set| set.field(name) }
|
46
|
+
set.field(name) unless set.nil?
|
47
|
+
else
|
48
|
+
fieldset(:default).field name, *a
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def method_missing(meth, *args, &blk)
|
53
|
+
super unless Fields.all.include?(meth)
|
54
|
+
field meth, *args
|
55
|
+
end
|
56
|
+
|
57
|
+
# Method: name_root (Terra::Form)
|
58
|
+
# Usage: name_root str
|
59
|
+
#
|
60
|
+
# Changes the root name to the given string.
|
61
|
+
#
|
62
|
+
# ## Description
|
63
|
+
# The root name is the prefix for the `name` attributes.
|
64
|
+
#
|
65
|
+
# * When invoked with a string, it changes the root name.
|
66
|
+
# Example: (`root_name 'editor'` => `<input name='editor[name]'>`)
|
67
|
+
#
|
68
|
+
# * When invoked with an array, it changes the root names.
|
69
|
+
# Example: (`root_name %w(form user)` => `<input name='form[user][name]'>`)
|
70
|
+
#
|
71
|
+
# * When invoked without arguments, it returns the root name.
|
72
|
+
#
|
73
|
+
def root_name(str=nil)
|
74
|
+
@root_name ||= Array.new
|
75
|
+
|
76
|
+
if str.is_a?(Array)
|
77
|
+
@root_name = str
|
78
|
+
elsif !str.nil?
|
79
|
+
@root_name = [str]
|
80
|
+
end
|
81
|
+
|
82
|
+
@root_name
|
83
|
+
end
|
84
|
+
|
85
|
+
# Method: name_for (Terra::Form)
|
86
|
+
# Usage: name_for(string)
|
87
|
+
#
|
88
|
+
# Returns the name for a given field name.
|
89
|
+
#
|
90
|
+
# ## Example
|
91
|
+
# root_name 'editor'
|
92
|
+
# name_for('email') #=> 'editor[email]'
|
93
|
+
#
|
94
|
+
def name_for(str)
|
95
|
+
names = (root_name + [*str])
|
96
|
+
one = names[0]
|
97
|
+
two = names[1..-1].map { |s| "[#{s}]" }.join('')
|
98
|
+
|
99
|
+
"#{one}#{two}"
|
100
|
+
end
|
101
|
+
|
102
|
+
# Method: fieldsets (Terra::Form)
|
103
|
+
# Usage: fieldsets
|
104
|
+
#
|
105
|
+
# Returns an array of fieldsets.
|
106
|
+
#
|
107
|
+
def fieldsets
|
108
|
+
@fieldsets.values.sort_by { |fs| fs.to_s }
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
title: Configuration
|
2
|
+
page_type: section
|
3
|
+
--
|
4
|
+
|
5
|
+
## Application configuration
|
6
|
+
|
7
|
+
#### Configuration
|
8
|
+
Configuration is done by Sinatra's app configuration on `Main`.
|
9
|
+
|
10
|
+
Main.set :host, "Heroku"
|
11
|
+
Main.get(:host) #=> "Heroku"
|
12
|
+
Main.host #=> "Heroku"
|
13
|
+
Main.host? #=> true
|
14
|
+
|
15
|
+
#### The config folder
|
16
|
+
Configuration is usually stored in your app's `config/` folder as
|
17
|
+
plain `.rb` files.
|
18
|
+
|
19
|
+
[config/database.rb (ruby)]
|
20
|
+
Main.configure do |m|
|
21
|
+
m.set :database_url, "sqlite://db/database.db"
|
22
|
+
end
|
23
|
+
|
24
|
+
# Just for the test environment
|
25
|
+
Main.configure(:test) do |m|
|
26
|
+
m.set :database_url, "sqlite://db/test.db"
|
27
|
+
end
|
28
|
+
|
29
|
+
## Dynamic configuration
|
30
|
+
|
31
|
+
Aura has a small settings system for user-settable things that is separate from above.
|
32
|
+
All of these are stored in the database.
|
33
|
+
|
34
|
+
#### Using set and get
|
35
|
+
Use `Aura.set` and `Aura.get`. The value supports strings, integers, arrays
|
36
|
+
and hashes. (They are stored as YAML in the database.)
|
37
|
+
|
38
|
+
Aura.set "site.name", "Jenny's Diary"
|
39
|
+
Aura.set "site.description", "Thoughts of a 17-year-old"
|
40
|
+
|
41
|
+
Aura.get("site.name")
|
42
|
+
|
@@ -0,0 +1,45 @@
|
|
1
|
+
title: Extensions
|
2
|
+
page_type: section
|
3
|
+
--
|
4
|
+
(TODO: Update this to be easier to read)
|
5
|
+
|
6
|
+
You may package your entire `app/` folder as an extension by copying it into
|
7
|
+
`extensions/my_extension/`. You may then redistribute it for using in other
|
8
|
+
Aura apps.
|
9
|
+
|
10
|
+
(All files and folders above are optional. Just use what you need!)
|
11
|
+
|
12
|
+
- Each extension can have `models/`, `routes/` and `helpers/` and
|
13
|
+
all Ruby files inside them are autoloaded.
|
14
|
+
- You may also have a YAML file called `info.yml`, which hosts metadata
|
15
|
+
about your extension.
|
16
|
+
- The directories described above are all optional.
|
17
|
+
|
18
|
+
## Extensions
|
19
|
+
|
20
|
+
Custom extensions go into `extensions/<extension_name>/`.
|
21
|
+
Here's what happens when the extension is loaded:
|
22
|
+
|
23
|
+
- After everything is set up, `extension_name.rb` is loaded.
|
24
|
+
- `init.rb` is called after all extensions are loaded.
|
25
|
+
- All Ruby files are loaded from `init/`, `models/`, `helpers/`, and `routes/`.
|
26
|
+
|
27
|
+
## Metadata
|
28
|
+
|
29
|
+
#### Defining metadata
|
30
|
+
Use `info.yml` in your extension.
|
31
|
+
|
32
|
+
[extensions/twitter/info.yml (yaml)]
|
33
|
+
name: Twitter integration
|
34
|
+
author: Rico Sta. Cruz
|
35
|
+
description: Shows twitter feeds in the home page.
|
36
|
+
|
37
|
+
## Loading extensions
|
38
|
+
|
39
|
+
#### Loading extensions
|
40
|
+
Edit `config/extensions.rb` of your app.
|
41
|
+
|
42
|
+
[config/extensions.rb (ruby)]
|
43
|
+
Main.configure do |m|
|
44
|
+
m.set :additional_extensions, %w(default_theme)
|
45
|
+
end
|
data/manual/files.md
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
title: File structure
|
2
|
+
page_type: section
|
3
|
+
--
|
4
|
+
This is what your default project looks like when you use `aura new`.
|
5
|
+
|
6
|
+
#### Structure
|
7
|
+
Your project looks like this. Most it's guts will be in `app/`.
|
8
|
+
|
9
|
+
[(text)]
|
10
|
+
project/
|
11
|
+
|- app/
|
12
|
+
| |- css/ # CSS files
|
13
|
+
| |- js/ # JS files
|
14
|
+
| |
|
15
|
+
| |- models/ # Models
|
16
|
+
| |- helpers/ # Helpers
|
17
|
+
| |- routes/ # Sinatra Routes
|
18
|
+
| |- views/ # View files
|
19
|
+
| |
|
20
|
+
| |- init/ # Ruby files to be ran on app init
|
21
|
+
| |- migrations/ # Data migration files
|
22
|
+
|
|
23
|
+
|- config/ # User config
|
24
|
+
|- public/ # Public files
|
25
|
+
|
|
26
|
+
|- config.ru
|
27
|
+
|- Gemfile
|
28
|
+
|- init.rb
|
29
|
+
|- Rakefile
|
30
|
+
|- README.md
|
31
|
+
|
32
|
+
## app/
|
33
|
+
|
34
|
+
#### app/css/
|
35
|
+
This contains your CSS files. Anything here will be accessible via `/css`.
|
36
|
+
|
37
|
+
app/css/style.css
|
38
|
+
app/css/theme/screen.sass
|
39
|
+
app/css/theme/print.css
|
40
|
+
|
41
|
+
#### app/js/
|
42
|
+
JavaScript files. They will be accessible via `/js`.
|
43
|
+
|
44
|
+
app/js/application.js
|
45
|
+
|
46
|
+
#### app/models/
|
47
|
+
Models here. All Ruby files here will be loaded on app init.
|
48
|
+
|
49
|
+
app/models/page.rb
|
50
|
+
app/models/book.rb
|
51
|
+
app/models/movie.rb
|
52
|
+
|
53
|
+
#### app/helpers/
|
54
|
+
Helpers here. All Ruby files here will be loaded on app init.
|
55
|
+
|
56
|
+
app/helpers/page_helpers.rb
|
57
|
+
app/helpers/time_helpers.rb
|
58
|
+
|
59
|
+
#### app/routes/
|
60
|
+
Sinatra routes here. All Ruby files here will be loaded on app init.
|
61
|
+
|
62
|
+
app/routes/store.rb
|
63
|
+
app/routes/background.rb
|
64
|
+
|
65
|
+
# Example:
|
66
|
+
class Main
|
67
|
+
get '/foo' do
|
68
|
+
show :foo
|
69
|
+
end
|
70
|
+
end
|
data/manual/helpers.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
title: Helpers
|
2
|
+
page_type: section
|
3
|
+
--
|
4
|
+
Helpers are defined and used exactly as how you would in Sinatra.
|
5
|
+
|
6
|
+
#### Defining helpers
|
7
|
+
Create a file in the `app/helpers/` folder of your app.
|
8
|
+
|
9
|
+
[app/helpers/my_helpers.rb (rb)]
|
10
|
+
class Main
|
11
|
+
module MyHelpers
|
12
|
+
def who_is_awesome
|
13
|
+
"You are!"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
helpers MyHelpers
|
18
|
+
end
|
19
|
+
|
20
|
+
#### Using helpers in views
|
21
|
+
You can then use it in views.
|
22
|
+
|
23
|
+
[app/views/index.haml (haml)]
|
24
|
+
%div.question
|
25
|
+
Who is awesome?
|
26
|
+
|
27
|
+
%div.answer
|
28
|
+
= who_is_awesome
|
29
|
+
|
30
|
+
#### Using helpers in routes
|
31
|
+
Yeah, you can.
|
32
|
+
|
33
|
+
[app/routes/foo.rb (rb)]
|
34
|
+
class Main
|
35
|
+
get '/who_is_awesome' do
|
36
|
+
@who = who_is_awesome
|
37
|
+
show :index
|
38
|
+
end
|
39
|
+
end
|
data/manual/index.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
title: Aura
|
2
|
+
--
|
3
|
+
Aura lets you build CMS-powered sites in Ruby.
|
4
|
+
|
5
|
+
#### Installation
|
6
|
+
Assuming you have Ruby installed (at least 1.8.7), just install the gem.
|
7
|
+
|
8
|
+
$ gem install aura --pre
|
9
|
+
|
10
|
+
$ aura
|
11
|
+
|
12
|
+
Getting started
|
13
|
+
---------------
|
14
|
+
|
15
|
+
#### Start a new project
|
16
|
+
Start a new project using [aura new](aura_new.html). This creates a folder with a simple bare-bone Aura project.
|
17
|
+
|
18
|
+
$ aura new myproject
|
19
|
+
create myproject/
|
20
|
+
create myproject/config.ru
|
21
|
+
create myproject/init.rb
|
22
|
+
create myproject/app/
|
23
|
+
create myproject/app/models/
|
24
|
+
create myproject/app/models/page.rb.example
|
25
|
+
...
|
26
|
+
|
27
|
+
#### Install the needed gems
|
28
|
+
Using Bundler, this is pretty easy.
|
29
|
+
|
30
|
+
$ cd myproject/
|
31
|
+
$ bundle install
|
32
|
+
...
|
33
|
+
|
34
|
+
#### Configure a database (optional)
|
35
|
+
Sequel uses Sqlite by default. To point it to another database, edit the `config/database.rb.example` file.
|
36
|
+
|
37
|
+
[config/database.rb (rb)]
|
38
|
+
Main.configure do |m|
|
39
|
+
m.set :database_url, "mysql://root:pickles@localhost/db_name"
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
#### Start it up
|
44
|
+
Your app is a Rack app. Visit *http://localhost:4833* to see it. (Default user is `test@sinefunc.com`/`password`)
|
45
|
+
|
46
|
+
$ thin start
|
47
|
+
* Starting server...
|
48
|
+
>> Thin web server (v1.2.11 codename Bat-Shit Crazy)
|
49
|
+
>> Maximum connections set to 1024
|
50
|
+
>> Listening on 0.0.0.0:4833, CTRL+C to stop
|
51
|
+
|
52
|
+
## Features
|
53
|
+
|
54
|
+
* **For designers** and site builders:
|
55
|
+
* Be in full control of markup, and write in whatever template language you're comfortable with.
|
56
|
+
* Build custom page types that will the custom fields you need with the template you define.
|
57
|
+
|
58
|
+
* **For site owners:**
|
59
|
+
* Use a CMS with an interface you will love, rather than put up with.
|
60
|
+
|
61
|
+
* **For developers:**
|
62
|
+
* Easy-to-extend with a simple extension system.
|
63
|
+
* Built on top of [Sinatra](http://sinatrarb.com), a tried and tested microframework.
|
64
|
+
|
65
|
+
[Source code on GitHub](http://github.com/buildwithaura/aura "Source code")
|