Skip to content

Commit b5c0edf

Browse files
authored
Merge pull request #1635 from future-architect/feature
Programming, Infrastructureカテゴリを目視確認
2 parents a50fd06 + e7c16e4 commit b5c0edf

File tree

83 files changed

+222
-89
lines changed

Some content is hidden

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

83 files changed

+222
-89
lines changed

_config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ alias:
127127
tags/モバイルアプリ: categories/Mobile/ # Mobileカテゴリの新設対応
128128
tags/フロントエンド: categories/Frontend/ # Frontendカテゴリの新設対応
129129
tags/VR: categories/VR/ # VRカテゴリと重複排除
130+
tags/データエンジニアリング: categories/DataEngineering/ # DataEngineeringカテゴリの新設対応
131+
130132
# カテゴリの変更
131133
categories/Design: tags/UI-UX/
132134

categorize_data_engineering.py

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
import os
2+
3+
# --- 設定 ---
4+
POSTS_DIRECTORY = 'source/_posts'
5+
# このタグが含まれていたら対象となる
6+
TARGET_TAG = 'データエンジニアリング'
7+
# 上書きする新しいカテゴリ
8+
NEW_CATEGORY = 'DataEngineering'
9+
# --- 設定ここまで ---
10+
11+
def replace_category_for_tag(file_path):
12+
"""
13+
ファイルのfront matterをチェックし、ターゲットタグが含まれていれば
14+
カテゴリを指定したものに置換し、元のタグを削除する。
15+
他の行のフォーマットは保持する。
16+
"""
17+
try:
18+
with open(file_path, 'r', encoding='utf-8') as f:
19+
lines = f.readlines()
20+
21+
# --- ステップ1: まず対象ファイルか判定する ---
22+
in_front_matter = False
23+
in_tags_list = False
24+
has_target_tag = False
25+
for line in lines:
26+
if line.strip() == '---':
27+
if in_front_matter: break
28+
else:
29+
in_front_matter = True
30+
continue
31+
if in_front_matter:
32+
stripped_line = line.strip()
33+
if not line.startswith((' ', '\t')):
34+
in_tags_list = stripped_line.startswith(('tag:', 'tags:'))
35+
if in_tags_list and stripped_line.startswith('-'):
36+
tag_value = stripped_line[1:].strip().strip('\'"')
37+
if tag_value == TARGET_TAG:
38+
has_target_tag = True
39+
break
40+
41+
if not has_target_tag:
42+
return False, "対象外"
43+
44+
# --- ステップ2: 対象ファイルだった場合、内容を書き換える ---
45+
new_lines = []
46+
in_front_matter = False
47+
in_tags_list = False
48+
in_category_list = False
49+
was_modified = False
50+
51+
for line in lines:
52+
if line.strip() == '---':
53+
if in_front_matter:
54+
in_front_matter = False
55+
in_tags_list = False
56+
in_category_list = False
57+
else:
58+
in_front_matter = True
59+
new_lines.append(line)
60+
continue
61+
62+
if in_front_matter:
63+
stripped_line = line.strip()
64+
65+
if not line.startswith((' ', '\t')):
66+
if stripped_line.startswith(('tag:', 'tags:')):
67+
in_tags_list = True
68+
in_category_list = False
69+
elif stripped_line.startswith(('category:', 'categories:')):
70+
new_lines.append(f'category:\n - {NEW_CATEGORY}\n')
71+
in_category_list = True
72+
in_tags_list = False
73+
was_modified = True
74+
continue
75+
else:
76+
in_tags_list = False
77+
in_category_list = False
78+
new_lines.append(line)
79+
continue
80+
81+
if in_category_list and stripped_line.startswith('-'):
82+
was_modified = True
83+
continue
84+
85+
if in_tags_list and stripped_line.startswith('-'):
86+
tag_value = stripped_line[1:].strip().strip('\'"')
87+
if tag_value == TARGET_TAG:
88+
was_modified = True
89+
continue
90+
91+
new_lines.append(line)
92+
else:
93+
new_lines.append(line)
94+
95+
if was_modified:
96+
with open(file_path, 'w', encoding='utf-8') as f:
97+
f.writelines(new_lines)
98+
return True, "カテゴリとタグを変換しました"
99+
else:
100+
return False, "対象タグが見つかりませんでした"
101+
102+
except Exception as e:
103+
return False, f"エラー: {e}"
104+
105+
def main():
106+
"""メイン処理"""
107+
if not os.path.isdir(POSTS_DIRECTORY):
108+
print(f"エラー: '{POSTS_DIRECTORY}' が見つかりません。")
109+
return
110+
111+
print(f"「{TARGET_TAG}」タグを持つ記事のカテゴリを「{NEW_CATEGORY}」に置換します...")
112+
updated_files_count = 0
113+
114+
for root, _, files in os.walk(POSTS_DIRECTORY):
115+
for file in files:
116+
if file.endswith('.md'):
117+
file_path = os.path.join(root, file)
118+
was_updated, message = replace_category_for_tag(file_path)
119+
if was_updated:
120+
updated_files_count += 1
121+
print(f"✅ {message}: {file_path}")
122+
123+
if updated_files_count > 0:
124+
print(f"\n完了しました。合計 {updated_files_count} 個のファイルを修正しました。")
125+
else:
126+
print(f"\n完了しました。修正対象のファイルは見つかりませんでした。")
127+
128+
if __name__ == '__main__':
129+
main()

categorize_mobile_posts.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
POSTS_DIRECTORY = 'source/_posts'
55
# 上記リストから、実際に移行したいタグをここに列挙します
66
TARGET_TAGS = [
7-
'Airflow'
8-
]
7+
'Glue'
8+
]
99
# 上書きする新しいカテゴリ
10-
NEW_CATEGORY = 'Infrastructure'
10+
NEW_CATEGORY = 'DataEngineering'
1111
# --- 設定ここまで ---
1212

1313
def replace_category_for_mobile_tags(file_path):

source/_posts/2018/20180828-gluw.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ tag:
66
- AWS
77
- データレイク
88
- Glue
9-
- データエンジニアリング
109
- ETL
1110
category:
12-
- Infrastructure
11+
- DataEngineering
1312
author: 澤田周吾
1413
lede: "業務で用いたAWS Glueの概要・開発Tips・ハマったところについて共有します"
1514
---

source/_posts/2018/20181205-glue-performance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ tag:
77
- Glue
88
- 性能検証
99
category:
10-
- Infrastructure
10+
- DataEngineering
1111
author: 千葉駿
1212
lede: "大量データをさばくために、Glueの性能についてあれやこれややった検証結果の一部を公開します"
1313
---

source/_posts/2019/20190702-aws-handson.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ tag:
77
- データレイク
88
- ハンズオン
99
category:
10-
- Infrastructure
10+
- DataEngineering
1111
author: 柳澤隆太郎
1212
lede: "あるプロジェクトでデータ分析基盤を開発することになり、データレイクを中心としたソリューションについて学ぶためにAWS Datalake Hands-onに参加してきました"
1313
---

source/_posts/2019/20190708-gcp-iam.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ tag:
66
- GoogleCloud
77
- IAM
88
- 失敗談
9+
- トラブルシュート
910
category:
1011
- Infrastructure
1112
author: 村田靖拓

source/_posts/2019/20191101-aws.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ tag:
66
- AWS
77
- Glue
88
category:
9-
- Infrastructure
9+
- DataEngineering
1010
author: 村瀬善則
1111
lede: "AWS Glue利用していますか?ETL処理をする上で大変便利ですよね。しかしながら開発に必要不可欠な開発エンドポイントが少々お高く、もう少し安価に利用できればなーと思っていたところ、さすがAWSさん素敵なリリースをしてくれました。"
1212
---

source/_posts/2019/20191206-glue.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ tag:
1111
- 環境構築
1212
- テスト
1313
category:
14-
- DevOps
14+
- DataEngineering
1515
author: 多賀聡一朗
1616
lede: "当記事では、AWS Glue をローカル環境で単体テストするための環境構築方法についてまとめました。"
1717
---

source/_posts/2020/20200207-gcp-cloudrun.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ tag:
88
- サーバーレス
99
- CloudRun
1010
- go-chi
11+
- 管理画面
1112
category:
12-
- Programming
13+
- Frontend
1314
author: 澁川喜規
1415
lede: "Go + Vue + Cloud Runでかんたんな管理画面を作ろうと思います。ストレージ側にもサーバーレスがあります。MySQLやPostgreSQLのクラウドサービス(Cloud SQLとかRDS)は、サーバーマシンを可動させて、その上にDBMSが稼働しますので、起動している時間だけお金がかかってしまします。一方、FirestoreやDynamoDBの場合は容量と通信(と、キャパシティユニット)にしかお金がかからないモデルになっており、サーバーレスです。今回はかんたん化のためにストレージは扱いません。"
1516
---

0 commit comments

Comments
 (0)