diff --git a/pom.xml b/pom.xml
index ec89047..bc1e8ef 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
info.istlab.IoTP
IoTP
jar
- 0.41
+ 0.42
IoTP
http://maven.apache.org
diff --git a/src/main/java/info/istlab/IoTP/ConfigManager.java b/src/main/java/info/istlab/IoTP/ConfigManager.java
new file mode 100644
index 0000000..70a1fc0
--- /dev/null
+++ b/src/main/java/info/istlab/IoTP/ConfigManager.java
@@ -0,0 +1,63 @@
+package info.istlab.IoTP;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+
+public class ConfigManager {
+
+ File userdir;
+
+ public ConfigManager(String dir) {
+ if (dir == null) {
+ userdir = new File(System.getProperty("user.home"));
+ } else {
+ userdir = new File(dir);
+ }
+ }
+
+ public String getDate(int plusday){
+ // 現在の日付を取得
+ LocalDate today = LocalDate.now();
+ // plusday日後の日付を計算
+ LocalDate futureDate = today.plusDays(plusday);
+ // 日付文字列のフォーマットを指定
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ // フォーマットに従って日付文字列を生成
+ return futureDate.format(formatter);
+ }
+
+ // 10日先の日付を設定する
+ public void write() {
+ try {
+ File file = new File(userdir.getAbsolutePath() + File.separator + ".iotp.conf");
+ FileWriter fw = new FileWriter(file);
+ fw.write(getDate(10));
+ fw.close();
+ } catch (IOException e) {
+ System.out.println(e);
+ }
+ }
+
+ public boolean readAndCheckDate(){
+ BufferedReader br;
+ try {
+ File file = new File(userdir.getAbsolutePath() + File.separator + ".iotp.conf");
+ FileReader fr = new FileReader(file);
+ br = new BufferedReader(fr);
+ String today = getDate(0);
+ String line = br.readLine();
+ System.out.println(line+" "+today+" "+line.compareTo(today));
+ if (br != null) br.close();
+ return (line.compareTo(today)>0);
+ } catch (IOException e) {
+ // System.out.println(e);
+ return false;
+ }
+ }
+
+}
diff --git a/src/main/java/info/istlab/IoTP/GitManager.java b/src/main/java/info/istlab/IoTP/GitManager.java
index 58ba7a2..459ccfe 100644
--- a/src/main/java/info/istlab/IoTP/GitManager.java
+++ b/src/main/java/info/istlab/IoTP/GitManager.java
@@ -22,12 +22,20 @@
Git git = null;
Repository repository;
+ ConfigManager configman;
public GitManager(File root) throws IOException {
repository = Git.open(new File(root.getParentFile().getAbsolutePath() + File.separator + ".git"))
.getRepository();
+ configman = new ConfigManager(App.userhome);
}
+ /**
+ * Gitのリポジトリ状況を確認する
+ *
+ * @throws NoWorkTreeException
+ * @throws GitAPIException
+ */
public void checkClean() throws NoWorkTreeException, GitAPIException {
git = new Git(repository);
@@ -36,6 +44,10 @@
Status status = statusCommand.call();
if (!status.isClean()) {
+ // もし、延期ファイルがあって、延期ファイルの日付よりも今日の日付のほうが早いなら、チェックをスキップする(イコールのときはスキップしない)
+ if (configman.readAndCheckDate())
+ return;
+
System.out.println("Gitのローカルリポジトリに変更点があります。");
Set changedFiles = status.getModified();
Set untrackedFiles = status.getUntracked();
@@ -57,8 +69,9 @@
JOptionPane.YES_NO_CANCEL_OPTION);
if (res == JOptionPane.YES_OPTION) {
stash();
+ configman.write();
} else {
-
+ configman.write();
}
} else {
System.out.println("No uncommitted changes in the local repository.");
@@ -87,15 +100,15 @@
}
public void showNotice() {
- JOptionPane.showMessageDialog(Launcher.theapp, "(1) デバイスを認識すると,タイトルバーに COM3 のように表示します。\n"+//
- " 複数みえるときはWindowsのデバイスマネージャ>ポートでM5Stickのポート番号を調べたうえで,\n"+//
- " このプログラムの Serialメニュー から,書き込み先ポートを選んでください。\n\n"+//
- "(2) デバイスを認識しないときは,このプログラムを再起動してみてください。\n"+//
- " (Appメニュー>このプログラムを再起動する)\n\n"+//
- "(3) デバイスを返却するときは,FactoryTest を書き込んでおいてください。\n"+//
- " (Fileメニュー>FactoryTestを書き込む)\n\n"+ //
- " デバイスは充電した状態で返却してください。"//
- , "IoTP実験における大事な注意点です。たくさんありますがしっかり読んでください。", JOptionPane.WARNING_MESSAGE);
+ JOptionPane.showMessageDialog(Launcher.theapp, "(1) デバイスを認識すると,タイトルバーに COM3 のように表示します。\n" + //
+ " 複数みえるときはWindowsのデバイスマネージャ>ポートでM5Stickのポート番号を調べたうえで,\n" + //
+ " このプログラムの Serialメニュー から,書き込み先ポートを選んでください。\n\n" + //
+ "(2) デバイスを認識しないときは,このプログラムを再起動してみてください。\n" + //
+ " (Appメニュー>このプログラムを再起動する)\n\n" + //
+ "(3) デバイスを返却するときは,FactoryTest を書き込んでおいてください。\n" + //
+ " (Fileメニュー>FactoryTestを書き込む)\n\n" + //
+ " デバイスは充電した状態で返却してください。"//
+ , "IoTP実験における大事な注意点です。たくさんありますがしっかり読んでください。", JOptionPane.WARNING_MESSAGE);
}
}
diff --git a/src/main/java/info/istlab/IoTP/Launcher.java b/src/main/java/info/istlab/IoTP/Launcher.java
index ed47df2..713220a 100644
--- a/src/main/java/info/istlab/IoTP/Launcher.java
+++ b/src/main/java/info/istlab/IoTP/Launcher.java
@@ -31,7 +31,7 @@
public class Launcher extends JFrame implements MouseInputListener, KeyListener, Runnable {
public static Launcher theapp;
- public static String version = "0.41";
+ public static String version = "0.42";
static int reboot_msec = 2000;
// JPanel mainP;
File root;