bkoski-integrity-subversion 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +18 -0
- data/README.rdoc +17 -0
- data/lib/integrity/scm.rb +14 -0
- data/lib/integrity/scm/git.rb +11 -0
- data/lib/integrity/scm/subversion.rb +82 -0
- data/lib/integrity/scm/subversion/uri.rb +23 -0
- data/lib/integrity_subversion.rb +5 -0
- metadata +82 -0
data/LICENSE
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
2
|
+
a copy of this software and associated documentation files (the
|
3
|
+
"Software"), to deal in the Software without restriction, including
|
4
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
5
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
6
|
+
permit persons to whom the Software is furnished to do so, subject to
|
7
|
+
the following conditions:
|
8
|
+
|
9
|
+
The above copyright notice and this permission notice shall be
|
10
|
+
included in all copies or substantial portions of the Software.
|
11
|
+
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
13
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
14
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
15
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
16
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
17
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
18
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
= integrity-subversion
|
2
|
+
|
3
|
+
SVN support is {in the works}[http://integrity.lighthouseapp.com/projects/14308/tickets/58-svn-support#ticket-58-13]
|
4
|
+
for Integrity[http://integrityapp.com], but in the meantime copiousfreetime built SVN support into a {branch on github}[http://github.com/copiousfreetime/integrity/tree/svn].
|
5
|
+
|
6
|
+
I took Jeremey's patch and rolled it into a gem to make installation into an existing copy
|
7
|
+
of Integrity a snap.
|
8
|
+
|
9
|
+
Just install the gem:
|
10
|
+
|
11
|
+
sudo gem install bkoski-integrity-subversion --source http://gems.github.com
|
12
|
+
|
13
|
+
and then add
|
14
|
+
|
15
|
+
require 'integrity_subversion'
|
16
|
+
|
17
|
+
to Integrity's config.ru (after the rubygems require, of course...).
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Integrity
|
2
|
+
module SCM
|
3
|
+
|
4
|
+
private
|
5
|
+
# test for Git first since a Git URL is more restrictive than a subversion
|
6
|
+
# url
|
7
|
+
def self.scm_class_for(uri)
|
8
|
+
[ Git, Subversion ].each do |klass|
|
9
|
+
return klass if klass.is_this_my_home?( uri )
|
10
|
+
end
|
11
|
+
raise SCMUnknownError, "could not find any SCM based on URI '#{uri.to_s}'"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'hpricot'
|
2
|
+
module Integrity
|
3
|
+
module SCM
|
4
|
+
class Subversion
|
5
|
+
|
6
|
+
attr_reader :uri, :branch, :working_directory
|
7
|
+
|
8
|
+
def self.working_tree_path(uri)
|
9
|
+
Subversion::URI.new( uri ).working_tree_path
|
10
|
+
end
|
11
|
+
|
12
|
+
# check the uri and see if it is a subversion url
|
13
|
+
# There is a lot that can be a subversion url
|
14
|
+
def self.is_this_my_home?( location )
|
15
|
+
uri = Addressable::URI.parse( location )
|
16
|
+
%w[ svn+ssh svn http https file ].include?( uri.scheme )
|
17
|
+
end
|
18
|
+
|
19
|
+
def initialize(uri, branch, working_directory = nil)
|
20
|
+
@uri = uri.to_s
|
21
|
+
@branch = branch.to_s
|
22
|
+
@working_directory = working_directory
|
23
|
+
end
|
24
|
+
|
25
|
+
def with_revision(revision)
|
26
|
+
initial_checkout unless already_out?
|
27
|
+
update_to(revision)
|
28
|
+
yield
|
29
|
+
end
|
30
|
+
|
31
|
+
def name
|
32
|
+
self.class.name.split("::").last
|
33
|
+
end
|
34
|
+
|
35
|
+
def head
|
36
|
+
log "Getting the HEAD of '#{uri}'"
|
37
|
+
xml = %x[ svn info --non-interactive --xml #{uri} ]
|
38
|
+
doc = Hpricot::XML( xml )
|
39
|
+
return doc.at("commit")['revision']
|
40
|
+
end
|
41
|
+
|
42
|
+
def info( revision )
|
43
|
+
log "Retrieving info for revision #{revision}"
|
44
|
+
xml = %x[ svn log --non-interactive --xml --revision #{revision} #{uri} ]
|
45
|
+
doc = Hpricot::XML( xml )
|
46
|
+
h = {}
|
47
|
+
h['author'] = doc.at('author').inner_html + " <noemail>"
|
48
|
+
h['message'] = doc.at('msg').inner_html
|
49
|
+
h['committed_at'] = Time.parse(doc.at('date').inner_html).iso8601
|
50
|
+
return h
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def initial_checkout
|
57
|
+
log "Initial checkout of #{uri} to #{working_directory}"
|
58
|
+
log_command("svn co -q #{uri} #{working_directory}" )
|
59
|
+
end
|
60
|
+
|
61
|
+
def update_to(revision=nil)
|
62
|
+
log "Updating to revision #{revision}"
|
63
|
+
log_command("cd #{working_directory} && svn up -q -r#{revision}" )
|
64
|
+
end
|
65
|
+
|
66
|
+
def log_command( cmd )
|
67
|
+
output = %x[ #{cmd} ]
|
68
|
+
if output.length > 0 then
|
69
|
+
output.split("\n").each { |l| log l.strip }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def already_out?
|
74
|
+
File.directory?(working_directory / ".svn")
|
75
|
+
end
|
76
|
+
|
77
|
+
def log(message)
|
78
|
+
Integrity.log(name) { message }
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
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
|
@@ -0,0 +1,5 @@
|
|
1
|
+
require 'integrity'
|
2
|
+
require File.join(File.dirname(__FILE__), 'integrity', 'scm')
|
3
|
+
require File.join(File.dirname(__FILE__), 'integrity', 'scm', 'git')
|
4
|
+
require File.join(File.dirname(__FILE__), 'integrity', 'scm', 'subversion', 'uri')
|
5
|
+
require File.join(File.dirname(__FILE__), 'integrity', 'scm', 'subversion')
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bkoski-integrity-subversion
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ben Koski
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-04-22 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: integrity
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: thor
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
description: Bundled subversion support for integrity
|
36
|
+
email: gems@benkoski.com
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files: []
|
42
|
+
|
43
|
+
files:
|
44
|
+
- lib/integrity
|
45
|
+
- lib/integrity_subversion.rb
|
46
|
+
- lib/integrity/scm
|
47
|
+
- lib/integrity/scm.rb
|
48
|
+
- lib/integrity/scm/git.rb
|
49
|
+
- lib/integrity/scm/subversion
|
50
|
+
- lib/integrity/scm/subversion.rb
|
51
|
+
- lib/integrity/scm/subversion/uri.rb
|
52
|
+
- README.rdoc
|
53
|
+
- LICENSE
|
54
|
+
has_rdoc: true
|
55
|
+
homepage: http://github.com/bkoski/integrity-subversion
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options:
|
58
|
+
- --inline-source
|
59
|
+
- --charset=UTF-8
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: "0"
|
67
|
+
version:
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: "0"
|
73
|
+
version:
|
74
|
+
requirements: []
|
75
|
+
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 1.2.0
|
78
|
+
signing_key:
|
79
|
+
specification_version: 2
|
80
|
+
summary: Bundled subversion support for integrity
|
81
|
+
test_files: []
|
82
|
+
|