carraway 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d2835e6706ba158bdd73017764ce14c198786f00c8fcb847f9b0b955e6d45278
4
- data.tar.gz: b5194263701f9855de0bb342028e773fd3d07d2043e44e117045ca5940ece5e1
3
+ metadata.gz: 6b7a8962d89d229e36626b069fb9337244a15fca9439f489b9efbc97f001b33d
4
+ data.tar.gz: 7a43146ef527e3f6242aeb0a765d1817ff9f08772dca155f6579235c8f16de6c
5
5
  SHA512:
6
- metadata.gz: 275c8a93d8630a376be4c7c901eb9e642bac85838bc05f8b6eca3780a003a0e867f92dfad10d43ae5b90269578bd3689a7aee4d326869e703ccf0af347f582b6
7
- data.tar.gz: d933c705de0388d8727b0c63260be129c3f721e2dccf4bdb2d9071d8adedaef83ad38a6f86366de8f976587bf9488dd7823dee89f44a3d33e34dcd1ea48b7fe0
6
+ metadata.gz: 8560afff599524aa4b0aa4878dac9677904a0731ef884df4921e0669e9db8c7393afd432e2693b1f84286041b976aec3d5224f1cb3fcb782d1c485de1d29bbe5
7
+ data.tar.gz: '0682a499da758eba0eccf43b85471046bd0c4f3675d39052baa2c2f8d3e866b5037edd47e4bfc0a8e24a18db6145b9076b13c0c8a66c47d4ebc5eb82f86e3552'
@@ -7,7 +7,7 @@ env:
7
7
  global:
8
8
  - CC_TEST_REPORTER_ID=6163381913794d34d745b65d61b589c603cda50fb74c94a54ab0c6305c249bc3
9
9
  before_install:
10
- - gem install bundler -v 1.16.2
10
+ - gem install bundler -v 2.0.1
11
11
  - docker-compose -f docker/docker-compose.yml up -d
12
12
  before_script:
13
13
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
@@ -1,5 +1,12 @@
1
1
  # Change Log
2
2
 
3
+ ## [v1.3.0](https://github.com/adorechic/carraway/tree/v1.3.0) (2019-03-15)
4
+ [Full Changelog](https://github.com/adorechic/carraway/compare/v1.2.0...v1.3.0)
5
+
6
+ **Implemented enhancements:**
7
+
8
+ - Show preview only if post has published [\#15](https://github.com/adorechic/carraway/pull/15) ([adorechic](https://github.com/adorechic))
9
+
3
10
  ## [v1.2.0](https://github.com/adorechic/carraway/tree/v1.2.0) (2019-03-11)
4
11
  [Full Changelog](https://github.com/adorechic/carraway/compare/v1.1.0...v1.2.0)
5
12
 
data/README.md CHANGED
@@ -79,6 +79,16 @@ labels:
79
79
  label_key: 'Label title'
80
80
  ```
81
81
 
82
+ ### Customized views
83
+ You can use your erb file as carraway views.
84
+ If `views_dir` option is given, Carraway switches view root directory and use your erb file.
85
+ Carraway just ignores unknown or different erb files.
86
+ Please see default erb in https://github.com/adorechic/carraway/tree/master/lib/carraway/views
87
+
88
+ ```yaml
89
+ views_dir: 'path/to/your/views'
90
+ ```
91
+
82
92
  ## Development
83
93
 
84
94
  ### Run DynamoDB Local
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_dependency 'rack-flash3'
28
28
  spec.add_dependency 'redcarpet'
29
29
 
30
- spec.add_development_dependency "bundler", "~> 1.16"
30
+ spec.add_development_dependency "bundler", "~> 2.0"
31
31
  spec.add_development_dependency "rake", "~> 10.0"
32
32
  spec.add_development_dependency "rspec", "~> 3.0"
33
33
  spec.add_development_dependency "pry"
@@ -27,6 +27,10 @@ module Carraway
27
27
  def labels
28
28
  @config['labels'] || {}
29
29
  end
30
+
31
+ def views_dir
32
+ @config['views_dir'] && ::File.expand_path(Dir.new(@config['views_dir']))
33
+ end
30
34
  end
31
35
  end
32
36
  end
@@ -6,11 +6,17 @@ require 'time'
6
6
 
7
7
  module Carraway
8
8
  class Server < Sinatra::Base
9
- set :views, ::File.expand_path('../views', __FILE__)
10
9
  set :method_override, true
11
10
  enable :sessions
12
11
  use Rack::Flash
13
12
 
13
+ def view(template)
14
+ if Config.views_dir && ::File.exists?("#{Config.views_dir}/#{template}.erb")
15
+ return erb template, views: Config.views_dir
16
+ end
17
+ erb template
18
+ end
19
+
14
20
  get '/' do
15
21
  redirect '/carraway/'
16
22
  end
@@ -21,7 +27,7 @@ module Carraway
21
27
  @category_posts.each do |category, posts|
22
28
  posts.sort_by!(&:updated).reverse!
23
29
  end
24
- erb :top
30
+ view :top
25
31
  end
26
32
 
27
33
  get '/carraway/api/posts' do
@@ -41,14 +47,14 @@ module Carraway
41
47
 
42
48
  get '/carraway/new' do
43
49
  @files = FileRepository.new.all.sort_by!(&:created).reverse!
44
- erb :new
50
+ view :new
45
51
  end
46
52
 
47
53
  get %r{/carraway/edit/(\d+)} do |uid|
48
54
  @post = Post.find(uid)
49
55
  @files = FileRepository.new.all.sort_by!(&:created).reverse!
50
56
  # FIXME handle not found
51
- erb :edit
57
+ view :edit
52
58
  end
53
59
 
54
60
  get %r{/carraway/preview/(\d+)} do |uid|
@@ -127,12 +133,12 @@ module Carraway
127
133
  get %r{/carraway/files/(\d+)} do |uid|
128
134
  # FIXME handle not found
129
135
  @file = FileRepository.new.find(uid)
130
- erb :file_edit
136
+ view :file_edit
131
137
  end
132
138
 
133
139
  get '/carraway/files' do
134
140
  @files = FileRepository.new.all.sort_by!(&:created).reverse!
135
- erb :files
141
+ view :files
136
142
  end
137
143
 
138
144
  patch %r{/carraway/files/(\d+)} do |uid|
@@ -1,3 +1,3 @@
1
1
  module Carraway
2
- VERSION = "1.3.0"
2
+ VERSION = "1.4.0"
3
3
  end
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: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - adorechic
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-15 00:00:00.000000000 Z
11
+ date: 2019-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '1.16'
103
+ version: '2.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '1.16'
110
+ version: '2.0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rake
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -250,7 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
250
250
  - !ruby/object:Gem::Version
251
251
  version: '0'
252
252
  requirements: []
253
- rubygems_version: 3.0.2
253
+ rubygems_version: 3.0.3
254
254
  signing_key:
255
255
  specification_version: 4
256
256
  summary: GatsbyJS backend