bottlerocket 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +15 -0
- data/Readme.md +54 -0
- data/admin/public/javascripts/site.js +0 -0
- data/admin/public/stylesheets/reset.css +102 -0
- data/admin/public/stylesheets/screen.css +48 -0
- data/admin/views/edit.haml +4 -0
- data/admin/views/entities.haml +8 -0
- data/admin/views/entity.haml +11 -0
- data/admin/views/index.haml +3 -0
- data/admin/views/layout.haml +15 -0
- data/admin/views/show.haml +1 -0
- data/bin/bottlerocket +14 -0
- data/lib/bottlerocket.rb +13 -0
- data/lib/bottlerocket/bottlerocket_admin.rb +65 -0
- data/lib/bottlerocket/generator.rb +21 -0
- data/lib/bottlerocket/has_connection.rb +6 -0
- data/lib/bottlerocket/models/configuration.rb +52 -0
- data/lib/bottlerocket/models/content_type.rb +64 -0
- data/lib/bottlerocket/models/content_types.rb +31 -0
- data/lib/bottlerocket/models/entity.rb +9 -0
- data/lib/bottlerocket/simple_struct.rb +24 -0
- data/template/Gemfile +1 -0
- data/template/README.markdown +1 -0
- data/template/bottlerocket.yaml +4 -0
- data/template/config.ru +24 -0
- data/template/content_types.yaml +19 -0
- data/template/site.rb +5 -0
- metadata +137 -0
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
task :default => :spec
|
4
|
+
|
5
|
+
desc "Build Bottlerocket"
|
6
|
+
task :build do
|
7
|
+
system "gem build bottlerocket.gemspec"
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "Run specs"
|
11
|
+
task :spec do
|
12
|
+
RSpec::Core::RakeTask.new do |t|
|
13
|
+
t.rspec_opts = %w(-fs --color --backtrace)
|
14
|
+
end
|
15
|
+
end
|
data/Readme.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Bottle Rocket #
|
2
|
+
## *Note: This is a work in progress and currently is not working* ##
|
3
|
+
Bottlerocket is a Sinatra/Mongo based CMS which aims to ease development times on small sites. The overall aim is to be able quickly write create your content types in a YAML file and then deploy your site with very little configuration.
|
4
|
+
|
5
|
+
## Features ##
|
6
|
+
- Mongo based content management system
|
7
|
+
- Fully speced
|
8
|
+
- Gem based
|
9
|
+
- Sinatra based
|
10
|
+
- Works with Heroku
|
11
|
+
- Beautiful user interface
|
12
|
+
- HTML 5/CSS 3 administration interface
|
13
|
+
|
14
|
+
## Installation ##
|
15
|
+
|
16
|
+
gem install bottlerocket
|
17
|
+
bottlerocket my_project
|
18
|
+
|
19
|
+
Bottlerocket also requires you to have atleast Mongo 1.5.8 and Ruby 1.9.2.
|
20
|
+
|
21
|
+
## How to Use ##
|
22
|
+
|
23
|
+
Once you get everything installed, you can define the types of Content you are going to use in your CMS by editing the _content_types.yaml_ file
|
24
|
+
|
25
|
+
-
|
26
|
+
name: pages
|
27
|
+
fields:
|
28
|
+
- title: string
|
29
|
+
- body: text
|
30
|
+
- image: file
|
31
|
+
- section:
|
32
|
+
- general
|
33
|
+
- life style
|
34
|
+
- cooking
|
35
|
+
- gaming
|
36
|
+
- rocket science
|
37
|
+
- active: boolean
|
38
|
+
-
|
39
|
+
name: stores
|
40
|
+
fields:
|
41
|
+
- name: string
|
42
|
+
- address: text
|
43
|
+
|
44
|
+
From here, you can call on a ContentType for use in your template(e.g.)
|
45
|
+
|
46
|
+
@page = ContentTypes.pages.find(:title => "title").first
|
47
|
+
|
48
|
+
## Configuration ##
|
49
|
+
|
50
|
+
### Heroku ###
|
51
|
+
|
52
|
+
## Notes ##
|
53
|
+
|
54
|
+
- Note: content_type is reserved field.
|
File without changes
|
@@ -0,0 +1,102 @@
|
|
1
|
+
/*
|
2
|
+
html5doctor.com Reset Stylesheet
|
3
|
+
v1.6.1
|
4
|
+
Last Updated: 2010-09-17
|
5
|
+
Author: Richard Clark - http://richclarkdesign.com
|
6
|
+
Twitter: @rich_clark
|
7
|
+
*/
|
8
|
+
|
9
|
+
html, body, div, span, object, iframe,
|
10
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
11
|
+
abbr, address, cite, code,
|
12
|
+
del, dfn, em, img, ins, kbd, q, samp,
|
13
|
+
small, strong, sub, sup, var,
|
14
|
+
b, i,
|
15
|
+
dl, dt, dd, ol, ul, li,
|
16
|
+
fieldset, form, label, legend,
|
17
|
+
table, caption, tbody, tfoot, thead, tr, th, td,
|
18
|
+
article, aside, canvas, details, figcaption, figure,
|
19
|
+
footer, header, hgroup, menu, nav, section, summary,
|
20
|
+
time, mark, audio, video {
|
21
|
+
margin:0;
|
22
|
+
padding:0;
|
23
|
+
border:0;
|
24
|
+
outline:0;
|
25
|
+
font-size:100%;
|
26
|
+
vertical-align:baseline;
|
27
|
+
background:transparent;
|
28
|
+
}
|
29
|
+
|
30
|
+
body {
|
31
|
+
line-height:1;
|
32
|
+
}
|
33
|
+
|
34
|
+
article,aside,details,figcaption,figure,
|
35
|
+
footer,header,hgroup,menu,nav,section {
|
36
|
+
display:block;
|
37
|
+
}
|
38
|
+
|
39
|
+
nav ul {
|
40
|
+
list-style:none;
|
41
|
+
}
|
42
|
+
|
43
|
+
blockquote, q {
|
44
|
+
quotes:none;
|
45
|
+
}
|
46
|
+
|
47
|
+
blockquote:before, blockquote:after,
|
48
|
+
q:before, q:after {
|
49
|
+
content:'';
|
50
|
+
content:none;
|
51
|
+
}
|
52
|
+
|
53
|
+
a {
|
54
|
+
margin:0;
|
55
|
+
padding:0;
|
56
|
+
font-size:100%;
|
57
|
+
vertical-align:baseline;
|
58
|
+
background:transparent;
|
59
|
+
}
|
60
|
+
|
61
|
+
/* change colours to suit your needs */
|
62
|
+
ins {
|
63
|
+
background-color:#ff9;
|
64
|
+
color:#000;
|
65
|
+
text-decoration:none;
|
66
|
+
}
|
67
|
+
|
68
|
+
/* change colours to suit your needs */
|
69
|
+
mark {
|
70
|
+
background-color:#ff9;
|
71
|
+
color:#000;
|
72
|
+
font-style:italic;
|
73
|
+
font-weight:bold;
|
74
|
+
}
|
75
|
+
|
76
|
+
del {
|
77
|
+
text-decoration: line-through;
|
78
|
+
}
|
79
|
+
|
80
|
+
abbr[title], dfn[title] {
|
81
|
+
border-bottom:1px dotted;
|
82
|
+
cursor:help;
|
83
|
+
}
|
84
|
+
|
85
|
+
table {
|
86
|
+
border-collapse:collapse;
|
87
|
+
border-spacing:0;
|
88
|
+
}
|
89
|
+
|
90
|
+
/* change border colour to suit your needs */
|
91
|
+
hr {
|
92
|
+
display:block;
|
93
|
+
height:1px;
|
94
|
+
border:0;
|
95
|
+
border-top:1px solid #cccccc;
|
96
|
+
margin:1em 0;
|
97
|
+
padding:0;
|
98
|
+
}
|
99
|
+
|
100
|
+
input, select {
|
101
|
+
vertical-align:middle;
|
102
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
body {}
|
2
|
+
label { font-weight: bold; }
|
3
|
+
fieldset { padding:0 1.4em 1.4em 1.4em; margin: 0 0 1.5em 0; border: 1px solid #ccc; }
|
4
|
+
legend { font-weight: bold; font-size:1.2em; margin-top:-0.2em; margin-bottom:1em; }
|
5
|
+
|
6
|
+
fieldset, #IE8#HACK { padding-top:1.4em; }
|
7
|
+
legend, #IE8#HACK { margin-top:0; margin-bottom:0; }
|
8
|
+
input[type=text], input[type=password], input[type=url], input[type=email],
|
9
|
+
input.text, input.title,
|
10
|
+
textarea {
|
11
|
+
background-color:#fff;
|
12
|
+
border:1px solid #bbb;
|
13
|
+
color:#000;
|
14
|
+
}
|
15
|
+
input[type=text]:focus, input[type=password]:focus, input[type=url]:focus, input[type=email]:focus,
|
16
|
+
input.text:focus, input.title:focus,
|
17
|
+
textarea:focus {
|
18
|
+
border-color:#666;
|
19
|
+
}
|
20
|
+
select { background-color:#fff; border-width:1px; border-style:solid; }
|
21
|
+
|
22
|
+
input[type=text], input[type=password], input[type=url], input[type=email],
|
23
|
+
input.text, input.title,
|
24
|
+
textarea, select {
|
25
|
+
margin:0.5em 0;
|
26
|
+
}
|
27
|
+
|
28
|
+
input.text,
|
29
|
+
input.title { width: 300px; padding:5px; }
|
30
|
+
input.title { font-size:1.5em; }
|
31
|
+
textarea { width: 390px; height: 250px; padding:5px; }
|
32
|
+
form.inline { line-height:3; }
|
33
|
+
form.inline p { margin-bottom:0; }
|
34
|
+
|
35
|
+
.error,
|
36
|
+
.alert,
|
37
|
+
.notice,
|
38
|
+
.success,
|
39
|
+
.info { padding: 0.8em; margin-bottom: 1em; border: 2px solid #ddd; }
|
40
|
+
|
41
|
+
.error, .alert { background: #fbe3e4; color: #8a1f11; border-color: #fbc2c4; }
|
42
|
+
.notice { background: #fff6bf; color: #514721; border-color: #ffd324; }
|
43
|
+
.success { background: #e6efc2; color: #264409; border-color: #c6d880; }
|
44
|
+
.info { background: #d5edf8; color: #205791; border-color: #92cae4; }
|
45
|
+
.error a, .alert a { color: #8a1f11; }
|
46
|
+
.notice a { color: #514721; }
|
47
|
+
.success a { color: #264409; }
|
48
|
+
.info a { color: #205791; }
|
@@ -0,0 +1,11 @@
|
|
1
|
+
%h1= form_name
|
2
|
+
- form_tag(admin_path("#{@content_type.name}")) do
|
3
|
+
%ul
|
4
|
+
- @content_type.fields.each do |f|
|
5
|
+
- field, value = f.keys.first, f.values.first
|
6
|
+
%li
|
7
|
+
= label_tag field
|
8
|
+
= text_field_tag "entity[#{field}]", :value => @entity.attributes[field]
|
9
|
+
%li
|
10
|
+
= submit_tag "Save #{@content_type.title}"
|
11
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
!!!
|
2
|
+
%html{:lang => "en"}
|
3
|
+
%head
|
4
|
+
%meta{:charset => "utf-8"}
|
5
|
+
|
6
|
+
/[if IE]
|
7
|
+
%script{:src => " http://html5shiv.googlecode.com/svn/trunk/html5.js"}
|
8
|
+
|
9
|
+
%title Bottlerocket
|
10
|
+
%link{:rel => "stylesheet", :href => "/admin/stylesheets/screen.css"}
|
11
|
+
|
12
|
+
%body{:id => @page_id || ''}
|
13
|
+
%section#content
|
14
|
+
= yield
|
15
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
= @entity.title
|
data/bin/bottlerocket
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$:.unshift File.dirname(__FILE__) + "/../lib"
|
4
|
+
require 'bottlerocket/generator'
|
5
|
+
|
6
|
+
if ARGV.empty?
|
7
|
+
STDERR.puts %{
|
8
|
+
example: bottlerocket my_shiny_new_site
|
9
|
+
}
|
10
|
+
else
|
11
|
+
generator = Generator.new(ARGV.first)
|
12
|
+
generator.copy_template
|
13
|
+
generator.dir_setup
|
14
|
+
end
|
data/lib/bottlerocket.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'active_support'
|
3
|
+
require 'mongo'
|
4
|
+
require 'fileutils'
|
5
|
+
require File.dirname(__FILE__) + '/bottlerocket/simple_struct'
|
6
|
+
require File.dirname(__FILE__) + '/bottlerocket/models/configuration'
|
7
|
+
require File.dirname(__FILE__) + '/bottlerocket/models/content_types'
|
8
|
+
require File.dirname(__FILE__) + '/bottlerocket/models/content_type'
|
9
|
+
require File.dirname(__FILE__) + '/bottlerocket/models/entity'
|
10
|
+
require File.dirname(__FILE__) + '/bottlerocket/generator'
|
11
|
+
require File.dirname(__FILE__) + '/bottlerocket/bottlerocket_admin'
|
12
|
+
|
13
|
+
puts File.dirname(__FILE__) + '/bottlerocket/simple_struct'
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'sinatra'
|
2
|
+
require 'sinatra_more/markup_plugin'
|
3
|
+
|
4
|
+
class BottlerocketAdmin < Sinatra::Application
|
5
|
+
register SinatraMore::MarkupPlugin
|
6
|
+
|
7
|
+
configure do
|
8
|
+
set :views => File.dirname(__FILE__) + "/../../admin/views"
|
9
|
+
set :public => File.dirname(__FILE__) + "/../../admin/public"
|
10
|
+
enable :static
|
11
|
+
set :haml, {:format => :html5}
|
12
|
+
end
|
13
|
+
|
14
|
+
helpers do
|
15
|
+
def admin_path(location)
|
16
|
+
"/admin/#{location}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
use Rack::Auth::Basic do |username, password|
|
21
|
+
Configuration.instance.users.keys.include?(username) && password == Configuration.instance.users[username]
|
22
|
+
end
|
23
|
+
|
24
|
+
get "/stylesheets/:file.css" do |file|
|
25
|
+
content_type 'text/css'
|
26
|
+
sass(:"stylesheets/#{file}", :load_paths => ([ File.join(File.dirname(__FILE__), 'views', 'stylesheets') ]))
|
27
|
+
end
|
28
|
+
|
29
|
+
get '/' do
|
30
|
+
@content_types = Configuration.instance.content_types.all
|
31
|
+
haml :index
|
32
|
+
end
|
33
|
+
|
34
|
+
get '/:handle' do |handle|
|
35
|
+
@content_type = Configuration.instance.content_types.find(handle)
|
36
|
+
haml :entities
|
37
|
+
end
|
38
|
+
|
39
|
+
get '/:handle/new' do |handle|
|
40
|
+
@content_type = Configuration.instance.content_types.find(handle)
|
41
|
+
@entity = SimpleStruct.new
|
42
|
+
haml :entity, :locals => {:form_name => "New Form"}
|
43
|
+
end
|
44
|
+
|
45
|
+
get '/:handle/:id/edit' do |handle, id|
|
46
|
+
@content_type = Configuration.instance.content_types.find(handle)
|
47
|
+
@entity = Configuration.instance.content_types.find(handle).find_by_id(id)
|
48
|
+
haml :entity, :locals => {:form_name => "Edit Form"}
|
49
|
+
end
|
50
|
+
|
51
|
+
get '/:handle/:id/delete' do |handle, id|
|
52
|
+
Configuration.instance.content_types.find(handle).remove(:_id => id)
|
53
|
+
redirect admin_path(handle)
|
54
|
+
end
|
55
|
+
|
56
|
+
get '/:handle/:id' do |handle, id|
|
57
|
+
@entity = Configuration.instance.content_types.find(handle).find_by_id(id)
|
58
|
+
haml :show
|
59
|
+
end
|
60
|
+
|
61
|
+
post '/:handle' do |handle|
|
62
|
+
Configuration.instance.content_types.find(handle).create params[:entity]
|
63
|
+
redirect admin_path(handle)
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
class Generator
|
4
|
+
attr_accessor :dir
|
5
|
+
def initialize(dir)
|
6
|
+
self.dir = dir
|
7
|
+
end
|
8
|
+
|
9
|
+
def create_directory
|
10
|
+
FileUtils.mkdir_p dir
|
11
|
+
end
|
12
|
+
|
13
|
+
def copy_template
|
14
|
+
FileUtils.cp_r(File.dirname(__FILE__) + '/../../template', dir)
|
15
|
+
end
|
16
|
+
|
17
|
+
def dir_setup
|
18
|
+
FileUtils.mkdir_p [dir + "/public/css", dir + "/public/javascripts", dir + "/public/images", dir + "/views/stylesheets"]
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
|
3
|
+
class ConnectionHelper
|
4
|
+
attr_accessor :attrs
|
5
|
+
|
6
|
+
def initialize(attrs)
|
7
|
+
self.attrs = attrs
|
8
|
+
end
|
9
|
+
|
10
|
+
def method_missing(field, *args)
|
11
|
+
begin
|
12
|
+
attrs[field.to_s]
|
13
|
+
rescue
|
14
|
+
super(field, *args)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def connection
|
19
|
+
"mongodb://" + attrs['database_host'] + ":" + attrs['database_port'].to_s + "/" + attrs['database_name']
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class Configuration
|
24
|
+
include Singleton
|
25
|
+
|
26
|
+
attr_accessor :config_file_location
|
27
|
+
|
28
|
+
def attrs
|
29
|
+
@attrs ||= YAML.load_file config_file_location
|
30
|
+
end
|
31
|
+
|
32
|
+
def environments
|
33
|
+
%w(development test staging production)
|
34
|
+
end
|
35
|
+
|
36
|
+
def content_types
|
37
|
+
@content_types ||= ContentTypes.load(content_types_file)
|
38
|
+
end
|
39
|
+
|
40
|
+
def method_missing(field, *args)
|
41
|
+
begin
|
42
|
+
if environments.include? field.to_s
|
43
|
+
ConnectionHelper.new attrs[field.to_s]
|
44
|
+
else
|
45
|
+
attrs[field.to_s]
|
46
|
+
end
|
47
|
+
rescue
|
48
|
+
super(field, *args)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../has_connection'
|
2
|
+
|
3
|
+
class ContentType < SimpleStruct
|
4
|
+
include HasConnection
|
5
|
+
|
6
|
+
def field_names
|
7
|
+
fields.collect { |hash| hash.keys.first }
|
8
|
+
end
|
9
|
+
|
10
|
+
def title
|
11
|
+
name.humanize
|
12
|
+
end
|
13
|
+
|
14
|
+
def single_title
|
15
|
+
name.singularize.humanize
|
16
|
+
end
|
17
|
+
|
18
|
+
def collection
|
19
|
+
db.collection name
|
20
|
+
end
|
21
|
+
|
22
|
+
def create(attrs)
|
23
|
+
find_by_id collection.insert(attrs)
|
24
|
+
end
|
25
|
+
|
26
|
+
def update(attrs)
|
27
|
+
a = attrs.dup
|
28
|
+
a.delete :content_type
|
29
|
+
collection.update({:_id => mongo_object_id(a[:_id])}, a)
|
30
|
+
end
|
31
|
+
|
32
|
+
def remove(attrs)
|
33
|
+
collection.remove(attrs)
|
34
|
+
end
|
35
|
+
|
36
|
+
def find_by_id(id)
|
37
|
+
find_one :_id => mongo_object_id(id)
|
38
|
+
end
|
39
|
+
|
40
|
+
def find_one(*args)
|
41
|
+
result = collection.find_one(*args)
|
42
|
+
result.merge!({:content_type => self}) if result.present?
|
43
|
+
if result.nil? or result.empty?
|
44
|
+
nil
|
45
|
+
else
|
46
|
+
Entity.new result
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def find(*args)
|
51
|
+
collection.find(*args).collect { |attrs| Entity.new attrs.merge(:content_type => self) }
|
52
|
+
end
|
53
|
+
|
54
|
+
alias_method :all, :find
|
55
|
+
|
56
|
+
def mongo_object_id(id)
|
57
|
+
if id.is_a? String
|
58
|
+
BSON::ObjectId.from_string(id)
|
59
|
+
else
|
60
|
+
id
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class ContentTypes
|
2
|
+
attr_accessor :content_types
|
3
|
+
|
4
|
+
def self.load(content_types_yaml)
|
5
|
+
ContentTypes.new content_types_yaml
|
6
|
+
end
|
7
|
+
|
8
|
+
def initialize(content_types_yaml)
|
9
|
+
self.content_types = YAML.load_file(content_types_yaml).collect { |attrs| ContentType.new(attrs) }
|
10
|
+
end
|
11
|
+
|
12
|
+
def all
|
13
|
+
content_types
|
14
|
+
end
|
15
|
+
|
16
|
+
def length
|
17
|
+
content_types.length
|
18
|
+
end
|
19
|
+
|
20
|
+
def find(name)
|
21
|
+
content_types.detect { |ct| ct.name == name }
|
22
|
+
end
|
23
|
+
|
24
|
+
def method_missing(field, *args)
|
25
|
+
if find field.to_s.end_with?('=')
|
26
|
+
field.to_s = args.first
|
27
|
+
else
|
28
|
+
find field.to_s
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class SimpleStruct
|
2
|
+
attr_accessor :attributes
|
3
|
+
|
4
|
+
def initialize(attributes={})
|
5
|
+
self.attributes = attributes
|
6
|
+
end
|
7
|
+
|
8
|
+
def attributes=(attrs)
|
9
|
+
@attributes = HashWithIndifferentAccess.new attrs
|
10
|
+
end
|
11
|
+
|
12
|
+
def method_missing(field, *args)
|
13
|
+
begin
|
14
|
+
if field.to_s.end_with?('=')
|
15
|
+
field_name = field.to_s.sub '=', ''
|
16
|
+
@attributes[field_name] = args.first
|
17
|
+
else
|
18
|
+
@attributes[field]
|
19
|
+
end
|
20
|
+
rescue
|
21
|
+
super(field, *args)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/template/Gemfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gem "bottlerocket"
|
@@ -0,0 +1 @@
|
|
1
|
+
This is Bottlerocket 0.0.4
|
data/template/config.ru
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'sinatra'
|
3
|
+
require 'bottlerocket'
|
4
|
+
require File.dirname(__FILE__) + '/site'
|
5
|
+
|
6
|
+
Configuration.instance.config_file_location = File.dirname(__FILE__) + '/bottlerocket.yaml'
|
7
|
+
|
8
|
+
set :run, false
|
9
|
+
|
10
|
+
app = Rack::Builder.new do
|
11
|
+
map '/admin' do
|
12
|
+
run BottlerocketAdmin
|
13
|
+
end
|
14
|
+
|
15
|
+
map '/' do
|
16
|
+
run Site
|
17
|
+
end
|
18
|
+
end.to_app
|
19
|
+
|
20
|
+
log = File.new("sinatra.log", "a")
|
21
|
+
STDOUT.reopen(log)
|
22
|
+
STDERR.reopen(log)
|
23
|
+
|
24
|
+
run app
|
@@ -0,0 +1,19 @@
|
|
1
|
+
-
|
2
|
+
name: pages
|
3
|
+
fields:
|
4
|
+
- title: string
|
5
|
+
- body: text
|
6
|
+
- image: file
|
7
|
+
- section:
|
8
|
+
- general
|
9
|
+
- life style
|
10
|
+
- cooking
|
11
|
+
- gaming
|
12
|
+
- rocket science
|
13
|
+
- active: boolean
|
14
|
+
|
15
|
+
-
|
16
|
+
name: stores
|
17
|
+
fields:
|
18
|
+
- name: string
|
19
|
+
- address: text
|
data/template/site.rb
ADDED
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bottlerocket
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.5
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Brett Goulder
|
9
|
+
- Carl Woodward
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
|
14
|
+
date: 2011-05-05 00:00:00 -07:00
|
15
|
+
default_executable:
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
|
+
name: activesupport
|
19
|
+
prerelease: false
|
20
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
21
|
+
none: false
|
22
|
+
requirements:
|
23
|
+
- - "="
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: "3.0"
|
26
|
+
type: :runtime
|
27
|
+
version_requirements: *id001
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: sinatra
|
30
|
+
prerelease: false
|
31
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
32
|
+
none: false
|
33
|
+
requirements:
|
34
|
+
- - "="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: "1.0"
|
37
|
+
type: :runtime
|
38
|
+
version_requirements: *id002
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
name: mongo
|
41
|
+
prerelease: false
|
42
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - "="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.0.8
|
48
|
+
type: :runtime
|
49
|
+
version_requirements: *id003
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: sinatra_more
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - "="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: 0.3.40
|
59
|
+
type: :runtime
|
60
|
+
version_requirements: *id004
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: haml
|
63
|
+
prerelease: false
|
64
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - "="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 3.0.25
|
70
|
+
type: :runtime
|
71
|
+
version_requirements: *id005
|
72
|
+
description: A nifty Sinatra/Mongo based CMS made by an American and an Australian guy with an afro
|
73
|
+
email: brett.goulder@gmail.com
|
74
|
+
executables:
|
75
|
+
- bottlerocket
|
76
|
+
extensions: []
|
77
|
+
|
78
|
+
extra_rdoc_files: []
|
79
|
+
|
80
|
+
files:
|
81
|
+
- Readme.md
|
82
|
+
- Rakefile
|
83
|
+
- admin/public/javascripts/site.js
|
84
|
+
- admin/public/stylesheets/reset.css
|
85
|
+
- admin/public/stylesheets/screen.css
|
86
|
+
- admin/views/edit.haml
|
87
|
+
- admin/views/entities.haml
|
88
|
+
- admin/views/entity.haml
|
89
|
+
- admin/views/index.haml
|
90
|
+
- admin/views/layout.haml
|
91
|
+
- admin/views/show.haml
|
92
|
+
- bin/bottlerocket
|
93
|
+
- lib/bottlerocket/bottlerocket_admin.rb
|
94
|
+
- lib/bottlerocket/generator.rb
|
95
|
+
- lib/bottlerocket/has_connection.rb
|
96
|
+
- lib/bottlerocket/models/configuration.rb
|
97
|
+
- lib/bottlerocket/models/content_type.rb
|
98
|
+
- lib/bottlerocket/models/content_types.rb
|
99
|
+
- lib/bottlerocket/models/entity.rb
|
100
|
+
- lib/bottlerocket/simple_struct.rb
|
101
|
+
- lib/bottlerocket.rb
|
102
|
+
- template/bottlerocket.yaml
|
103
|
+
- template/config.ru
|
104
|
+
- template/content_types.yaml
|
105
|
+
- template/Gemfile
|
106
|
+
- template/README.markdown
|
107
|
+
- template/site.rb
|
108
|
+
has_rdoc: true
|
109
|
+
homepage: http://github.com/brettgoulder/bottlerocket
|
110
|
+
licenses: []
|
111
|
+
|
112
|
+
post_install_message:
|
113
|
+
rdoc_options: []
|
114
|
+
|
115
|
+
require_paths:
|
116
|
+
- lib
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: "0"
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: "0"
|
129
|
+
requirements: []
|
130
|
+
|
131
|
+
rubyforge_project:
|
132
|
+
rubygems_version: 1.6.2
|
133
|
+
signing_key:
|
134
|
+
specification_version: 3
|
135
|
+
summary: A nifty Sinatra/Mongo based CMS
|
136
|
+
test_files: []
|
137
|
+
|