dr 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/bin/dr CHANGED
@@ -320,9 +320,10 @@ class RepoCLI < ExtendedThor
320
320
  next
321
321
  end
322
322
 
323
- log :info, ""
324
323
  repo.push pkg.name, version, suite if version
325
324
  updated += 1
325
+
326
+ log :info, ""
326
327
  end
327
328
 
328
329
  log :info, "Updated #{updated.to_s.fg "blue"} packages in #{suite.fg "blue"}"
@@ -79,10 +79,7 @@ module Dr
79
79
  src_dir = "#{tmp}/src"
80
80
  FileUtils.mkdir_p src_dir
81
81
 
82
- log :info, "Extracting the sources"
83
- git_cmd ="git --git-dir #{@git_dir} --bare archive " +
84
- "--format tar #{@default_branch} | tar x -C #{src_dir}"
85
- ShellCmd.new git_cmd, :tag => "git", :show_out => true
82
+ checkout @default_branch, src_dir
86
83
 
87
84
  unless File.exists? "#{tmp}/src/debian/control"
88
85
  log :err, "The debian packaging files not found in the repository"
@@ -123,18 +120,15 @@ module Dr
123
120
  orig_rev, curr_rev = update_from_origin branch
124
121
  if curr_rev != orig_rev || force
125
122
  Dir.mktmpdir do |src_dir|
126
- log :info, "Extracting the sources"
127
- git_cmd ="git --git-dir #{@git_dir} --bare archive " +
128
- "--format tar #{branch} | tar x -C #{src_dir}"
129
- ShellCmd.new git_cmd, :tag => "git", :show_out => true
123
+ checkout branch, src_dir
130
124
 
131
125
  version = PkgVersion.new get_version "#{src_dir}/debian/changelog"
132
- log :info, "Source version: #{version.to_s.style "version"}"
126
+ log :info, "Source version: #{version.source.style "version"}"
133
127
 
134
128
  while build_exists? version
135
129
  version.increment!
136
130
  end
137
- log :info, "Building version: #{version.to_s.style "version"}"
131
+ log :info, "Build version: #{version.to_s.style "version"}"
138
132
 
139
133
  log :info, "Updating changelog"
140
134
  now = Time.new.strftime("%a, %-d %b %Y %T %z")
@@ -245,28 +239,17 @@ EOS
245
239
  def update_from_origin(branch)
246
240
  log :info, "Pulling changes from origin"
247
241
 
248
- git_cmd = "git --git-dir #{@git_dir} --bare rev-parse #{branch} 2>/dev/null"
249
- git = ShellCmd.new git_cmd, :tag => "git"
250
-
251
- original_rev = git.out.chomp
252
- original_rev = nil if original_rev == branch
242
+ original_rev = get_rev branch
253
243
 
254
244
  begin
255
- #if @default_branch == branch
256
- git_cmd = "git --git-dir #{@git_dir} --bare fetch origin"
257
- ShellCmd.new git_cmd, :tag => "git", :show_out => true
258
- #else
259
- # git_cmd = "git --git-dir #{@git_dir} --bare fetch origin #{branch}:#{branch}"
260
- # ShellCmd.new git_cmd, :tag => "git", :show_out => true
261
- #end
245
+ git_cmd = "git --git-dir #{@git_dir} --bare fetch origin"
246
+ ShellCmd.new git_cmd, :tag => "git", :show_out => true
262
247
  rescue Exception => e
263
248
  log :err, "Unable to pull from origin"
264
249
  raise e
265
250
  end
266
251
 
267
- git_cmd = "git --git-dir #{@git_dir} --bare rev-parse #{branch} 2>/dev/null"
268
- git = ShellCmd.new git_cmd, :tag => "git"
269
- current_rev = git.out.chomp
252
+ current_rev = get_rev branch
270
253
 
271
254
  [original_rev, current_rev]
272
255
  end
@@ -319,5 +302,23 @@ EOS
319
302
  }
320
303
  git_cmd.out.chomp.lines.grep(/^\*/)[0][2..-1].chomp
321
304
  end
305
+
306
+ def get_rev(branch)
307
+ git_cmd = "git --git-dir #{@git_dir} --bare rev-parse #{branch} 2>/dev/null"
308
+ git = ShellCmd.new git_cmd, :tag => "git", :expect => [0, 128]
309
+
310
+ if git.status.exitstatus == 0
311
+ git.out.chomp
312
+ else
313
+ nil
314
+ end
315
+ end
316
+
317
+ def checkout(branch, dir)
318
+ log :info, "Extracting the sources"
319
+ git_cmd ="git --git-dir #{@git_dir} --bare archive " +
320
+ "--format tar #{branch} | tar x -C #{dir}"
321
+ ShellCmd.new git_cmd, :tag => "git", :show_out => true
322
+ end
322
323
  end
323
324
  end
@@ -68,6 +68,12 @@ module Dr
68
68
  v
69
69
  end
70
70
 
71
+ def source
72
+ v = "#{upstream}"
73
+ v << "-#{debian}" if @debian
74
+ v
75
+ end
76
+
71
77
  private
72
78
  def today
73
79
  Time.now.strftime "%Y%m%d"
@@ -50,7 +50,8 @@ module Dr
50
50
  @status = wait_thr.value
51
51
  end
52
52
 
53
- if @status.exitstatus != @expect
53
+ if (@expect.is_a?(Array) && !@expect.include?(@status.exitstatus)) ||
54
+ (@expect.is_a?(Integer) && @status.exitstatus != @expect)
54
55
  out_lines = @out.split "\n"
55
56
  if out_lines.length > 10
56
57
  out_lines = out_lines[-10..-1]
@@ -1,3 +1,3 @@
1
1
  module Dr
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-11 00:00:00.000000000 Z
12
+ date: 2014-03-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor