xforge 0.1.5 → 0.1.6
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/CHANGES +9 -0
- data/Rakefile +9 -1
- data/lib/rake/contrib/xforge/base.rb +2 -2
- data/lib/scm_web/view_cvs.rb +32 -8
- data/lib/xforge/project.rb +12 -1
- data/lib/xforge/rubyforge.rb +15 -2
- data/lib/xforge/sourceforge.rb +14 -3
- metadata +2 -2
data/CHANGES
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
= XForge Changelog
|
2
2
|
|
3
|
+
== Version 0.1.6
|
4
|
+
|
5
|
+
This release of XForge improves scm browser capabilities.
|
6
|
+
|
7
|
+
* Added ViewCvs.uri(path, options) method to get an URI to a file on the web
|
8
|
+
* Added an rspec suite
|
9
|
+
* Added logic for parsing top-level CVS modules
|
10
|
+
* Made Rake Release task use RubyForge by default
|
11
|
+
|
3
12
|
== Version 0.1.5
|
4
13
|
|
5
14
|
This release of XForge adds functionality to access scm browsers (ViewCvs) and RSCM objects.
|
data/Rakefile
CHANGED
@@ -15,8 +15,16 @@ require 'rake/clean'
|
|
15
15
|
require 'rake/testtask'
|
16
16
|
require 'rake/rdoctask'
|
17
17
|
|
18
|
+
# Versioning scheme: MAJOR.MINOR.PATCH
|
19
|
+
# MAJOR bumps when API is broken backwards
|
20
|
+
# MINOR bumps when the API is broken backwards in a very slight/subtle (but not fatal) way
|
21
|
+
# -OR when a new release is made and propaganda is sent out.
|
22
|
+
# PATCH is bumped for every API addition and/or bugfix (ideally for every commit)
|
23
|
+
# Later DamageControl can bump PATCH automatically.
|
24
|
+
#
|
25
|
+
# REMEMBER TO KEEP PKG_VERSION IN SYNC WITH CHANGELOG
|
18
26
|
PKG_NAME = "xforge"
|
19
|
-
PKG_VERSION = "0.1.
|
27
|
+
PKG_VERSION = "0.1.6"
|
20
28
|
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
21
29
|
PKG_FILES = FileList[
|
22
30
|
'[A-Z]*',
|
@@ -5,9 +5,9 @@ module Rake
|
|
5
5
|
class Base
|
6
6
|
attr_writer :user_name, :password
|
7
7
|
|
8
|
-
def initialize(project_name,
|
8
|
+
def initialize(project_name, host=::XForge::RubyForge.new)
|
9
9
|
@project_name = project_name
|
10
|
-
@host =
|
10
|
+
@host = host
|
11
11
|
|
12
12
|
set_defaults
|
13
13
|
|
data/lib/scm_web/view_cvs.rb
CHANGED
@@ -1,24 +1,48 @@
|
|
1
1
|
module ScmWeb
|
2
|
+
# TODO: implement RSCM API via HTTP ala CVSGrab
|
2
3
|
class ViewCvs
|
3
4
|
|
4
|
-
attr_reader :
|
5
|
+
attr_reader :project
|
5
6
|
|
6
|
-
def initialize(
|
7
|
-
@
|
7
|
+
def initialize(uri_specs, project, module_regexp)
|
8
|
+
@uri_specs, @project, @module_regexp = uri_specs, project, module_regexp
|
8
9
|
end
|
9
10
|
|
10
11
|
def scms
|
11
12
|
unless(@scms)
|
12
13
|
require 'rscm'
|
13
|
-
cvs_root = open(uri) { |data| data.read }
|
14
14
|
|
15
15
|
@scms = []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
cvs_root = open(uri) do |data|
|
17
|
+
data.each_line do |line|
|
18
|
+
if line =~ @module_regexp
|
19
|
+
mod = $1
|
20
|
+
unless(mod == "CVSROOT")
|
21
|
+
scm = RSCM::Cvs.new
|
22
|
+
scm.root = ":pserver:anonymous@#{project.host.cvs_host_name}:#{project.host.cvs_path}/#{mod}"
|
23
|
+
scm.mod = project.name
|
24
|
+
@scms << scm
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
20
29
|
end
|
21
30
|
@scms
|
22
31
|
end
|
32
|
+
|
33
|
+
# Returns the URI for the file at +path+.
|
34
|
+
# Options are:
|
35
|
+
# :type (can be one of :overview, :raw or :html)
|
36
|
+
# :revision (the revision of the file. must be specified when :type is :raw or :html)
|
37
|
+
def uri(path="", options={:type=>:overview})
|
38
|
+
type = options[:type]
|
39
|
+
raise "No :type specified" unless type
|
40
|
+
uri_spec = @uri_specs[type]
|
41
|
+
raise "No uri_spec for #{type}" unless uri_spec
|
42
|
+
|
43
|
+
project_name = project.name
|
44
|
+
revision = options[:revision]
|
45
|
+
eval("\"#{uri_spec}\"", binding)
|
46
|
+
end
|
23
47
|
end
|
24
48
|
end
|
data/lib/xforge/project.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'net/http'
|
2
|
+
require 'net/https'
|
2
3
|
require 'open-uri'
|
3
4
|
|
4
5
|
module XForge
|
@@ -15,7 +16,17 @@ module XForge
|
|
15
16
|
|
16
17
|
# Logs in and returns a Session
|
17
18
|
def login(user_name, password)
|
18
|
-
|
19
|
+
http = Net::HTTP.new(@host.name, host.login_port)
|
20
|
+
|
21
|
+
# http://www.ruby-lang.org/ja/man/index.cgi?cmd=view;name=net%2Fhttps.rb
|
22
|
+
if(host.login_port == 443)
|
23
|
+
http.use_ssl = true
|
24
|
+
http.ca_file = '/usr/share/ssl/cert.pem'
|
25
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
26
|
+
http.verify_depth = 5
|
27
|
+
end
|
28
|
+
|
29
|
+
login_response = http.start do |http|
|
19
30
|
data = [
|
20
31
|
"login=1",
|
21
32
|
"form_loginname=#{user_name}",
|
data/lib/xforge/rubyforge.rb
CHANGED
@@ -1,8 +1,20 @@
|
|
1
1
|
module XForge
|
2
2
|
class RubyForge < Host
|
3
|
+
VIEW_CVS = "http://rubyforge.org/cgi-bin/viewcvs.cgi/"
|
4
|
+
PATH_CVSROOT = "\#{path}?cvsroot=\#{project_name}"
|
5
|
+
PATH_CVSROOT_REV = "#{PATH_CVSROOT}&rev=\#{revision}"
|
6
|
+
|
7
|
+
OVERVIEW = "#{VIEW_CVS}#{PATH_CVSROOT}"
|
8
|
+
RAW = "#{VIEW_CVS}*checkout*/#{PATH_CVSROOT_REV}"
|
9
|
+
HTML = "#{VIEW_CVS}#{PATH_CVSROOT_REV}&content-type=text/vnd.viewcvs-markup"
|
10
|
+
|
3
11
|
def initialize
|
4
12
|
super('rubyforge.org')
|
5
13
|
end
|
14
|
+
|
15
|
+
def login_port
|
16
|
+
80
|
17
|
+
end
|
6
18
|
|
7
19
|
def cvs_path
|
8
20
|
"/var/cvs"
|
@@ -13,8 +25,9 @@ module XForge
|
|
13
25
|
end
|
14
26
|
|
15
27
|
def scm_web(project)
|
16
|
-
|
28
|
+
module_regexp = /href=\"(\w+)\/\?cvsroot=#{project.name}/
|
29
|
+
::ScmWeb::ViewCvs.new({:overview => OVERVIEW, :raw => RAW, :html => HTML}, project, module_regexp)
|
17
30
|
end
|
18
31
|
|
19
32
|
end
|
20
|
-
end
|
33
|
+
end
|
data/lib/xforge/sourceforge.rb
CHANGED
@@ -1,10 +1,21 @@
|
|
1
1
|
module XForge
|
2
|
-
|
3
2
|
class SourceForge < Host
|
3
|
+
VIEW_CVS = "http://cvs.sourceforge.net/viewcvs.py/"
|
4
|
+
PROJECT_PATH = "\#{project_name}/\#{path}"
|
5
|
+
REV = "rev=\#{revision}"
|
6
|
+
|
7
|
+
OVERVIEW = "#{VIEW_CVS}#{PROJECT_PATH}"
|
8
|
+
RAW = "#{VIEW_CVS}*checkout*/#{PROJECT_PATH}?#{REV}"
|
9
|
+
HTML = "#{OVERVIEW}?#{REV}&view=markup"
|
10
|
+
|
4
11
|
def initialize
|
5
12
|
super("sourceforge.net")
|
6
13
|
end
|
7
14
|
|
15
|
+
def login_port
|
16
|
+
443
|
17
|
+
end
|
18
|
+
|
8
19
|
def cvs_path
|
9
20
|
"/cvsroot"
|
10
21
|
end
|
@@ -14,9 +25,9 @@ module XForge
|
|
14
25
|
end
|
15
26
|
|
16
27
|
def scm_web(project)
|
17
|
-
|
28
|
+
module_regexp = /viewcvs\.py\/#{project.name}\/(\w+)\//
|
29
|
+
::ScmWeb::ViewCvs.new({:overview => OVERVIEW, :raw => RAW, :html => HTML}, project, module_regexp)
|
18
30
|
end
|
19
31
|
|
20
32
|
end
|
21
|
-
|
22
33
|
end
|