File tree 3 files changed +44
-0
lines changed
3 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -9,3 +9,5 @@ vendor/bundle
9
9
doc /
10
10
11
11
config /* .yaml
12
+
13
+ /archive- *
Original file line number Diff line number Diff line change 4
4
5
5
### 追加
6
6
7
+ * アーカイブ作成スクリプトを追加した。
8
+
7
9
### 変更
8
10
9
11
## [ 0.1.0] - 2020-05-24
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
+ require 'pathname'
4
+
3
5
require 'rake/testtask'
4
6
require 'yard'
5
7
@@ -27,4 +29,42 @@ YARD::Rake::YardocTask.new do |t|
27
29
]
28
30
end
29
31
32
+ desc 'タグ t のアーカイブを作成する'
33
+ task :archive , [ :t ] do |_t , args |
34
+ tag = args [ :t ]
35
+ raise ArgumentError , 'タグを指定してください' unless tag
36
+
37
+ m = tag . match ( /\A v(\d +\. \d +\. \d +.*)/ )
38
+ raise ArgumentError , "無効なタグの書式です: #{ tag } " unless m
39
+
40
+ ver = m [ 1 ]
41
+ prefix = "bcdice-irc-#{ ver } "
42
+ tmp_dir = "archive-#{ ver } "
43
+
44
+ # @type [Pathname]
45
+ tmp_dir_prefix_path = Pathname . new ( tmp_dir ) / prefix
46
+ tmp_dir_prefix_path . mkpath
47
+
48
+ # BCDice IRCのファイルをコピーする
49
+ sh "git archive --format=tar #{ tag } | (cd #{ tmp_dir_prefix_path } && tar -xf -)"
50
+
51
+ sh "git checkout #{ tag } "
52
+ sh 'git submodule update'
53
+
54
+ cd ( 'vendor/bcdice' ) do
55
+ # BCDiceのファイルをコピーする
56
+ sh "git archive --format=tar --prefix=vendor/bcdice/ HEAD | (cd ../../#{ tmp_dir_prefix_path } && tar -xf -)"
57
+ end
58
+
59
+ cd ( tmp_dir ) do
60
+ prefix_with_bcdice = "#{ prefix } -with-bcdice"
61
+
62
+ # アーカイブを作成する
63
+ sh "tar -zcf #{ prefix_with_bcdice } .tar.gz #{ prefix } "
64
+ sh "zip -r #{ prefix_with_bcdice } .zip #{ prefix } "
65
+
66
+ rm_r prefix
67
+ end
68
+ end
69
+
30
70
task default : :test
You can’t perform that action at this time.
0 commit comments