Skip to content

Commit 3f89184

Browse files
install darcs for travis
2 parents 8fe65ee + 38c984f commit 3f89184

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+255
-205
lines changed

.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.0.0

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
language: ruby
2+
env:
3+
- TRAVIS_CONFIG_DIR=.travis
4+
before_install:
5+
- cd $TRAVIS_CONFIG_DIR
6+
- sh .travis_ssh_setup.sh
7+
install:
8+
- sh .install_multiple_scms.sh
9+
- sh .install_dependencies.sh
10+
- gem install posix-spawn
11+
before_script:
12+
- cd $TRAVIS_BUILD_DIR

.travis/.install_dependencies.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#/usr/bin/env sh
2+
3+
bazaar_plugins_path=`bzr --version | awk '/bzrlib:/ {print $2}'`
4+
5+
cd "$bazaar_plugins_path/plugins"
6+
7+
sudo bzr branch lp:bzr-xmloutput
8+
9+
sudo mv bzr-xmloutput xmloutput
10+
11+
cd xmloutput
12+
13+
python setup.py build_ext -i

.travis/.install_multiple_scms.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
sudo sh -c 'echo "deb http://opensource.wandisco.com/ubuntu precise svn18" >> /etc/apt/sources.list.d/subversion18.list'
2+
sudo wget -q http://opensource.wandisco.com/wandisco-debian.gpg -O- | sudo apt-key add -
3+
sudo apt-get update
4+
sudo apt-get install -y subversion cvs bzr mercurial darcs
5+
sudo ln -s /usr/bin/cvs /usr/bin/cvsnt

.travis/.travis_ssh_setup.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ssh-keygen -t rsa -f ~/.ssh/id_rsa -N "" -q
2+
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
3+
ssh-keyscan -t rsa `hostname` >> ~/.ssh/known_hosts

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Ohloh SCM on Ohloh](https://www.ohloh.net/p/ohloh_scm/widgets/project_partner_badge.gif)](https://www.ohloh.net/p/ohloh_scm)
1+
[![Ohloh SCM on Ohloh](https://www.ohloh.net/p/ohloh_scm/widgets/project_partner_badge.gif)](https://www.ohloh.net/p/ohloh_scm) [![Build Status](https://travis-ci.org/blackducksoftware/ohloh_scm.svg?branch=master)](https://travis-ci.org/blackducksoftware/ohloh_scm)
22

33
# Ohloh SCM
44

@@ -49,10 +49,17 @@ hg 1.1.2
4949
If you are using CVS instead of CVSNT, you can potentially try creating
5050
a shell alias or symlink mapping 'cvsnt' to 'cvs'.
5151

52+
Ohloh SCM uses [posix-spawn](https://github.com/rtomayko/posix-spawn) to
53+
execute commands so ensure *posix-spawn* gem is installed
54+
55+
``gem install posix-spawn``
56+
57+
5258
## Usage with Bundler
5359

5460
```
5561
gem 'ohloh_scm', git: 'https://github.com/blackducksw/ohloh_scm/', require: 'scm'
62+
gem 'posix-spawn'
5663
```
5764
## Running
5865

lib/ohloh_scm/adapters/bzr/misc.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def exist?
1010
end
1111

1212
def ls_tree(token)
13-
run("cd #{path} && bzr ls -V -r #{to_rev_param(token)}").split("\n")
13+
run("cd #{path} && bzr ls -V -r #{to_rev_param(token)}").split("\n")
1414
end
1515

1616
def to_rev_param(r=nil)

lib/ohloh_scm/adapters/bzrlib/bzrlib_pipe_client.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
require 'rubygems'
2-
require 'open4'
2+
require 'posix/spawn'
33

44
class BzrPipeClient
55
def initialize(repository_url)
66
@repository_url = repository_url
77
@py_script = File.dirname(__FILE__) + '/bzrlib_pipe_server.py'
88
end
9-
9+
1010
def start
11-
@pid, @stdin, @stdout, @stderr = Open4::popen4 "python #{@py_script}"
11+
@pid, @stdin, @stdout, @stderr = POSIX::Spawn::popen4 "python #{@py_script}"
1212
open_repository
1313
end
1414

@@ -27,8 +27,9 @@ def send_command(cmd)
2727
# send the command
2828
@stdin.puts cmd
2929
@stdin.flush
30+
return if cmd == "QUIT"
3031

31-
# get status on stderr, first letter indicates state,
32+
# get status on stderr, first letter indicates state,
3233
# remaing value indicates length of the file content
3334
status = @stderr.read(10)
3435
flag = status[0,1]
@@ -46,6 +47,7 @@ def send_command(cmd)
4647

4748
def shutdown
4849
send_command("QUIT")
50+
[@stdout, @stdin, @stderr].each { |io| io.close unless io.closed? }
4951
Process.waitpid(@pid, Process::WNOHANG)
5052
end
5153
end

lib/ohloh_scm/adapters/bzrlib_adapter.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ module OhlohScm::Adapters
55
class BzrlibAdapter < BzrAdapter
66

77
def setup
8-
@bzr_client = BzrPipeClient.new(url)
9-
@bzr_client.start
8+
bzr_client = BzrPipeClient.new(url)
9+
bzr_client.start
10+
bzr_client
1011
end
1112

1213
def bzr_client
13-
setup unless @bzr_client
14-
return @bzr_client
14+
@bzr_client ||= setup
1515
end
1616

1717
def cleanup

lib/ohloh_scm/adapters/hg/cat_file.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require 'shellwords'
2+
13
module OhlohScm::Adapters
24
class HgAdapter < AbstractAdapter
35
def cat_file(commit, diff)
@@ -20,7 +22,7 @@ def cat(revision, path)
2022
# Example:
2123
# "Foo Bar & Baz" => "Foo\ Bar\ \&\ Baz"
2224
def escape(path)
23-
path.gsub(/[ `'"&()<>|#\$]/) { |c| '\\' + c }
25+
path.shellescape
2426
end
2527
end
2628
end

0 commit comments

Comments
 (0)