memorack 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/HISTORY.md +6 -0
- data/README.md +26 -2
- data/Rakefile +1 -1
- data/VERSION +1 -0
- data/etc/tools/update_revision.rb +14 -0
- data/lib/memorack/builder.rb +171 -0
- data/lib/memorack/cli.rb +53 -0
- data/lib/memorack/core.rb +369 -0
- data/lib/memorack/locales/en.yml +4 -0
- data/lib/memorack/locales/ja.yml +4 -0
- data/lib/memorack/mdmenu.rb +3 -0
- data/lib/memorack/memoapp.rb +14 -350
- data/lib/memorack/template/themes/custom/config.json +2 -0
- data/lib/memorack/themes/basic/config.json +1 -0
- data/lib/memorack/themes/basic/{2-column.scss → css/2-column.scss} +0 -0
- data/lib/memorack/themes/basic/{basic-styles.scss → css/basic-styles.scss} +0 -0
- data/lib/memorack/themes/basic/{styles.scss → css/styles.scss} +0 -0
- data/lib/memorack/themes/basic/index.html +4 -4
- data/lib/memorack/themes/oreilly/{styles.scss → css/styles.scss} +2 -2
- data/lib/memorack/version.rb +23 -3
- data/memorack.gemspec +5 -1
- data/spec/memorack_spec.rb +202 -4
- data/spec/spec_helper.rb +1 -0
- metadata +55 -9
- data/etc/tools/update_version.rb +0 -16
@@ -3,6 +3,7 @@
|
|
3
3
|
"css": ["scss"], // css の自動変換を使用する
|
4
4
|
// "markdown": "kramdown", // 使用する markdownライブラリ
|
5
5
|
// "formats": ["markdown"], // "markdown", "rdoc", "textile" or "wiki" (要 Tilt に対応した gem ライブラリ)
|
6
|
+
"public": ["css/"], // build で出力されるファイル
|
6
7
|
|
7
8
|
// redcarpet の拡張構文
|
8
9
|
"strikethrough": true, // 例: ~~good~~
|
File without changes
|
File without changes
|
File without changes
|
@@ -12,15 +12,15 @@
|
|
12
12
|
<meta name="description" content="" />
|
13
13
|
<title>{{page.title}}</title>
|
14
14
|
|
15
|
-
<link type="text/css" href="/styles.css" rel="stylesheet" media="all" />
|
15
|
+
<link type="text/css" href="{{site.url}}/css/styles.css" rel="stylesheet" media="all" />
|
16
16
|
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
|
17
17
|
<script type="text/javascript">
|
18
18
|
$(function(){
|
19
19
|
// 表示しているメニューを選択
|
20
|
-
$('#menu a[href
|
20
|
+
$('#menu a[href$="' + document.location.pathname + '"]').parent().addClass('selected');
|
21
21
|
|
22
22
|
// 外部サイトのリンクに target='_blank' を追加
|
23
|
-
$('a[href^=http]').not('[href*="
|
23
|
+
$('a[href^=http]').not('[href*="://' + location.hostname + '"]').attr('target', '_blank');
|
24
24
|
});
|
25
25
|
</script>
|
26
26
|
|
@@ -28,7 +28,7 @@
|
|
28
28
|
<body>
|
29
29
|
<div id="page">
|
30
30
|
<header>
|
31
|
-
<h1><a href="/">{{title}}</a></h1>
|
31
|
+
<h1><a href="{{site.url}}/">{{title}}</a></h1>
|
32
32
|
</header>
|
33
33
|
|
34
34
|
<div id="content-container">
|
data/lib/memorack/version.rb
CHANGED
@@ -1,6 +1,26 @@
|
|
1
1
|
module MemoRack
|
2
|
-
LONG_VERSION = File.read(File.expand_path('../../../VERSION', __FILE__)).chomp
|
3
|
-
VERSION = LONG_VERSION.gsub(/(-.*|\(.*)$/, '')
|
4
|
-
|
5
2
|
HOMEPAGE = 'https://github.com/gnue/memorack'
|
3
|
+
|
4
|
+
begin
|
5
|
+
dir = File.expand_path('../../..', __FILE__)
|
6
|
+
version = File.read(File.join(dir, 'VERSION')).chomp
|
7
|
+
revision = File.read(File.join(dir, 'REVISION')).chomp.split('/')
|
8
|
+
|
9
|
+
case revision.first
|
10
|
+
when /^#{version}(-|$)/
|
11
|
+
ver, rev = revision
|
12
|
+
else
|
13
|
+
version += 'dev'
|
14
|
+
ver = version
|
15
|
+
|
16
|
+
revision.delete('')
|
17
|
+
rev = revision.join('/')
|
18
|
+
end
|
19
|
+
|
20
|
+
rescue
|
21
|
+
ver = version
|
22
|
+
end
|
23
|
+
|
24
|
+
VERSION = version
|
25
|
+
LONG_VERSION = ver + (rev ? "(#{rev})" : '')
|
6
26
|
end
|
data/memorack.gemspec
CHANGED
@@ -11,8 +11,9 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.description = %q{Rack Application for markdown memo}
|
12
12
|
gem.summary = %q{Rack Application for markdown memo}
|
13
13
|
gem.homepage = MemoRack::HOMEPAGE
|
14
|
+
gem.license = "MIT"
|
14
15
|
|
15
|
-
gem.files = `git ls-files`.split($/) + %w(
|
16
|
+
gem.files = `git ls-files`.split($/) + %w(REVISION)
|
16
17
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
19
|
gem.require_paths = ["lib"]
|
@@ -29,8 +30,11 @@ Gem::Specification.new do |gem|
|
|
29
30
|
gem.add_dependency('i18n')
|
30
31
|
|
31
32
|
# for development
|
33
|
+
gem.add_development_dependency('bundler', '~> 1.3')
|
34
|
+
gem.add_development_dependency('rake')
|
32
35
|
gem.add_development_dependency('minitest')
|
33
36
|
gem.add_development_dependency('turn')
|
37
|
+
gem.add_development_dependency('rack-test')
|
34
38
|
|
35
39
|
gem.post_install_message = %Q{
|
36
40
|
==================
|
data/spec/memorack_spec.rb
CHANGED
@@ -61,6 +61,7 @@ describe MemoRack do
|
|
61
61
|
Usage: memorack create [options] PATH
|
62
62
|
memorack theme [options] [THEME]
|
63
63
|
memorack server [options] PATH
|
64
|
+
memorack build [options] [PATH]
|
64
65
|
|
65
66
|
-h, --help Show this message
|
66
67
|
EOD
|
@@ -92,6 +93,19 @@ describe MemoRack do
|
|
92
93
|
-h, --help Show this message
|
93
94
|
EOD
|
94
95
|
end
|
96
|
+
|
97
|
+
it "build" do
|
98
|
+
proc { memorack 'build', '-h' }.must_output nil, <<-EOD.cut_indent
|
99
|
+
Usage: memorack build [options] [PATH]
|
100
|
+
|
101
|
+
-o, --output DIRECTORY Output directory (default: _site)
|
102
|
+
-t, --theme THEME use THEME (default: custom)
|
103
|
+
--url URL Site URL (default: )
|
104
|
+
--local Site URL is output directory
|
105
|
+
--prettify prettify URL
|
106
|
+
-h, --help Show this message
|
107
|
+
EOD
|
108
|
+
end
|
95
109
|
end
|
96
110
|
|
97
111
|
describe "ja" do
|
@@ -104,6 +118,7 @@ describe MemoRack do
|
|
104
118
|
Usage: memorack create [options] PATH
|
105
119
|
memorack theme [options] [THEME]
|
106
120
|
memorack server [options] PATH
|
121
|
+
memorack build [options] [PATH]
|
107
122
|
|
108
123
|
-h, --help このメッセージを表示
|
109
124
|
EOD
|
@@ -136,6 +151,19 @@ describe MemoRack do
|
|
136
151
|
-h, --help このメッセージを表示
|
137
152
|
EOD
|
138
153
|
end
|
154
|
+
|
155
|
+
it "build" do
|
156
|
+
proc { memorack 'build', '-h' }.must_output nil, <<-EOD.cut_indent
|
157
|
+
Usage: memorack build [options] [PATH]
|
158
|
+
|
159
|
+
-o, --output DIRECTORY 出力するディレクトリ (省略値: _site)
|
160
|
+
-t, --theme THEME テーマを使う (省略値: custom)
|
161
|
+
--url URL サイトURL (省略値: )
|
162
|
+
--local サイトURLをアウトプットディレクトリにする
|
163
|
+
--prettify 綺麗なURLになるように生成する
|
164
|
+
-h, --help このメッセージを表示
|
165
|
+
EOD
|
166
|
+
end
|
139
167
|
end
|
140
168
|
end
|
141
169
|
|
@@ -210,13 +238,14 @@ describe MemoRack do
|
|
210
238
|
|
211
239
|
`cd themes/#{theme}; find . -print`.must_equal <<-EOD.cut_indent
|
212
240
|
.
|
213
|
-
./2-column.scss
|
214
241
|
./404.md
|
215
|
-
./basic-styles.scss
|
216
242
|
./config.json
|
243
|
+
./css
|
244
|
+
./css/2-column.scss
|
245
|
+
./css/basic-styles.scss
|
246
|
+
./css/styles.scss
|
217
247
|
./error.html
|
218
248
|
./index.html
|
219
|
-
./styles.scss
|
220
249
|
EOD
|
221
250
|
}
|
222
251
|
end
|
@@ -229,10 +258,179 @@ describe MemoRack do
|
|
229
258
|
proc { memorack 'theme', '-c', File.join(theme, fname) }.must_output "Created '#{fname}'\n"
|
230
259
|
}
|
231
260
|
end
|
261
|
+
|
262
|
+
end
|
263
|
+
|
264
|
+
describe "build" do
|
265
|
+
before do
|
266
|
+
@hash = {}
|
267
|
+
@hash['basic'] = 'd414b3942f61e6b0a07f6458bfb133da40e7c7b8'
|
268
|
+
@hash['oreilly'] = '56b0c0f6a7394904442d7af6986797b1300301c3'
|
269
|
+
|
270
|
+
@file_lists = <<-EOD.cut_indent
|
271
|
+
.
|
272
|
+
./css
|
273
|
+
./css/2-column.css
|
274
|
+
./css/basic-styles.css
|
275
|
+
./css/styles.css
|
276
|
+
./index.html
|
277
|
+
./README.html
|
278
|
+
EOD
|
279
|
+
end
|
280
|
+
|
281
|
+
it "build" do
|
282
|
+
theme = 'oreilly'
|
283
|
+
output = '_site'
|
284
|
+
|
285
|
+
chmemo { |name|
|
286
|
+
proc { memorack 'build' }.must_output "Build 'content/' -> '#{output}'\n"
|
287
|
+
|
288
|
+
Dir.chdir(output) { |output|
|
289
|
+
`find . -print`.must_equal @file_lists
|
290
|
+
`git hash-object css/styles.css`.must_equal @hash[theme]+"\n"
|
291
|
+
}
|
292
|
+
}
|
293
|
+
end
|
294
|
+
|
295
|
+
it "build PATH" do
|
296
|
+
theme = 'basic'
|
297
|
+
output = '_site'
|
298
|
+
|
299
|
+
chmemo { |name|
|
300
|
+
dirname = 'data'
|
301
|
+
File.rename('content', dirname)
|
302
|
+
|
303
|
+
Dir.chdir('..')
|
304
|
+
|
305
|
+
path = File.join(name, dirname)
|
306
|
+
proc { memorack 'build', path }.must_output "Build '#{path}' -> '#{output}'\n"
|
307
|
+
|
308
|
+
Dir.chdir(output) { |output|
|
309
|
+
`find . -print`.must_equal @file_lists
|
310
|
+
`git hash-object css/styles.css`.must_equal @hash[theme]+"\n"
|
311
|
+
}
|
312
|
+
}
|
313
|
+
end
|
314
|
+
|
315
|
+
it "build --output DIRECTORY" do
|
316
|
+
theme = 'oreilly'
|
317
|
+
output = 'output'
|
318
|
+
|
319
|
+
chmemo { |name|
|
320
|
+
proc { memorack 'build', '--output', output }.must_output "Build 'content/' -> '#{output}'\n"
|
321
|
+
|
322
|
+
Dir.chdir(output) { |output|
|
323
|
+
`find . -print`.must_equal @file_lists
|
324
|
+
`git hash-object css/styles.css`.must_equal @hash[theme]+"\n"
|
325
|
+
}
|
326
|
+
}
|
327
|
+
end
|
328
|
+
|
329
|
+
it "build --theme THEME" do
|
330
|
+
theme = 'basic'
|
331
|
+
output = '_site'
|
332
|
+
|
333
|
+
chmemo { |name|
|
334
|
+
proc { memorack 'build', '--theme', theme }.must_output "Build 'content/' -> '#{output}'\n"
|
335
|
+
|
336
|
+
Dir.chdir(output) { |output|
|
337
|
+
`find . -print`.must_equal @file_lists
|
338
|
+
`git hash-object css/styles.css`.must_equal @hash[theme]+"\n"
|
339
|
+
}
|
340
|
+
}
|
341
|
+
end
|
342
|
+
|
343
|
+
it "build --url URL" do
|
344
|
+
theme = 'oreilly'
|
345
|
+
output = '_site'
|
346
|
+
url = 'http://memo.pow'
|
347
|
+
|
348
|
+
chmemo { |name|
|
349
|
+
proc { memorack 'build', '--url', url }.must_output "Build 'content/' -> '#{output}'\n"
|
350
|
+
|
351
|
+
Dir.chdir(output) { |output|
|
352
|
+
`find . -print`.must_equal @file_lists
|
353
|
+
`git hash-object css/styles.css`.must_equal @hash[theme]+"\n"
|
354
|
+
File.read('index.html').must_match %r[<a href="#{url}/README.html">README</a>]
|
355
|
+
}
|
356
|
+
}
|
357
|
+
end
|
358
|
+
|
359
|
+
it "build --local" do
|
360
|
+
theme = 'oreilly'
|
361
|
+
output = '_site'
|
362
|
+
|
363
|
+
chmemo { |name|
|
364
|
+
url = 'file://' + File.expand_path(output)
|
365
|
+
|
366
|
+
proc { memorack 'build', '--local' }.must_output "Build 'content/' -> '#{output}'\n"
|
367
|
+
|
368
|
+
Dir.chdir(output) { |output|
|
369
|
+
`find . -print`.must_equal @file_lists
|
370
|
+
`git hash-object css/styles.css`.must_equal @hash[theme]+"\n"
|
371
|
+
File.read('index.html').must_match %r[<a href="#{url}/README.html">README</a>]
|
372
|
+
}
|
373
|
+
}
|
374
|
+
end
|
375
|
+
|
376
|
+
it "build --prettify" do
|
377
|
+
theme = 'oreilly'
|
378
|
+
output = '_site'
|
379
|
+
url = ''
|
380
|
+
|
381
|
+
chmemo { |name|
|
382
|
+
proc { memorack 'build', '--prettify' }.must_output "Build 'content/' -> '#{output}'\n"
|
383
|
+
|
384
|
+
Dir.chdir(output) { |output|
|
385
|
+
`find . -print`.must_equal <<-EOD.cut_indent
|
386
|
+
.
|
387
|
+
./css
|
388
|
+
./css/2-column.css
|
389
|
+
./css/basic-styles.css
|
390
|
+
./css/styles.css
|
391
|
+
./index.html
|
392
|
+
./README
|
393
|
+
./README/index.html
|
394
|
+
EOD
|
395
|
+
|
396
|
+
`git hash-object css/styles.css`.must_equal @hash[theme]+"\n"
|
397
|
+
File.read('index.html').must_match %r[<a href="#{url}/README">README</a>]
|
398
|
+
}
|
399
|
+
}
|
400
|
+
end
|
232
401
|
end
|
233
402
|
|
234
403
|
describe "server" do
|
235
|
-
|
404
|
+
include Rack::Test::Methods
|
405
|
+
|
406
|
+
before do
|
407
|
+
@cwd = Dir.pwd
|
408
|
+
|
409
|
+
name = 'memo'
|
410
|
+
Dir.chdir(@tmpdir)
|
411
|
+
proc { memorack 'create', name }.must_output "Created '#{name}'\n"
|
412
|
+
Dir.chdir(name)
|
413
|
+
end
|
414
|
+
|
415
|
+
def app
|
416
|
+
Rack::Builder.parse_file('config.ru').first
|
417
|
+
end
|
418
|
+
|
419
|
+
it "server /" do
|
420
|
+
get '/'
|
421
|
+
last_response.must_be :ok?
|
422
|
+
last_response.body.must_match /Powered by <a href="#{MemoRack::HOMEPAGE}"[^>]*>/
|
423
|
+
end
|
424
|
+
|
425
|
+
it "server /README" do
|
426
|
+
get '/README'
|
427
|
+
last_response.must_be :ok?
|
428
|
+
last_response.body.must_match /このディレクトリに markdown 等のメモファイルを作成してください/
|
429
|
+
end
|
430
|
+
|
431
|
+
after do
|
432
|
+
Dir.chdir(@cwd)
|
433
|
+
end
|
236
434
|
end
|
237
435
|
|
238
436
|
after do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: memorack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gnue
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -108,6 +108,34 @@ dependencies:
|
|
108
108
|
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: bundler
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.3'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ~>
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.3'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rake
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
111
139
|
- !ruby/object:Gem::Dependency
|
112
140
|
name: minitest
|
113
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +164,20 @@ dependencies:
|
|
136
164
|
- - '>='
|
137
165
|
- !ruby/object:Gem::Version
|
138
166
|
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rack-test
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - '>='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
139
181
|
description: Rack Application for markdown memo
|
140
182
|
email:
|
141
183
|
- gnue@so-kukan.com
|
@@ -150,10 +192,13 @@ files:
|
|
150
192
|
- LICENSE.txt
|
151
193
|
- README.md
|
152
194
|
- Rakefile
|
195
|
+
- VERSION
|
153
196
|
- bin/memorack
|
154
|
-
- etc/tools/
|
197
|
+
- etc/tools/update_revision.rb
|
155
198
|
- lib/memorack.rb
|
199
|
+
- lib/memorack/builder.rb
|
156
200
|
- lib/memorack/cli.rb
|
201
|
+
- lib/memorack/core.rb
|
157
202
|
- lib/memorack/locales/en.yml
|
158
203
|
- lib/memorack/locales/ja.yml
|
159
204
|
- lib/memorack/locals.rb
|
@@ -167,25 +212,26 @@ files:
|
|
167
212
|
- lib/memorack/template/content/README.md
|
168
213
|
- lib/memorack/template/themes/custom/config.json
|
169
214
|
- lib/memorack/template/themes/custom/index.md
|
170
|
-
- lib/memorack/themes/basic/2-column.scss
|
171
215
|
- lib/memorack/themes/basic/404.md
|
172
|
-
- lib/memorack/themes/basic/basic-styles.scss
|
173
216
|
- lib/memorack/themes/basic/config.json
|
217
|
+
- lib/memorack/themes/basic/css/2-column.scss
|
218
|
+
- lib/memorack/themes/basic/css/basic-styles.scss
|
219
|
+
- lib/memorack/themes/basic/css/styles.scss
|
174
220
|
- lib/memorack/themes/basic/error.html
|
175
221
|
- lib/memorack/themes/basic/index.html
|
176
|
-
- lib/memorack/themes/basic/styles.scss
|
177
222
|
- lib/memorack/themes/oreilly/config.json
|
223
|
+
- lib/memorack/themes/oreilly/css/styles.scss
|
178
224
|
- lib/memorack/themes/oreilly/oreilly/base.scss
|
179
225
|
- lib/memorack/themes/oreilly/oreilly/styles.scss
|
180
|
-
- lib/memorack/themes/oreilly/styles.scss
|
181
226
|
- lib/memorack/tilt-mustache.rb
|
182
227
|
- lib/memorack/version.rb
|
183
228
|
- memorack.gemspec
|
184
229
|
- spec/memorack_spec.rb
|
185
230
|
- spec/spec_helper.rb
|
186
|
-
-
|
231
|
+
- REVISION
|
187
232
|
homepage: https://github.com/gnue/memorack
|
188
|
-
licenses:
|
233
|
+
licenses:
|
234
|
+
- MIT
|
189
235
|
metadata: {}
|
190
236
|
post_install_message: "\n ==================\n Quick Start\n\n $ memorack
|
191
237
|
create memo\n $ cd memo\n $ rackup\n\n ==================\n "
|