shipit 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/ChangeLog +59 -0
  2. data/Rakefile +2 -2
  3. data/lib/shipit.rb +45 -58
  4. metadata +2 -2
data/ChangeLog CHANGED
@@ -1,5 +1,64 @@
1
1
  2008-01-05 cho45
2
2
 
3
+ * [r4075] lib/shipit.rb:
4
+
5
+ タスクの実行を内部でやらないように (version をよみなおすため)
6
+ いろいろやってみたけどこれがいちばん簡単なようだ……
7
+
8
+ * [r4073] lib/shipit.rb:
9
+
10
+ version のかきかえがうまくいかず、重複してリリースできない問題を修正
11
+
12
+ * [r4071] lib/shipit.rb:
13
+
14
+ 変更が残っている場合にはリリースコミットをできないように
15
+
16
+ * [r4070] lib/shipit.rb:
17
+
18
+ 定数参照の修正漏れ
19
+
20
+ * [r4069] lib/shipit.rb:
21
+
22
+ run phase 時にエラーがでないように定数参照は prepare 時にするように
23
+
24
+ * [r4068] Rakefile, lib/shipit.rb:
25
+
26
+ ChangeVersion の仕様をよくあるほうに変更
27
+ s.ChangeVersion filename, "VERSION"
28
+
29
+ * [r4054] lib/shipit.rb:
30
+
31
+ tag のとき -m 追加 (エディタがひらいてしまっていた)
32
+
33
+ * [r4052] ChangeLog, Rakefile:
34
+
35
+ Release 0.0.2
36
+
37
+ * [r4051] ., README:
38
+
39
+ svn:ignore の設定と README のサンプルを Rakefile に追従
40
+
41
+ * [r4050] README, Rakefile, lib/shipit.rb:
42
+
43
+ Step::Tag を追加
44
+
45
+ * [r4048] README:
46
+
47
+ README を更新
48
+
49
+ * [r4047] lib/shipit.rb:
50
+
51
+ 前回のコミットと同じ問題
52
+
53
+ * [r4046] lib/shipit.rb:
54
+
55
+ initialize が走るときにはまだVERSは変更されていないので
56
+ コミットメッセージが矛盾してしまう
57
+
58
+ * [r4045] ChangeLog, Rakefile:
59
+
60
+ Release 0.0.0
61
+
3
62
  * [r4044] Rakefile:
4
63
 
5
64
  引数間違い
data/Rakefile CHANGED
@@ -19,7 +19,7 @@ DESCRIPTION = "Automated release tasks."
19
19
  RUBYFORGE_PROJECT = "lowreal"
20
20
  HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
21
21
  BIN_FILES = %w( )
22
- VERS = "0.0.1"
22
+ VERS = "0.0.3"
23
23
 
24
24
  REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
25
25
  CLEAN.include ['**/.*.sw?', '*.gem', '.config']
@@ -122,7 +122,7 @@ Rake::ShipitTask.new do |s|
122
122
  }.and {
123
123
  system("svn2cl.sh --break-before-msg=2 --group-by-day --include-rev --separate-daylogs")
124
124
  }
125
- s.ChangeVersion
125
+ s.ChangeVersion __FILE__, "VERS"
126
126
  s.Commit
127
127
  s.Task :clean, :package
128
128
  s.RubyForge
data/lib/shipit.rb CHANGED
@@ -81,16 +81,20 @@ class Rake::ShipitTask::Step::Twitter
81
81
  })
82
82
  @client = Twitter::Client.new(@config)
83
83
  raise "Twitter::Client auth failed" unless @client.authenticate?(@config["login"], @config["password"])
84
+
85
+ @description = DESCRIPTION
86
+ @name = NAME
87
+ @vers = VERS
84
88
  end
85
89
 
86
90
  def run
87
- @msg ||= "Released #{NAME} #{VERS} (#{DESCRIPTION})"
91
+ @msg ||= "Released %s %s (%s)" % [@name, @vers, @description]
88
92
  @client.status(:post, @msg)
89
93
  end
90
94
  end
91
95
 
92
96
  class Rake::ShipitTask::Step::ChangeVersion
93
- def initialize(file="Rakefile", name="VERS", vers=VERS)
97
+ def initialize(file, name="VERSION", vers=VERS)
94
98
  @file = file
95
99
  @name = name
96
100
  @vers = vers
@@ -98,17 +102,18 @@ class Rake::ShipitTask::Step::ChangeVersion
98
102
 
99
103
  def prepare
100
104
  require "pathname"
101
- @rakefile = Pathname.new(@file)
102
- @content = @rakefile.read
103
- @match = @content.match(/#{@name}\s*=\s*"(\d+\.\d+\.\d+)"/)
105
+ @file = Pathname.new(@file)
106
+ @content = @file.read
107
+ @match = @content.match(/#{@name}\s*=\s*['"](\d+\.\d+\.\d+)['"]/)
104
108
  @new_version = @match[1].succ
105
- raise "Can't find version string in Rakefile." if @match.nil?
109
+ raise "Can't find version string in #{@file}." if @match.nil?
110
+ puts "Find version string #{@match[1]} and will change to #{@new_version}"
111
+ @vers.replace @new_version
106
112
  end
107
113
 
108
114
  def run
109
115
  puts "Changing version to #{@new_version}"
110
- @vers.replace @new_version
111
- @rakefile.open("w") do |f|
116
+ @file.open("w") do |f|
112
117
  f.print @content[0..@match.begin(1)-1]
113
118
  f.print @new_version
114
119
  f.print @content[@match.end(1)..-1]
@@ -122,10 +127,17 @@ class Rake::ShipitTask::Step::Commit
122
127
  end
123
128
 
124
129
  def prepare
130
+ @vers = VERS
131
+ st = `svn st`
132
+ unless st.empty?
133
+ puts "Any changes remain?"
134
+ puts st
135
+ exit
136
+ end
125
137
  end
126
138
 
127
139
  def run
128
- system "svn", "ci", "-m", @msg || "Release #{VERS}"
140
+ system "svn", "ci", "-m", @msg || "Release #{@vers}"
129
141
  end
130
142
  end
131
143
 
@@ -136,52 +148,53 @@ class Rake::ShipitTask::Step::Task
136
148
  end
137
149
 
138
150
  def prepare
139
- @names.each do |name|
140
- @tasks << Rake.application[name.to_sym]
141
- raise "Unknown task: #{name}" if @tasks.last.nil?
151
+ tasks = `rake -T`.scan(/^rake ([^\s]+)/).flatten
152
+ @names.each do |t|
153
+ raise "Unknown task #{t}" unless tasks.include? t.to_s
142
154
  end
143
155
  end
144
156
 
145
157
  def run
146
- @tasks.each do |t|
147
- t.invoke
158
+ @names.each do |t|
159
+ system("rake", t.to_s)
148
160
  end
149
161
  end
150
162
  end
151
163
 
152
164
  class Rake::ShipitTask::Step::RubyForge
153
165
  def initialize(group_id=RUBYFORGE_PROJECT)
154
- @group_id = group_id
166
+ @group_id = group_id
167
+ @description = DESCRIPTION
168
+ @name = NAME
169
+ @vers = VERS
155
170
  end
156
171
 
157
172
  def prepare
158
173
  require 'rubyforge'
159
- pkg = "pkg/#{NAME}-#{VERS}"
160
- puts "pkg"
174
+ p @vers
161
175
 
162
176
  @rf = RubyForge.new
163
177
  puts "Logging in"
164
178
  @rf.login
165
179
  @c = @rf.userconfig
166
180
  @c["preformatted"] = true
167
- @files = [
168
- "#{pkg}.tgz",
169
- "#{pkg}.gem"
170
- ].compact
171
181
  unless @rf.autoconfig["group_ids"].keys.include?(@group_id)
172
182
  raise "Unknown group: #{@group_id}"
173
183
  end
174
- unless @rf.autoconfig["package_ids"].keys.include?(NAME)
175
- @rf.create_package(@group_id, NAME)
184
+ unless @rf.autoconfig["package_ids"].keys.include?(@name)
185
+ @rf.create_package(@group_id, @name)
176
186
  end
177
-
178
- @description = DESCRIPTION
179
187
  end
180
188
 
181
189
  def run
182
- puts "Releasing #{NAME} #{VERS}"
183
- @rf.add_release @group_id, NAME, VERS, *@files
184
- @rf.post_news @group_id, "#{NAME} #{VERS} released.", "#{@description}"
190
+ pkg = "pkg/#{@name}-#{@vers}"
191
+ @files = [
192
+ "#{pkg}.tgz",
193
+ "#{pkg}.gem"
194
+ ].compact
195
+ puts "Releasing #{@name} #{@vers}"
196
+ @rf.add_release @group_id, @name, @vers, *@files
197
+ @rf.post_news @group_id, "#{@name} #{@vers} released.", "#{@description}"
185
198
  end
186
199
  end
187
200
 
@@ -209,41 +222,15 @@ class Rake::ShipitTask::Step::Tag
209
222
  else
210
223
  raise "Run at trunk!"
211
224
  end
225
+ @vers = VERS
212
226
  end
213
227
 
214
228
  def run
215
229
  trunk = @url + "trunk"
216
- tag = @url + ("tags/#{@format}" % VERS)
217
- command = ["svn", "cp", trunk, tag].map {|i| i.to_s }
230
+ tag = @url + ("tags/#{@format}" % @vers)
231
+ msg = "Release %s" % @vers
232
+ command = ["svn", "cp", "-m", msg, trunk, tag].map {|i| i.to_s }
218
233
  system(*command)
219
234
  end
220
235
  end
221
236
 
222
-
223
- __END__
224
- require "shipit"
225
-
226
- Rake::ShipitTask.new do |s|
227
- s.Ask
228
- s.Step.new {
229
- puts "prepare phase"
230
- }.and {
231
- puts "run phase"
232
- }
233
- s.Twitter "Test phase"
234
- end
235
-
236
- Rake::ShipitTask.new do |s|
237
- s.Ask
238
- s.Task :test
239
- s.ChangeVersion
240
- s.Commit
241
- s.Task :clean, :package
242
- s.RubyForge
243
- s.Step.new {
244
-
245
- }.and {
246
- }
247
- s.Twitter
248
- end
249
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shipit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - cho45
@@ -9,7 +9,7 @@ autorequire: shipit
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-01-05 00:00:00 +09:00
12
+ date: 2008-01-06 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency