shipit 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/ChangeLog +66 -0
  2. data/README +21 -3
  3. data/Rakefile +3 -3
  4. data/lib/shipit.rb +70 -45
  5. metadata +11 -2
data/ChangeLog CHANGED
@@ -1,5 +1,71 @@
1
+ 2008-01-06 cho45
2
+
3
+ * [r4147] lib/shipit.rb:
4
+
5
+ Ask after show all steps.
6
+
7
+ * [r4146] Rakefile:
8
+
9
+ Remove skip from Rakefile... This was only for debugging...
10
+
11
+ * [r4141] README:
12
+
13
+ follow removing Step::Ask
14
+
15
+ * [r4140] Rakefile, lib/shipit.rb:
16
+
17
+ Remove Step::Ask (is now default)
18
+ Add Step::Skip (is skip preceding steps)
19
+
20
+ * [r4139] lib/shipit.rb:
21
+
22
+ implement state shared with steps.
23
+ change spec of arguments of initialize
24
+
25
+ * [r4138] README:
26
+
27
+ change license to Ruby's
28
+ fix checkout uri
29
+
30
+ * [r4136] README:
31
+
32
+ append development notices to README
33
+
34
+ * [r4110] lib/shipit.rb:
35
+
36
+ better message
37
+
38
+ * [r4105] lib/shipit.rb:
39
+
40
+ unexpected return がうざいのでちゃんと条件分岐する
41
+
42
+ * [r4104] lib/shipit.rb:
43
+
44
+ prepare タスクだけを実行できるように
45
+ (Perl の shipit コマンドから shipit gem のタスクをたたきやすいように)
46
+
47
+ * [r4101] lib/shipit.rb:
48
+
49
+ デバッグコードが残っていた
50
+
51
+ * [r4100] Rakefile, lib/shipit.rb:
52
+
53
+ term-ansicolor 使ってみやすくなるように
54
+
55
+ * [r4099] Rakefile:
56
+
57
+ 出力がうざいので判定方法を変更
58
+
1
59
  2008-01-05 cho45
2
60
 
61
+ * [r4078] README:
62
+
63
+ README のサンプルを更新 (ChangeVersion を変更した)
64
+
65
+ * [r4076] ChangeLog, Rakefile:
66
+
67
+ Release 0.0.3
68
+
3
69
  * [r4075] lib/shipit.rb:
4
70
 
5
71
  タスクの実行を内部でやらないように (version をよみなおすため)
data/README CHANGED
@@ -35,14 +35,13 @@ Example (This is from shipit gem Rakefile):
35
35
  s.Step.new {
36
36
  system("svn", "up")
37
37
  }.and {}
38
- s.Ask
39
38
  s.Task :rubyforge
40
39
  s.Step.new {
41
40
  raise "svn2cl.sh is not found" unless system("svn2cl.sh", "--version")
42
41
  }.and {
43
42
  system("svn2cl.sh --break-before-msg=2 --group-by-day --include-rev --separate-daylogs")
44
43
  }
45
- s.ChangeVersion
44
+ s.ChangeVersion __FILE__, "VERS"
46
45
  s.Commit
47
46
  s.Task :clean, :package
48
47
  s.RubyForge
@@ -50,10 +49,29 @@ Example (This is from shipit gem Rakefile):
50
49
  s.Twitter
51
50
  end
52
51
 
52
+ See more example at Rakefile[http://svn.coderepos.org/share/lang/ruby/shipit/trunk/Rakefile] of shipit.rb.
53
+
54
+ Some constants are currently hard-coded.
55
+
56
+ * NAME -> name of the library
57
+ * DESCRIPTION -> description of the library
58
+ * VERS -> version of the library
59
+
60
+ If you use different constants, please assign the value to above constants.
61
+
62
+ == Development
63
+
64
+ This library currently consider different environments.
65
+ If you use cutagem[http://cutagem.rubyforge.org/], this library works fine :)
66
+
67
+ And this library is hosted on CodeRepos[http://coderepos.org/share/wiki],
68
+ so you have some ideas for this library, please commit to repository:
69
+
70
+ $ svn co http://svn.coderepos.org/share/lang/ruby/shipit/trunk shipit
53
71
 
54
72
 
55
73
  == Copyright
56
74
 
57
75
  Author:: cho45 <cho45@lowreal.net>
58
76
  Copyright:: Copyright (c) 2008 cho45
59
- License:: Creative Commons by
77
+ License:: Ruby's
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.3"
22
+ VERS = "0.0.4"
23
23
 
24
24
  REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
25
25
  CLEAN.include ['**/.*.sw?', '*.gem', '.config']
@@ -61,6 +61,7 @@ spec = Gem::Specification.new do |s|
61
61
  s.test_files = Dir["test/test_*.rb"]
62
62
 
63
63
  s.add_dependency('rake')
64
+ s.add_dependency('term-ansicolor')
64
65
  #s.add_dependency('activesupport', '>=1.3.1')
65
66
  #s.required_ruby_version = '>= 1.8.2'
66
67
 
@@ -115,10 +116,9 @@ Rake::ShipitTask.new do |s|
115
116
  s.Step.new {
116
117
  system("svn", "up")
117
118
  }.and {}
118
- s.Ask
119
119
  s.Task :rubyforge
120
120
  s.Step.new {
121
- raise "svn2cl.sh is not found" unless system("svn2cl.sh", "--version")
121
+ raise "svn2cl.sh is not found" unless `svn2cl.sh --version`[/svn2cl.sh/]
122
122
  }.and {
123
123
  system("svn2cl.sh --break-before-msg=2 --group-by-day --include-rev --separate-daylogs")
124
124
  }
data/lib/shipit.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "rubygems"
2
2
  require "rake"
3
3
  require "rake/tasklib"
4
+ require "term/ansicolor"
4
5
 
5
6
  class Rake::ShipitTask < Rake::TaskLib
6
7
  attr_reader :name
@@ -8,6 +9,8 @@ class Rake::ShipitTask < Rake::TaskLib
8
9
 
9
10
  module Step; end
10
11
 
12
+ include Term::ANSIColor
13
+
11
14
  def initialize(name=:shipit, &block)
12
15
  @name = name
13
16
  @block = block
@@ -15,35 +18,53 @@ class Rake::ShipitTask < Rake::TaskLib
15
18
  end
16
19
 
17
20
  def define
18
- desc "Shipit: Automated Release"
19
- task @name do
20
- puts "Preparing steps... "
21
+ t = Proc.new do |t|
22
+ puts green { "Preparing steps... " }
21
23
  steps = []
22
24
 
25
+ def steps.state
26
+ @state ||= {}
27
+ end
28
+
23
29
  eigenclass = class <<steps; self; end
24
30
  plugins = self.class.const_get(:Step)
25
31
  plugins.constants.each do |i|
26
32
  eigenclass.__send__(:define_method, i) do |*args|
27
- self << ret = plugins.const_get(i).new(*args)
33
+ self << ret = plugins.const_get(i).new(self, *args)
28
34
  ret
29
35
  end
30
36
  end
31
37
  @block.call(steps)
32
38
  steps.each do |s|
39
+ puts cyan { "Running Step (Prepare): #{s.class.name}" }
33
40
  s.prepare if s.respond_to? :prepare
34
41
  end
35
- puts "done."
36
- puts "Steps: #{steps.map{|i| i.class.name.sub(/.+::/, "")}.join(", ")}"
37
- steps.each do |s|
38
- puts "Running Step: #{s.class.name}"
39
- s.run
42
+ puts green { "done." }
43
+ unless t.name =~ /_prepare$/
44
+ puts
45
+ puts green { "Steps: #{steps.map{|i| i.class.name.sub(/.+::/, "")}.join(", ")}" }
46
+ puts "Really run? Cancel to press Ctrl+C."
47
+ $stdin.gets
48
+ steps.each do |s|
49
+ puts red { "Running Step: #{s.class.name}" }
50
+ s.run
51
+ end
52
+ puts green { "done." }
40
53
  end
41
- puts "done."
42
54
  end
55
+ desc "Shipit: Automated Release"
56
+ task @name, &t
57
+ desc "Shipit: Automated Release (Only run prepare phase)"
58
+ task "#{@name}_prepare", &t
59
+ #desc "Shipit: Automated Release (dry run)"
60
+ #task "#{@name}_dryrun", &t
43
61
  end
44
62
  end
45
63
 
46
64
  class Rake::ShipitTask::Step::Step
65
+ def initialize(step)
66
+ end
67
+
47
68
  def new(&block)
48
69
  @prepare = block
49
70
  self
@@ -63,7 +84,7 @@ class Rake::ShipitTask::Step::Step
63
84
  end
64
85
 
65
86
  class Rake::ShipitTask::Step::Twitter
66
- def initialize(msg=nil)
87
+ def initialize(step, msg=nil)
67
88
  @msg = msg
68
89
  end
69
90
 
@@ -94,7 +115,7 @@ class Rake::ShipitTask::Step::Twitter
94
115
  end
95
116
 
96
117
  class Rake::ShipitTask::Step::ChangeVersion
97
- def initialize(file, name="VERSION", vers=VERS)
118
+ def initialize(step, file, name="VERSION", vers=VERS)
98
119
  @file = file
99
120
  @name = name
100
121
  @vers = vers
@@ -122,7 +143,7 @@ class Rake::ShipitTask::Step::ChangeVersion
122
143
  end
123
144
 
124
145
  class Rake::ShipitTask::Step::Commit
125
- def initialize(msg=nil)
146
+ def initialize(step, msg=nil)
126
147
  @msg = msg
127
148
  end
128
149
 
@@ -141,8 +162,38 @@ class Rake::ShipitTask::Step::Commit
141
162
  end
142
163
  end
143
164
 
165
+ class Rake::ShipitTask::Step::Tag
166
+ def initialize(step, format="release-%s")
167
+ @format = format
168
+ end
169
+
170
+ def prepare
171
+ require "uri"
172
+ ENV["LANG"] = "C"
173
+ url = `svn info`[/^URL: (.+)/, 1]
174
+ if url =~ /trunk$/
175
+ @url = URI(url) + "."
176
+ unless `svn info '#{(@url + "tags")}'`[/Node Kind: directory/]
177
+ raise "tags directory is not found"
178
+ end
179
+ else
180
+ raise "Run at trunk! Here is #{url}"
181
+ end
182
+ @vers = VERS
183
+ end
184
+
185
+ def run
186
+ trunk = @url + "trunk"
187
+ tag = @url + ("tags/#{@format}" % @vers)
188
+ msg = "Release %s" % @vers
189
+ command = ["svn", "cp", "-m", msg, trunk, tag].map {|i| i.to_s }
190
+ system(*command)
191
+ end
192
+ end
193
+
194
+
144
195
  class Rake::ShipitTask::Step::Task
145
- def initialize(*names)
196
+ def initialize(step, *names)
146
197
  @names = names
147
198
  @tasks = []
148
199
  end
@@ -162,7 +213,7 @@ class Rake::ShipitTask::Step::Task
162
213
  end
163
214
 
164
215
  class Rake::ShipitTask::Step::RubyForge
165
- def initialize(group_id=RUBYFORGE_PROJECT)
216
+ def initialize(step, group_id=RUBYFORGE_PROJECT)
166
217
  @group_id = group_id
167
218
  @description = DESCRIPTION
168
219
  @name = NAME
@@ -171,8 +222,6 @@ class Rake::ShipitTask::Step::RubyForge
171
222
 
172
223
  def prepare
173
224
  require 'rubyforge'
174
- p @vers
175
-
176
225
  @rf = RubyForge.new
177
226
  puts "Logging in"
178
227
  @rf.login
@@ -198,39 +247,15 @@ class Rake::ShipitTask::Step::RubyForge
198
247
  end
199
248
  end
200
249
 
201
- class Rake::ShipitTask::Step::Ask
202
- def run
203
- puts "Really run? Cancel to press Ctrl+C."
204
- $stdin.gets
205
- end
206
- end
207
-
208
- class Rake::ShipitTask::Step::Tag
209
- def initialize(format="release-%s")
210
- @format = format
250
+ # Skip preceding steps
251
+ class Rake::ShipitTask::Step::Skip
252
+ def initialize(step)
253
+ step.clear
211
254
  end
212
255
 
213
256
  def prepare
214
- require "uri"
215
- ENV["LANG"] = "C"
216
- url = `svn info`[/^URL: (.+)/, 1]
217
- if url =~ /trunk$/
218
- @url = URI(url) + "."
219
- unless `svn info '#{(@url + "tags")}'`[/Node Kind: directory/]
220
- raise "tag directory is not found"
221
- end
222
- else
223
- raise "Run at trunk!"
224
- end
225
- @vers = VERS
226
257
  end
227
258
 
228
259
  def run
229
- trunk = @url + "trunk"
230
- tag = @url + ("tags/#{@format}" % @vers)
231
- msg = "Release %s" % @vers
232
- command = ["svn", "cp", "-m", msg, trunk, tag].map {|i| i.to_s }
233
- system(*command)
234
260
  end
235
261
  end
236
-
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.3
4
+ version: 0.0.4
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-06 00:00:00 +09:00
12
+ date: 2008-01-07 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -21,6 +21,15 @@ dependencies:
21
21
  - !ruby/object:Gem::Version
22
22
  version: "0"
23
23
  version:
24
+ - !ruby/object:Gem::Dependency
25
+ name: term-ansicolor
26
+ version_requirement:
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: "0"
32
+ version:
24
33
  description: Automated release tasks.
25
34
  email: cho45@lowreal.net
26
35
  executables: []