Skip to content

Commit 1cf53d6

Browse files
committed
Disable comment import for now
1 parent a0c139f commit 1cf53d6

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

Gemfile

-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ source "https://rubygems.org"
33

44
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
55

6-
gem 'docbase'
76
gem 'esa'
87
gem 'pry'

Gemfile.lock

+3-7
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@ GEM
22
remote: https://rubygems.org/
33
specs:
44
coderay (1.1.2)
5-
docbase (0.1.2)
6-
faraday (~> 0.9.2)
7-
faraday_middleware (~> 0.10.0)
8-
esa (1.13.0)
5+
esa (1.13.1)
96
faraday (~> 0.9)
107
faraday_middleware
118
mime-types (~> 2.6)
129
multi_xml (~> 0.5.5)
13-
faraday (0.9.2)
10+
faraday (0.13.1)
1411
multipart-post (>= 1.2, < 3)
15-
faraday_middleware (0.10.1)
12+
faraday_middleware (0.12.2)
1613
faraday (>= 0.7.4, < 1.0)
1714
method_source (0.9.0)
1815
mime-types (2.99.3)
@@ -26,7 +23,6 @@ PLATFORMS
2623
ruby
2724

2825
DEPENDENCIES
29-
docbase
3026
esa
3127
pry
3228

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ DocBaseからesa.ioへのインポートスクリプトのサンプルです
1313

1414
## スクリプトの用意
1515

16+
※ スクリプトの作成・動作確認はRuby2.4.1で行っております
17+
1618
```
1719
$ git clone https://github.com/fukayatsu/d2e.git
1820
$ bundle install
@@ -26,6 +28,8 @@ $ cp config.sample.yml config.yml
2628
- `config.yml` にAPIトークンや設定を記述します
2729
- `users.yml` にdocbase上のユーザー名とesa上のユーザー名の紐付けを記述します
2830
- 必要に応じてimporter.rbの内容を変更します。
31+
- docbase上のデータをesa上のデータに変更する部分を主に調整していただくと良さそうです。
32+
- => https://github.com/fukayatsu/d2e/blob/master/lib/converter.rb
2933

3034
## スクリプトの動作確認(Dry Run)
3135

lib/converter.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ def post_params(content)
2929
end
3030

3131
def comments_params(comment_content)
32+
# NOTE: DocBaseのJSONエクスポート機能にコメントが暗号化されたまま出力される不備があり、
33+
# 問い合わせた結果修正待ちの状態
3234
body_md = <<~EOT
3335
created_at: #{comment_content['created_at']}
3436
user_id: #{comment_content['user_id']}
@@ -39,7 +41,7 @@ def comments_params(comment_content)
3941

4042
{
4143
body_md: body_md,
42-
# user: screen_name_for([comment)content['user']['name']])
44+
user: screen_name_for(comment_content['user']['name'])
4345
}
4446
end
4547
end

lib/importer.rb

+8-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,14 @@ def import(dry_run: true, start_index: 0)
3636
exit 1
3737
end
3838

39-
post_number = response.body['number']
40-
params[:comments].each do |comment_param|
41-
client.create_comment(post_number, comment_param)
42-
end
39+
# NOTE: DocBaseのJSONエクスポート機能にコメントが暗号化されたまま出力される不備があり、
40+
# 問い合わせた結果修正待ちの状態
41+
# このままインポート処理をしても読めないコメントがつくので、一旦コメントアウト
42+
43+
# post_number = response.body['number']
44+
# params[:comments].each do |comment_param|
45+
# client.create_comment(post_number, comment_param)
46+
# end
4347
end
4448
end
4549

0 commit comments

Comments
 (0)