trahald 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. data/.gitignore +2 -1
  2. data/.travis.yml +16 -0
  3. data/Gemfile.lock +58 -0
  4. data/README.md +29 -8
  5. data/lib/public/lib/markdown/markdown.js +1616 -0
  6. data/lib/public/lib/masonry/jquery.masonry.min.js +10 -0
  7. data/lib/public/lib/reveal/markdown.js +151 -0
  8. data/lib/public/lib/reveal/showdown.js +62 -0
  9. data/lib/public/lib/reveal/theme/beige.css +142 -0
  10. data/lib/public/lib/reveal/theme/default.css +150 -0
  11. data/lib/public/lib/reveal/theme/moon.css +142 -0
  12. data/lib/public/lib/reveal/theme/night.css +130 -0
  13. data/lib/public/lib/reveal/theme/serif.css +130 -0
  14. data/lib/public/lib/reveal/theme/simple.css +132 -0
  15. data/lib/public/lib/reveal/theme/sky.css +136 -0
  16. data/lib/public/lib/reveal/theme/solarized.css +142 -0
  17. data/lib/trahald.rb +90 -11
  18. data/lib/trahald/.redis-client.rb.swn +0 -0
  19. data/lib/trahald/article.rb +34 -0
  20. data/lib/trahald/backend-base.rb +13 -0
  21. data/lib/trahald/git.rb +46 -1
  22. data/lib/trahald/markdown-body.rb +44 -0
  23. data/lib/trahald/redis-client.rb +33 -9
  24. data/lib/trahald/version.rb +1 -1
  25. data/lib/views/edit.slim +47 -10
  26. data/lib/views/fd.scss +22 -0
  27. data/lib/views/header.slim +13 -0
  28. data/lib/views/layout.slim +7 -4
  29. data/lib/views/list.slim +3 -1
  30. data/lib/views/page.slim +5 -8
  31. data/lib/views/slide.slim +37 -0
  32. data/lib/views/style.scss +3 -1
  33. data/lib/views/summary.slim +36 -0
  34. data/lib/views/tab.slim +10 -0
  35. data/lib/views/tab_edit.slim +10 -0
  36. data/spec/git_spec.rb +3 -23
  37. data/spec/redis-client_spec.rb +3 -25
  38. data/spec/spec_helper.rb +2 -1
  39. data/spec/support/shared_examples_for_backends.rb +38 -0
  40. data/trahald.gemspec +1 -0
  41. metadata +44 -4
@@ -0,0 +1,10 @@
1
+ div class="tabs-below"
2
+ ul class="nav nav-tabs"
3
+ li class="active"
4
+ a href="/#{@name}" 表示
5
+ li
6
+ a href="/#{@name}/edit" 編集
7
+ li
8
+ a href="/#{@name}.md" target="_blank" Raw
9
+ li
10
+ a href="/#{@name}/slide" target="_blank" スライド
@@ -0,0 +1,10 @@
1
+ div class="tabs-below"
2
+ ul class="nav nav-tabs"
3
+ li
4
+ a href="/#{@name}" 表示
5
+ li class="active"
6
+ a href="/#{@name}/edit" 編集
7
+ li
8
+ a href="/#{@name}.md" target="_blank" Raw
9
+ li
10
+ a href="/#{@name}/slide" target="_blank" スライド
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
3
 
4
- describe "Trahald::Git" do
4
+ describe "Trahald::Git", :if => defined? Trahald::Git do
5
5
  before(:all) do
6
6
  @dir = File.expand_path(File.dirname(__FILE__) + '/repos_for_spec')
7
7
  @git = Trahald::Git.new(@dir)
@@ -13,32 +13,12 @@ describe "Trahald::Git" do
13
13
  FileTest.exist?(@dir).should be_true
14
14
  end
15
15
 
16
- it "should enable to add and commit some files." do
17
- name1 = "sample"
18
- body1 = "# title\n\n* hoge\n* huga\n* 123"
19
- name2 = "サンプル"
20
- body2 = "# タイトル\n\n* いち\n* に\n* さん"
21
- name3 = "サンプル/初夢"
22
- body3 = "# タイトル\n\n* 富士\n* 鷹\n* なすび"
23
- @git.add!(name1, body1)
24
- @git.add!(name2, body2)
25
- @git.add!(name3, body3)
26
- message = "コミット"
27
-
28
- @git.commit!(message).should be_true
29
- @git.body(name1).should == body1
30
- @git.body(name2).should == body2
31
- @git.body(name3).should == body3
32
- end
33
-
34
- it "should enable to output list." do
35
- @git.list.should == ['sample', 'サンプル', 'サンプル/初夢']
16
+ it_behaves_like 'backend db' do
17
+ let(:db) { @git }
36
18
  end
37
19
 
38
20
  after(:all) do
39
21
  if FileTest.exist? @dir
40
- Dir.glob(@dir + '/**/').each{|e|
41
- puts e}
42
22
  FileUtils.rm_rf(Dir.glob(@dir + '/**/'))
43
23
  end
44
24
  end
@@ -1,37 +1,15 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
3
 
4
- describe "Trahald::RedisClient" do
4
+ describe "Trahald::RedisClient", :if => defined? Trahald::RedisClient do
5
5
  before(:all) do
6
6
  @url = "redis://localhost:6379/"
7
7
  @redis = Trahald::RedisClient.new(@url)
8
8
  @redis.flush!
9
9
  end
10
10
 
11
- it "should contains no data at first" do
12
- @redis.list.should == []
13
- end
14
-
15
- it "should enable to save some data." do
16
- name1 = "sample"
17
- body1 = "# title\n\n* hoge\n* huga\n* 123"
18
- name2 = "サンプル"
19
- body2 = "# タイトル\n\n* いち\n* に\n* さん"
20
- name3 = "サンプル/初夢"
21
- body3 = "# タイトル\n\n* 富士\n* 鷹\n* なすび"
22
- @redis.add!(name1, body1)
23
- @redis.add!(name2, body2)
24
- @redis.add!(name3, body3)
25
- message = "コミット"
26
-
27
- @redis.commit!(message).should be_true
28
- @redis.body(name1).should == body1
29
- @redis.body(name2).should == body2
30
- @redis.body(name3).should == body3
31
- end
32
-
33
- it "should enable to output list." do
34
- @redis.list.should == ['sample', 'サンプル', 'サンプル/初夢']
11
+ it_behaves_like 'backend db' do
12
+ let(:db) { @redis }
35
13
  end
36
14
 
37
15
  it "should enable to flush data" do
@@ -5,5 +5,6 @@ require 'bundler/setup'
5
5
  require_relative '../lib/trahald'
6
6
 
7
7
  RSpec.configure do |config|
8
+ # require shared examples
9
+ Dir["./spec/support/**/*.rb"].sort.each {|f| require f}
8
10
  end
9
-
@@ -0,0 +1,38 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ shared_examples 'backend db' do
4
+ it "should contains no data at first" do
5
+ db.list.should == []
6
+ end
7
+
8
+ it "should enable to add and commit a file" do
9
+ message = "コミット"
10
+ name1 = "sample"
11
+ body1 = "# title\n\n* hoge\n* huga\n* 123"
12
+ db.add!(name1, body1).should be_true
13
+ db.commit!(message).should be_true
14
+ db.body(name1).should == body1
15
+ end
16
+
17
+ it "should enable to add and commit an another file" do
18
+ message = "コミット"
19
+ name2 = "サンプル"
20
+ body2 = "# タイトル\n\n* いち\n* に\n* さん"
21
+ db.add!(name2, body2).should be_true
22
+ db.commit!(message).should be_true
23
+ db.body(name2).should == body2
24
+ end
25
+
26
+ it "should enable to add and commit an yet another file" do
27
+ message = "コミット"
28
+ name3 = "サンプル/初夢"
29
+ body3 = "# タイトル\n\n* 富士\n* 鷹\n* なすび"
30
+ db.add!(name3, body3).should be_true
31
+ db.commit!(message).should be_true
32
+ db.body(name3).should == body3
33
+ end
34
+
35
+ it "should enable to output list" do
36
+ db.list.should == ['sample', 'サンプル', 'サンプル/初夢']
37
+ end
38
+ end
@@ -19,6 +19,7 @@ Gem::Specification.new do |gem|
19
19
 
20
20
  gem.add_dependency('kramdown', '~> 0.14.2')
21
21
  gem.add_dependency('sass', '~>3.2.6')
22
+ gem.add_dependency('sanitize', '~>2.0.3')
22
23
  gem.add_dependency('sinatra', '~>1.3.5')
23
24
  gem.add_dependency('slim', '~>1.3.6')
24
25
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trahald
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-06 00:00:00.000000000 Z
12
+ date: 2013-03-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: kramdown
@@ -43,6 +43,22 @@ dependencies:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
45
  version: 3.2.6
46
+ - !ruby/object:Gem::Dependency
47
+ name: sanitize
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 2.0.3
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 2.0.3
46
62
  - !ruby/object:Gem::Dependency
47
63
  name: sinatra
48
64
  requirement: !ruby/object:Gem::Requirement
@@ -117,26 +133,49 @@ files:
117
133
  - .gitignore
118
134
  - .travis.yml
119
135
  - Gemfile
136
+ - Gemfile.lock
120
137
  - LICENSE.txt
121
138
  - README.md
122
139
  - Rakefile
123
140
  - config.ru
141
+ - lib/public/lib/markdown/markdown.js
142
+ - lib/public/lib/masonry/jquery.masonry.min.js
143
+ - lib/public/lib/reveal/markdown.js
144
+ - lib/public/lib/reveal/showdown.js
145
+ - lib/public/lib/reveal/theme/beige.css
146
+ - lib/public/lib/reveal/theme/default.css
147
+ - lib/public/lib/reveal/theme/moon.css
148
+ - lib/public/lib/reveal/theme/night.css
149
+ - lib/public/lib/reveal/theme/serif.css
150
+ - lib/public/lib/reveal/theme/simple.css
151
+ - lib/public/lib/reveal/theme/sky.css
152
+ - lib/public/lib/reveal/theme/solarized.css
124
153
  - lib/trahald.rb
154
+ - lib/trahald/.redis-client.rb.swn
155
+ - lib/trahald/article.rb
125
156
  - lib/trahald/backend-base.rb
126
157
  - lib/trahald/git.rb
158
+ - lib/trahald/markdown-body.rb
127
159
  - lib/trahald/redis-client.rb
128
160
  - lib/trahald/version.rb
129
161
  - lib/views/edit.slim
162
+ - lib/views/fd.scss
163
+ - lib/views/header.slim
130
164
  - lib/views/index.slim
131
165
  - lib/views/layout.slim
132
166
  - lib/views/list.slim
133
167
  - lib/views/page.slim
134
168
  - lib/views/raw.slim
135
169
  - lib/views/raw_layout.slim
170
+ - lib/views/slide.slim
136
171
  - lib/views/style.scss
172
+ - lib/views/summary.slim
173
+ - lib/views/tab.slim
174
+ - lib/views/tab_edit.slim
137
175
  - spec/git_spec.rb
138
176
  - spec/redis-client_spec.rb
139
177
  - spec/spec_helper.rb
178
+ - spec/support/shared_examples_for_backends.rb
140
179
  - trahald.gemspec
141
180
  homepage: ''
142
181
  licenses: []
@@ -152,7 +191,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
191
  version: '0'
153
192
  segments:
154
193
  - 0
155
- hash: -233894239
194
+ hash: -162600015
156
195
  required_rubygems_version: !ruby/object:Gem::Requirement
157
196
  none: false
158
197
  requirements:
@@ -161,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
200
  version: '0'
162
201
  segments:
163
202
  - 0
164
- hash: -233894239
203
+ hash: -162600015
165
204
  requirements: []
166
205
  rubyforge_project:
167
206
  rubygems_version: 1.8.24
@@ -172,3 +211,4 @@ test_files:
172
211
  - spec/git_spec.rb
173
212
  - spec/redis-client_spec.rb
174
213
  - spec/spec_helper.rb
214
+ - spec/support/shared_examples_for_backends.rb