gforces-integrity 0.1.9.3 → 0.1.9.4

Sign up to get free protection for your applications and to get access to all the features.
data/integrity.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "integrity"
3
- s.version = "0.1.9.3"
4
- s.date = "2009-04-06"
3
+ s.version = "0.1.9.4"
4
+ s.date = "2009-08-25"
5
5
 
6
6
  s.description = "Your Friendly Continuous Integration server. Easy, fun and painless!"
7
7
  s.summary = "The easy and fun Continuous Integration server"
@@ -82,6 +82,8 @@ lib/integrity/project_builder.rb
82
82
  lib/integrity/scm.rb
83
83
  lib/integrity/scm/git.rb
84
84
  lib/integrity/scm/git/uri.rb
85
+ lib/integrity/scm/subversion.rb
86
+ lib/integrity/scm/subversion/uri.rb
85
87
  public/buttons.css
86
88
  public/reset.css
87
89
  public/spinner.gif
@@ -0,0 +1,84 @@
1
+ require 'hpricot'
2
+ module Integrity
3
+ module SCM
4
+ class Subversion
5
+
6
+ require File.dirname(__FILE__) / "subversion/uri"
7
+
8
+ attr_reader :uri, :branch, :working_directory
9
+
10
+ def self.working_tree_path(uri)
11
+ Subversion::URI.new( uri ).working_tree_path
12
+ end
13
+
14
+ # check the uri and see if it is a subversion url
15
+ # There is a lot that can be a subversion url
16
+ def self.is_this_my_home?( location )
17
+ uri = Addressable::URI.parse( location )
18
+ %w[ svn+ssh svn http https file ].include?( uri.scheme )
19
+ end
20
+
21
+ def initialize(uri, branch, working_directory = nil)
22
+ @uri = uri.to_s
23
+ @branch = branch.to_s
24
+ @working_directory = working_directory
25
+ end
26
+
27
+ def with_revision(revision)
28
+ initial_checkout unless already_out?
29
+ update_to(revision)
30
+ yield
31
+ end
32
+
33
+ def name
34
+ self.class.name.split("::").last
35
+ end
36
+
37
+ def head
38
+ log "Getting the HEAD of '#{uri}'"
39
+ xml = %x[ svn info --non-interactive --xml #{uri} ]
40
+ doc = Hpricot::XML( xml )
41
+ return doc.at("commit")['revision']
42
+ end
43
+
44
+ def info( revision )
45
+ log "Retrieving info for revision #{revision}"
46
+ xml = %x[ svn log --non-interactive --xml --revision #{revision} #{uri} ]
47
+ doc = Hpricot::XML( xml )
48
+ h = {}
49
+ h['author'] = doc.at('author').inner_html + " <noemail>"
50
+ h['message'] = doc.at('msg').inner_html
51
+ h['committed_at'] = Time.parse(doc.at('date').inner_html).iso8601
52
+ return h
53
+ end
54
+
55
+
56
+ private
57
+
58
+ def initial_checkout
59
+ log "Initial checkout of #{uri} to #{working_directory}"
60
+ log_command("svn co -q #{uri} #{working_directory}" )
61
+ end
62
+
63
+ def update_to(revision=nil)
64
+ log "Updating to revision #{revision}"
65
+ log_command("cd #{working_directory} && svn up -q -r#{revision}" )
66
+ end
67
+
68
+ def log_command( cmd )
69
+ output = %x[ #{cmd} ]
70
+ if output.length > 0 then
71
+ output.split("\n").each { |l| log l.strip }
72
+ end
73
+ end
74
+
75
+ def already_out?
76
+ File.directory?(working_directory / ".svn")
77
+ end
78
+
79
+ def log(message)
80
+ Integrity.log(name) { message }
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,23 @@
1
+ module Integrity
2
+ module SCM
3
+
4
+ class Subversion
5
+
6
+ class URI
7
+ def initialize(uri_string)
8
+ @uri = Addressable::URI.parse(uri_string)
9
+ end
10
+
11
+ def working_tree_path
12
+ path.gsub("/", "-")
13
+ end
14
+
15
+ private
16
+ def path
17
+ path = @uri.path
18
+ path.gsub(/\~[a-zA-Z0-9]*\//, "").gsub(/^\//, "")
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gforces-integrity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9.3
4
+ version: 0.1.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Nicol\xC3\xA1s Sanguinetti"
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-04-06 00:00:00 -07:00
13
+ date: 2009-08-25 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -243,6 +243,8 @@ files:
243
243
  - lib/integrity/scm.rb
244
244
  - lib/integrity/scm/git.rb
245
245
  - lib/integrity/scm/git/uri.rb
246
+ - lib/integrity/scm/subversion.rb
247
+ - lib/integrity/scm/subversion/uri.rb
246
248
  - public/buttons.css
247
249
  - public/reset.css
248
250
  - public/spinner.gif