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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e8ff3f506afc0aeb198eba3d79b4c0ae789c052e449dbfd7b4b470ba33ae96b
4
- data.tar.gz: 8e008f2eac3bb8127672a164525728070d0c56ea06f46bc1993a70a51a342dea
3
+ metadata.gz: cc4bed22dfa184283c6759f303618a90d96af98e3a0a5db6b5043505fa2cfebd
4
+ data.tar.gz: 415b55a32d6e4136e48bf6fcea91135a7c2d3c59200a3e65dde015d88eceab75
5
5
  SHA512:
6
- metadata.gz: d0ef06484d40b89cd987778f8ff8fc9811b7a73d63f9fbc6ca92c558d8cea3e0b1cece3cd67d69d248da51a9ba28e234c83fa7e78a8753cb4ae3865f44c838dc
7
- data.tar.gz: 50234d72956cda17207b6a7baae09634177c5978cab260ecf0c480a4da5863cf3abfd8031e4ed6b806a94264927639d7481933211602f7b1d5d6e8f6eec37942
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
  )
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Carraway
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -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>
@@ -1,5 +1,5 @@
1
1
  <div class="row">
2
- <form action="/" method="POST" class="col s12">
2
+ <form action="/carraway" method="POST" class="col s12">
3
3
  <div class="row">
4
4
  <label>記事カテゴリー</label>
5
5
  <select name="category" class="browser-default">
@@ -5,7 +5,7 @@
5
5
  </li>
6
6
  <% Array(@category_posts[category.key]).each do |post| %>
7
7
  <li class="collection-item">
8
- <a href="/edit<%= post.path %>"><%= post.title %></a>
8
+ <a href="/carraway/edit<%= post.path %>"><%= post.title %></a>
9
9
  </li>
10
10
  <% end %>
11
11
  </ul>
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.2
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-27 00:00:00.000000000 Z
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.6
177
+ rubygems_version: 2.7.7
178
178
  signing_key:
179
179
  specification_version: 4
180
180
  summary: GatsbyJS backend