Skip to content

Commit 5aa23f0

Browse files
authored
Merge pull request #1682 from coderdojo-japan/use-public-folder-for-public-docs
Refactor: Use `/public` folder for public docs:
2 parents a3eedeb + 59ba6c4 commit 5aa23f0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+9
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion

app/models/document.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class Document
22
attr_reader :id, :filename
3-
DIR_PATH = 'db/docs'
4-
URL_PATH = 'docs'
3+
DIR_PATH = 'public/docs'
4+
URL_PATH = '/docs'
55

66
class << self
77
def all
@@ -33,7 +33,7 @@ def updated_at
3333
return "2020-02-02T12:34:56+09:00" unless Rails.env.production?
3434

3535
# Call GitHub API in Production
36-
uri = URI.parse("https://api.github.com/repos/coderdojo-japan/coderdojo.jp/commits?path=db/docs/&per_page=1")
36+
uri = URI.parse("https://api.github.com/repos/coderdojo-japan/coderdojo.jp/commits?path=public/docs/&per_page=1")
3737
json = Net::HTTP.get(uri)
3838
data = JSON.parse(json)
3939

@@ -52,7 +52,7 @@ def updated_at
5252
end
5353

5454
def url
55-
"/#{URL_PATH}/#{self.filename}"
55+
"#{URL_PATH}/#{self.filename}"
5656
end
5757

5858
def exists?

config/initializers/mime_types.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22

33
# Add new mime types for use in respond_to blocks:
44
# Mime::Type.register "text/richtext", :rtf
5+
6+
# MarkdownファイルのMIMEタイプを設定
7+
Mime::Type.register 'text/markdown', :md, %w( text/plain )
8+
Rack::Mime::MIME_TYPES['.md'] = 'text/markdown; charset=utf-8'

0 commit comments

Comments
 (0)