carraway 0.1.2 → 0.1.3
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.
- checksums.yaml +4 -4
- data/lib/carraway/post.rb +2 -2
- data/lib/carraway/server.rb +14 -10
- data/lib/carraway/version.rb +1 -1
- data/lib/carraway/views/edit.erb +3 -3
- data/lib/carraway/views/layout.erb +3 -3
- data/lib/carraway/views/new.erb +1 -1
- data/lib/carraway/views/top.erb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc4bed22dfa184283c6759f303618a90d96af98e3a0a5db6b5043505fa2cfebd
|
4
|
+
data.tar.gz: 415b55a32d6e4136e48bf6fcea91135a7c2d3c59200a3e65dde015d88eceab75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e1285c808361afaea53181949015f9f5923f6bf464e75584bf700035433a32530271bac82b5be44efbc406b2f3ce8a0e4bafb1fa6f8213f016283efbc131204
|
7
|
+
data.tar.gz: 0d679cc4b3e1be005738c7febeb329f2779939b50186952aff5191f0496cbd4c6768b675228aefa68961833edc466dd2bcb57c3144094a3e8711b9b7d6ad0a5d
|
data/lib/carraway/post.rb
CHANGED
@@ -12,8 +12,8 @@ module Carraway
|
|
12
12
|
{ attribute_name: :path, key_type: "HASH" },
|
13
13
|
],
|
14
14
|
provisioned_throughput: {
|
15
|
-
read_capacity_units: 5,
|
16
|
-
write_capacity_units: 5,
|
15
|
+
read_capacity_units: 5, # FIXME configurable
|
16
|
+
write_capacity_units: 5, # FIXME configurable
|
17
17
|
},
|
18
18
|
table_name: Config.backend['table_name'],
|
19
19
|
)
|
data/lib/carraway/server.rb
CHANGED
@@ -10,27 +10,31 @@ module Carraway
|
|
10
10
|
use Rack::Flash
|
11
11
|
|
12
12
|
get '/' do
|
13
|
+
redirect '/carraway'
|
14
|
+
end
|
15
|
+
|
16
|
+
get '/carraway' do
|
13
17
|
@categories = Category.all
|
14
18
|
@category_posts = Post.all.group_by {|post| post.category.key }
|
15
19
|
erb :top
|
16
20
|
end
|
17
21
|
|
18
|
-
get '/api/posts' do
|
22
|
+
get '/carraway/api/posts' do
|
19
23
|
posts = Post.all.map(&:to_h)
|
20
24
|
{ data: { posts: posts } }.to_json
|
21
25
|
end
|
22
26
|
|
23
|
-
get '/new' do
|
27
|
+
get '/carraway/new' do
|
24
28
|
erb :new
|
25
29
|
end
|
26
30
|
|
27
|
-
get %r{/edit([\w\./]+)} do |path|
|
31
|
+
get %r{/carraway/edit([\w\./]+)} do |path|
|
28
32
|
@post = Post.find(path)
|
29
33
|
# FIXME handle not found
|
30
34
|
erb :edit
|
31
35
|
end
|
32
36
|
|
33
|
-
get %r{/preview([\w\./]+)} do |path|
|
37
|
+
get %r{/carraway/preview([\w\./]+)} do |path|
|
34
38
|
@post = Post.find(path)
|
35
39
|
# FIXME handle not found
|
36
40
|
|
@@ -43,7 +47,7 @@ module Carraway
|
|
43
47
|
redirect "http://localhost:8000#{@post.path}"
|
44
48
|
end
|
45
49
|
|
46
|
-
post '/' do
|
50
|
+
post '/carraway' do
|
47
51
|
@post = Post.create(
|
48
52
|
title: params[:title],
|
49
53
|
path: params[:path],
|
@@ -51,10 +55,10 @@ module Carraway
|
|
51
55
|
category_key: params[:category]
|
52
56
|
)
|
53
57
|
flash[:message] = 'Created'
|
54
|
-
redirect "/edit#{@post.path}"
|
58
|
+
redirect "/carraway/edit#{@post.path}"
|
55
59
|
end
|
56
60
|
|
57
|
-
patch '/update' do
|
61
|
+
patch '/carraway/update' do
|
58
62
|
@post = Post.find(params[:path])
|
59
63
|
# FIXME handle not found
|
60
64
|
@post.assign(
|
@@ -64,14 +68,14 @@ module Carraway
|
|
64
68
|
# FIXME validation
|
65
69
|
@post.save
|
66
70
|
flash[:message] = 'Updated'
|
67
|
-
redirect "/edit#{@post.path}"
|
71
|
+
redirect "/carraway/edit#{@post.path}"
|
68
72
|
end
|
69
73
|
|
70
|
-
delete '/destroy' do
|
74
|
+
delete '/carraway/destroy' do
|
71
75
|
@post = Post.find(params[:path]) # FIXME handle not found
|
72
76
|
@post.destroy
|
73
77
|
flash[:message] = "Deleted #{@post.path}"
|
74
|
-
redirect "/"
|
78
|
+
redirect "/carraway"
|
75
79
|
end
|
76
80
|
end
|
77
81
|
end
|
data/lib/carraway/version.rb
CHANGED
data/lib/carraway/views/edit.erb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<div class="row">
|
2
|
-
<form action="/update" method="POST" class="col s12">
|
2
|
+
<form action="/carraway/update" method="POST" class="col s12">
|
3
3
|
<input type="hidden" name="_method" value="PATCH">
|
4
4
|
<div class="row">
|
5
5
|
<table>
|
@@ -32,8 +32,8 @@
|
|
32
32
|
<button type="submit" class="waves-effect waves-light btn">保存</button>
|
33
33
|
</div>
|
34
34
|
</form>
|
35
|
-
<a class="waves-effect waves-light btn blue" href="<%= "/preview#{@post.path}" %>" target="_blank">プレビュー</a>
|
36
|
-
<form action="/destroy" method="POST" class="col s12">
|
35
|
+
<a class="waves-effect waves-light btn blue" href="<%= "/carraway/preview#{@post.path}" %>" target="_blank">プレビュー</a>
|
36
|
+
<form action="/carraway/destroy" method="POST" class="col s12">
|
37
37
|
<input type="hidden" name="_method" value="DELETE">
|
38
38
|
<input type="hidden" name="path" value="<%= @post.path %>">
|
39
39
|
<div class="col s6">
|
@@ -10,10 +10,10 @@
|
|
10
10
|
<header>
|
11
11
|
<nav>
|
12
12
|
<div class="nav-wrapper">
|
13
|
-
<a href="/" class="brand-logo">Carraway</a>
|
13
|
+
<a href="/carraway" class="brand-logo">Carraway</a>
|
14
14
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
15
|
-
<li><a href="/">記事一覧</a></li>
|
16
|
-
<li><a href="/new">新規作成</a></li>
|
15
|
+
<li><a href="/carraway">記事一覧</a></li>
|
16
|
+
<li><a href="/carraway/new">新規作成</a></li>
|
17
17
|
</ul>
|
18
18
|
</div>
|
19
19
|
</nav>
|
data/lib/carraway/views/new.erb
CHANGED
data/lib/carraway/views/top.erb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carraway
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- adorechic
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
174
|
version: '0'
|
175
175
|
requirements: []
|
176
176
|
rubyforge_project:
|
177
|
-
rubygems_version: 2.7.
|
177
|
+
rubygems_version: 2.7.7
|
178
178
|
signing_key:
|
179
179
|
specification_version: 4
|
180
180
|
summary: GatsbyJS backend
|