junebug 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +3 -2
- data/deploy/config.yml +5 -2
- data/deploy/static/base.css +49 -19
- data/fixtures/junebug_pages.yml +44 -23
- data/lib/junebug.rb +8 -7
- data/lib/junebug/controllers.rb +3 -1
- data/lib/junebug/generator.rb +31 -0
- data/lib/junebug/models.rb +11 -3
- data/lib/junebug/views.rb +10 -9
- metadata +3 -3
data/README
CHANGED
@@ -5,7 +5,7 @@ Junebug is a minimalist wiki, running on a minimalist web framework.
|
|
5
5
|
|
6
6
|
== Status
|
7
7
|
|
8
|
-
Junebug v0.0.
|
8
|
+
Junebug v0.0.4 release, 2006-11-05
|
9
9
|
|
10
10
|
This is an alpha release. Use at your own risk. Please do not use this for anything important.
|
11
11
|
|
@@ -47,7 +47,8 @@ Starting and stopping the wiki:
|
|
47
47
|
|
48
48
|
> ./wiki start
|
49
49
|
> ./wiki stop
|
50
|
-
|
50
|
+
> ./wiki restart
|
51
|
+
> ./wiki run
|
51
52
|
|
52
53
|
== Credits
|
53
54
|
|
data/deploy/config.yml
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
# this what you want to be the default wiki page
|
2
2
|
startpage: JunebugWiki
|
3
|
+
|
3
4
|
# server configuration
|
4
5
|
host: 0.0.0.0
|
5
6
|
port: 3301
|
6
|
-
|
7
|
+
|
8
|
+
# if you want to have the wiki root running on something other than /
|
7
9
|
sitepath: /
|
8
|
-
|
10
|
+
|
11
|
+
# configuring rss
|
9
12
|
url: http://localhost:3301
|
10
13
|
feed: http://localhost:3301/all/feed
|
11
14
|
|
data/deploy/static/base.css
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
|
2
|
+
|
2
3
|
form { display: inline; }
|
3
4
|
|
4
5
|
span.actions a {
|
@@ -7,11 +8,18 @@ span.actions a {
|
|
7
8
|
|
8
9
|
input.button {
|
9
10
|
margin-right: 5px;
|
11
|
+
margin-top: 4px;
|
10
12
|
}
|
11
13
|
|
12
14
|
input, textarea {
|
13
15
|
padding: 2px;
|
14
16
|
margin-bottom: 5px;
|
17
|
+
font-family:"Bitstream Vera Sans Mono", "Monaco", "Courier", monospace;
|
18
|
+
}
|
19
|
+
|
20
|
+
textarea {
|
21
|
+
width: 100%;
|
22
|
+
font-size: 92%;
|
15
23
|
}
|
16
24
|
|
17
25
|
del {
|
@@ -27,15 +35,18 @@ ins {
|
|
27
35
|
|
28
36
|
|
29
37
|
/* PAGE STRUCTURE */
|
38
|
+
body {
|
39
|
+
background:#d7d7d7;
|
40
|
+
}
|
41
|
+
|
30
42
|
#doc {
|
31
|
-
font-family:
|
32
|
-
/* background-color: #EFE6CE;*/
|
43
|
+
font-family: 'Lucida Grande', 'Trebuchet MS', Arial, Helvetica, sans-serif;
|
33
44
|
}
|
34
45
|
|
35
46
|
#hd {
|
36
|
-
border-top:
|
47
|
+
border-top: 6px solid #4e0dc4;
|
37
48
|
background-color: #3f276a;
|
38
|
-
padding: 8px;
|
49
|
+
padding: 8px 25px;
|
39
50
|
/* font-size: 100%;*/
|
40
51
|
color: #ffffff;
|
41
52
|
}
|
@@ -51,13 +62,22 @@ ins {
|
|
51
62
|
color: #ffffff;
|
52
63
|
}
|
53
64
|
|
65
|
+
#hd h1 a {
|
66
|
+
color: #ffffff;
|
67
|
+
}
|
68
|
+
|
54
69
|
#hd h1 {
|
55
70
|
font-size: 167%;
|
56
|
-
padding-bottom:
|
71
|
+
padding-bottom: 5px;
|
72
|
+
font-weight: normal;
|
57
73
|
}
|
58
74
|
|
59
75
|
#bd {
|
60
|
-
|
76
|
+
background-color: #ffffff;
|
77
|
+
border:5px solid #929292;
|
78
|
+
border-width:0 5px 5px 0;
|
79
|
+
padding: 25px;
|
80
|
+
min-height: 300px;
|
61
81
|
/* font-size: 100%;*/
|
62
82
|
}
|
63
83
|
|
@@ -71,7 +91,7 @@ ins {
|
|
71
91
|
|
72
92
|
#ft {
|
73
93
|
border: 1px solid #ddd;
|
74
|
-
background-color: #
|
94
|
+
background-color: #d7dffd;
|
75
95
|
font-size: 100%;
|
76
96
|
padding: 8px;
|
77
97
|
margin-bottom: 10px;
|
@@ -114,28 +134,30 @@ ins {
|
|
114
134
|
}
|
115
135
|
|
116
136
|
|
117
|
-
/* CONTENT STYLES */
|
137
|
+
/* WIKI CONTENT STYLES */
|
118
138
|
.content {
|
119
139
|
font-size: 100%;
|
120
140
|
}
|
121
141
|
|
122
|
-
.content
|
142
|
+
.content h2, .content h3, .content h4 {
|
143
|
+
margin-top: 20px;
|
123
144
|
margin-bottom: 10px;
|
124
145
|
}
|
125
146
|
|
126
147
|
.content h1 {
|
148
|
+
margin-bottom: 10px;
|
127
149
|
font-size: 182%;
|
128
150
|
}
|
129
151
|
|
130
152
|
.content h2 {
|
131
153
|
font-size: 152%;
|
132
154
|
border-bottom: 1px dotted #bbb;
|
133
|
-
background-color: #eef
|
155
|
+
/* background-color: #eef;*/
|
134
156
|
}
|
135
157
|
|
136
158
|
.content h3 {
|
137
159
|
font-size: 129%;
|
138
|
-
border-bottom: 1px dotted #bbb
|
160
|
+
/* border-bottom: 1px dotted #bbb;*/
|
139
161
|
}
|
140
162
|
|
141
163
|
.content h4 {
|
@@ -144,7 +166,11 @@ ins {
|
|
144
166
|
|
145
167
|
.content ul {
|
146
168
|
list-style-type: square;
|
147
|
-
margin: 10px 0px 10px
|
169
|
+
margin: 10px 0px 10px 28px;
|
170
|
+
}
|
171
|
+
|
172
|
+
.content li {
|
173
|
+
line-height: 150%;
|
148
174
|
}
|
149
175
|
|
150
176
|
.content ol {
|
@@ -154,6 +180,7 @@ ins {
|
|
154
180
|
|
155
181
|
.content p {
|
156
182
|
margin: 10px 0px;
|
183
|
+
font-size: 114%;
|
157
184
|
}
|
158
185
|
|
159
186
|
.content strong {
|
@@ -164,14 +191,17 @@ ins {
|
|
164
191
|
font-weight: bold;
|
165
192
|
}
|
166
193
|
|
167
|
-
.content pre {
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
font-
|
173
|
-
|
194
|
+
.content pre code{
|
195
|
+
display: block;
|
196
|
+
color: #000000;
|
197
|
+
background: #eee;
|
198
|
+
/* overflow: auto;*/
|
199
|
+
font-size: 92%;
|
200
|
+
font-family:"Bitstream Vera Sans Mono", "Monaco", "Courier", monospace;
|
201
|
+
padding: 8px 20px;
|
202
|
+
}
|
174
203
|
|
204
|
+
asdf {
|
175
205
|
/* http://longren.org/2006/09/27/wrapping-text-inside-pre-tags */
|
176
206
|
white-space: pre-wrap; /* css-3 */
|
177
207
|
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
|
data/fixtures/junebug_pages.yml
CHANGED
@@ -1,23 +1,44 @@
|
|
1
|
-
---
|
2
|
-
- updated_at: 2006-11-
|
3
|
-
title: JunebugWiki
|
4
|
-
readonly:
|
5
|
-
body: |
|
6
|
-
h1. Welcome to Junebug!
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
1
|
+
---
|
2
|
+
- updated_at: 2006-11-05 20:20:26 -08:00
|
3
|
+
title: JunebugWiki
|
4
|
+
readonly: true
|
5
|
+
body: |
|
6
|
+
h1. Welcome to Junebug!
|
7
|
+
|
8
|
+
To complete setup of you new wiki, here are a few things you should do:
|
9
|
+
|
10
|
+
|
11
|
+
h3. 1. Login to your account
|
12
|
+
|
13
|
+
When you created this wiki, the username and password you submitted were used to set up an account for you. Now click the 'sign in' link at the upper right and sign in.
|
14
|
+
|
15
|
+
Once you sign in you will see your username in the upper right corner.
|
16
|
+
|
17
|
+
|
18
|
+
h3. 2. Set the start page
|
19
|
+
|
20
|
+
This page will always be the default start page for a new wiki. Probably not what you want, right? Fortunately, it is easy to change. Open the config.yml file (in your wiki directory) with any texteditor, and change the startpage field to the page you want.
|
21
|
+
|
22
|
+
Next, in your wiki directory, run the command:
|
23
|
+
|
24
|
+
./wiki restart
|
25
|
+
|
26
|
+
The next time you click on the 'Home' link in the nav bar, you will be taken to your new start page. If the page doesn't already exist, you will first be asked to login, and then you will be presented with an edit form to create the page.
|
27
|
+
|
28
|
+
|
29
|
+
h3. 3. Create some pages!
|
30
|
+
|
31
|
+
If you have any trouble, or need some help getting started, click on the 'Help' link in the nav bar. The documentation is pretty sparse right now, but I'm working on it!
|
32
|
+
|
33
|
+
id: 1
|
34
|
+
version: 1
|
35
|
+
user_id: 1
|
36
|
+
created_at: 2006-10-29 16:19:34 -08:00
|
37
|
+
- updated_at: 2006-11-05 19:48:57 -08:00
|
38
|
+
title: JunebugHelp
|
39
|
+
readonly:
|
40
|
+
body: This is a work in progress
|
41
|
+
id: 2
|
42
|
+
version: 1
|
43
|
+
user_id: 1
|
44
|
+
created_at: 2006-11-01 00:10:07 -08:00
|
data/lib/junebug.rb
CHANGED
@@ -22,24 +22,25 @@ module Junebug
|
|
22
22
|
Junebug::Models.create_schema :assume => (Junebug::Models::Page.table_exists? ? 1.0 : 0.0)
|
23
23
|
Camping::Models::Session.create_schema
|
24
24
|
end
|
25
|
+
|
26
|
+
def self.connect
|
27
|
+
Junebug::Models::Base.establish_connection :adapter => 'sqlite3', :database => 'junebug.db'
|
28
|
+
Junebug::Models::Base.logger = Logger.new('junebug.log')
|
29
|
+
Junebug::Models::Base.threaded_connections=false
|
30
|
+
end
|
25
31
|
|
26
32
|
def self.config
|
27
33
|
@config ||= YAML.load(File.read('config.yml'))
|
28
34
|
end
|
29
35
|
end
|
30
36
|
|
31
|
-
# ENV.each do |key,value|
|
32
|
-
# puts "#{key}: #{value}"
|
33
|
-
# end
|
34
37
|
|
35
38
|
if __FILE__ == $0 || ENV['DAEMONS_ARGV']
|
39
|
+
puts "In Postamble"
|
36
40
|
# When using daemons, the current dir is /
|
37
41
|
# So we need to set it to the junebug root
|
38
42
|
FileUtils.cd ENV['JUNEBUG_ROOT'] if ENV['JUNEBUG_ROOT']
|
39
|
-
|
40
|
-
Junebug::Models::Base.establish_connection :adapter => 'sqlite3', :database => 'junebug.db'
|
41
|
-
Junebug::Models::Base.logger = Logger.new('junebug.log')
|
42
|
-
Junebug::Models::Base.threaded_connections=false
|
43
|
+
Junebug.connect
|
43
44
|
Junebug.create
|
44
45
|
|
45
46
|
server = Mongrel::Camping::start( Junebug.config['host'], Junebug.config['port'], Junebug.config['sitepath'], Junebug)
|
data/lib/junebug/controllers.rb
CHANGED
@@ -28,7 +28,9 @@ module Junebug::Controllers
|
|
28
28
|
|
29
29
|
def post page_name
|
30
30
|
redirect(Login) and return if @state.user_id.blank?
|
31
|
-
|
31
|
+
attrs = { :body => input.post_body, :title => input.post_title }
|
32
|
+
attrs[:readonly] = input.post_readonly if @state.user_id == 1
|
33
|
+
if Page.find_or_create_by_title(page_name).update_attributes( attrs )
|
32
34
|
redirect Show, input.post_title
|
33
35
|
end
|
34
36
|
end
|
data/lib/junebug/generator.rb
CHANGED
@@ -1,14 +1,45 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
|
3
|
+
require 'junebug'
|
4
|
+
require 'junebug/models'
|
5
|
+
|
3
6
|
module Junebug
|
4
7
|
module Generator
|
5
8
|
extend self
|
6
9
|
|
7
10
|
def generate(args)
|
11
|
+
puts "In generator"
|
8
12
|
src_root = File.dirname(__FILE__) + '/../../deploy'
|
9
13
|
app = ARGV.first
|
10
14
|
FileUtils.cp_r(src_root, app)
|
11
15
|
FileUtils.chmod(0755, app+'/wiki')
|
16
|
+
FileUtils.cd app
|
17
|
+
Junebug.connect
|
18
|
+
Junebug.create
|
19
|
+
|
20
|
+
user = Junebug::Models::User.find(1)
|
21
|
+
|
22
|
+
puts <<EOS
|
23
|
+
|
24
|
+
***********************************
|
25
|
+
|
26
|
+
Welcome to Junebug!
|
27
|
+
|
28
|
+
To start your new wiki, do the following:
|
29
|
+
|
30
|
+
> cd #{app}
|
31
|
+
> ./wiki start
|
32
|
+
|
33
|
+
Open your browser to http://#{Junebug.config['host']}:#{Junebug.config['port']}#{Junebug.config['sitepath']}
|
34
|
+
|
35
|
+
Your admin account is:
|
36
|
+
|
37
|
+
username: #{user.username}
|
38
|
+
password: #{user.password}
|
39
|
+
|
40
|
+
Submit bug reports to tim.myrtle@gmail.com
|
41
|
+
|
42
|
+
EOS
|
12
43
|
end
|
13
44
|
|
14
45
|
end
|
data/lib/junebug/models.rb
CHANGED
@@ -44,12 +44,20 @@ module Junebug::Models
|
|
44
44
|
Page.reset_column_information
|
45
45
|
|
46
46
|
# Create admin account
|
47
|
-
|
47
|
+
if ENV['DAEMONS_ARGV']
|
48
|
+
username = 'admin'
|
49
|
+
password = 'password'
|
50
|
+
else
|
51
|
+
print "Create an initial user account\n"
|
52
|
+
print "\nEnter your username (3-30 chars, no spaces or punctuation): "
|
53
|
+
username = STDIN.gets.strip
|
54
|
+
print "\nEnter your password (5-30 chars, no spaces or punctuation): "
|
55
|
+
password = STDIN.gets.strip
|
56
|
+
end
|
57
|
+
admin = User.create :username => username, :password => password
|
48
58
|
|
49
59
|
# Install some default pages
|
50
60
|
pages_file = File.dirname(__FILE__) + "/../../fixtures/junebug_pages.yml"
|
51
|
-
#puts pages_file
|
52
|
-
#pages_file = '../fixtures/junebug_pages.yml'
|
53
61
|
YAML.load_file(pages_file).each {|page_data|Page.create(page_data) } if File.exist?(pages_file)
|
54
62
|
end
|
55
63
|
def self.down
|
data/lib/junebug/views.rb
CHANGED
@@ -22,7 +22,7 @@ module Junebug::Views
|
|
22
22
|
_header (@version.version == @page.version ? :show : :backlinks), @page.title
|
23
23
|
_body {
|
24
24
|
div.content {
|
25
|
-
_button 'Edit page', {:href => R(Edit, @page.title, @version.version), :style=>'float: right; margin: 0 0 5px 5px;'} if @version.version == @page.version
|
25
|
+
_button 'Edit page', {:href => R(Edit, @page.title, @version.version), :style=>'float: right; margin: 0 0 5px 5px;'} if (@version.version == @page.version && (! @page.readonly || @state.user_id == 1))
|
26
26
|
_markup @version.body
|
27
27
|
}
|
28
28
|
}
|
@@ -34,6 +34,7 @@ module Junebug::Views
|
|
34
34
|
text ")"
|
35
35
|
end
|
36
36
|
br
|
37
|
+
text '<b>[readonly]</b> ' if @page.readonly
|
37
38
|
span.actions {
|
38
39
|
text "Version #{@version.version} "
|
39
40
|
text "(current) " if @version.version == @page.version
|
@@ -64,6 +65,13 @@ module Junebug::Views
|
|
64
65
|
br
|
65
66
|
textarea @page.body, :name => 'post_body', :rows => 20, :cols => 80
|
66
67
|
}
|
68
|
+
if @state.user_id == 1
|
69
|
+
opts = { :type => 'checkbox', :value=>'1', :name => 'post_readonly' }
|
70
|
+
opts[:checked] = 1 if @page.readonly
|
71
|
+
input opts
|
72
|
+
text " Readonly"
|
73
|
+
br
|
74
|
+
end
|
67
75
|
input :type => 'submit', :value=>'save'
|
68
76
|
end
|
69
77
|
_button 'cancel', :href => R(Show, @page.title, @page.version); text ' '
|
@@ -206,7 +214,7 @@ module Junebug::Views
|
|
206
214
|
def _header type, page_title
|
207
215
|
div :id=>'hd' do
|
208
216
|
span :id=>'userlinks', :style=>'float: right;' do
|
209
|
-
@state.user_id.blank? ? a('
|
217
|
+
@state.user_id.blank? ? a('sign in', :href=>R(Login)) : (text "#{@state.user_username} - " ; a('sign out', :href=>R(Logout)))
|
210
218
|
end
|
211
219
|
if type == :static
|
212
220
|
h1 page_title
|
@@ -248,13 +256,6 @@ module Junebug::Views
|
|
248
256
|
yield
|
249
257
|
br :clear=>'all'
|
250
258
|
end
|
251
|
-
text <<END
|
252
|
-
<p>
|
253
|
-
<a href="http://validator.w3.org/check?uri=referer"><img
|
254
|
-
src="http://www.w3.org/Icons/valid-xhtml10"
|
255
|
-
alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>
|
256
|
-
</p>
|
257
|
-
END
|
258
259
|
end
|
259
260
|
|
260
261
|
def self.feed
|
metadata
CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: junebug
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2006-11-
|
6
|
+
version: 0.0.4
|
7
|
+
date: 2006-11-05 00:00:00 -08:00
|
8
8
|
summary: Junebug is a minimalist ruby wiki.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: tim.myrtle@gmail.com
|
12
12
|
homepage: http://www.junebugwiki.com/
|
13
13
|
rubyforge_project:
|
14
|
-
description: Junebug is a minimalist ruby wiki.
|
14
|
+
description: Junebug is a minimalist ruby wiki running on Camping.
|
15
15
|
autorequire:
|
16
16
|
default_executable:
|
17
17
|
bindir: bin
|