Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

clab-team/r326-gcal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

r326-gcal

MIT License dependencies devDependencies

「りざぶ郎」に登録された予定をGoogle Calendarに同期するスクリプト

Live Demo

筑波大学春日エリア 情報メディアユニオン クリエイティブメディアラボの予約票

Usage

⚠️ このスクリプトは、実行時点でりざぶ郎に存在しない予定をGoogleカレンダーから消去します。 既存のGoogleカレンダーに誤って連携し、予定を消去することのないようにご注意ください。

⚠️ Once be executed, this script will erase all events on Google Calendar that not in r326.com. Be careful not to target Google Calendar that already used for any other purposes, or you will lose events on Google Calendar.


r326-gcalは、Google Apps Scriptを基盤として動作します。Googleサービスへのログインを簡素化できる他、定期実行が簡単に設定できる利点があります。

デプロイのためにNode.jsおよびyarnを利用します。

# 依存パッケージのインストール
$ yarn

# Google Apps Scriptを操作するclaspのログイン操作
$ npx clasp login

# - claspで新規にGoogle Apps Scriptのプロジェクトを作成、割り当て
#   プロジェクトタイプを選択する必要がある場合は "standalone" を選びます
npx clasp create [PROJECT_NAME] --rootDir src

# デプロイ
# - Google Apps Scriptにデプロイが行われます
$ yarn deploy
  • 以下の値をScriptProperties(ファイル->プロジェクトのプロパティ)に追加してください。
    • r326Id: りざぶ郎の予定表ID(https://r326.com/b/a.aspx?id=に続く値)
    • calendarId: GoogleカレンダーのID(個々のカレンダーの設定画面にある、Eメールアドレスの形をした文字列)
  • script.google.comから、index.gsに含まれる関数syncを実行することで、同期が行われます。
    • 初回の実行を行う際に、プロジェクトを作成したアカウントへの認証が行われます。
  • Google Apps Scriptのコンソールからトリガーを作成することで定期実行を行うことができます。

dev

# コードのLintにESLintを導入しています。
$ yarn lint
$ yarn lint --fix