vigetlabs-provisional-repoman 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +38 -0
- data/Rakefile +84 -0
- data/VERSION.yml +4 -0
- data/lib/provisional/repo_man.rb +7 -0
- data/lib/provisional/scm/repo_man_git.rb +26 -0
- data/lib/provisional/scm/repo_man_svn.rb +31 -0
- data/test/test_helper.rb +7 -0
- data/test/unit/repo_man_git_test.rb +50 -0
- data/test/unit/repo_man_svn_test.rb +38 -0
- metadata +72 -0
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Provisional-Repoman
|
2
|
+
|
3
|
+
## Description
|
4
|
+
|
5
|
+
This gem provides [Repo Man](http://github.com/vigetlabs/repo_man)-specific methods for [Provisional](http://github.com/vigetlabs/provisional).
|
6
|
+
|
7
|
+
## Requirements
|
8
|
+
|
9
|
+
Provisional-Repoman requires Provisional 2.1.2 or greater.
|
10
|
+
|
11
|
+
Provisional-Repoman is only tested on Mac OS X. It should also work on Linux. It is not tested or supported on Windows.
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
sudo gem install provisional-repoman
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
See the documentation for Provisional for command-line usage. This gem adds the following SCMs to Provisional:
|
20
|
+
|
21
|
+
* `repo_man_git`: creates a git repository in the `project_name` directory, creates a repository using Repo Man, adds it as the "origin" remote, and pushes.
|
22
|
+
* `repo_man_svn`: creates a Subversion repository called `project_name` using Repo Man, and checks it out into the `project_name` directory.
|
23
|
+
|
24
|
+
Provisional's --domain option should be used to specify the domain under which your Repo Man, Subversion and Git servers live. For instance, if --domain is set to "example.com", the following hosts will be used:
|
25
|
+
|
26
|
+
* for Repo Man API access: repoman.example.com
|
27
|
+
* for Git access: git.example.com
|
28
|
+
* for Subversion access: svn.example.com
|
29
|
+
|
30
|
+
## License
|
31
|
+
|
32
|
+
Copyright (c) 2009 Mark Cornick of Viget Labs <mark@viget.com>
|
33
|
+
|
34
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
35
|
+
|
36
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
37
|
+
|
38
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "provisional-repoman"
|
8
|
+
gem.summary = "Repo Man methods for Provisional"
|
9
|
+
gem.email = "mark@viget.com"
|
10
|
+
gem.homepage = "http://github.com/vigetlabs/provisional-repoman"
|
11
|
+
gem.authors = ["Mark Cornick"]
|
12
|
+
gem.rubyforge_project = "viget"
|
13
|
+
gem.add_dependency 'provisional', '>= 2.1.2'
|
14
|
+
|
15
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
+
end
|
17
|
+
rescue LoadError
|
18
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'rake/testtask'
|
22
|
+
Rake::TestTask.new(:test) do |test|
|
23
|
+
test.libs << 'lib' << 'test'
|
24
|
+
test.pattern = 'test/**/*_test.rb'
|
25
|
+
test.verbose = false
|
26
|
+
end
|
27
|
+
|
28
|
+
begin
|
29
|
+
require 'rcov/rcovtask'
|
30
|
+
Rcov::RcovTask.new do |test|
|
31
|
+
test.libs << 'test'
|
32
|
+
test.pattern = 'test/**/*_test.rb'
|
33
|
+
test.verbose = true
|
34
|
+
test.rcov_opts << '-x gems'
|
35
|
+
end
|
36
|
+
rescue LoadError
|
37
|
+
task :rcov do
|
38
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
task :default => :test
|
44
|
+
|
45
|
+
require 'rake/rdoctask'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
if File.exist?('VERSION.yml')
|
48
|
+
config = YAML.load(File.read('VERSION.yml'))
|
49
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
50
|
+
else
|
51
|
+
version = ""
|
52
|
+
end
|
53
|
+
|
54
|
+
rdoc.rdoc_dir = 'rdoc'
|
55
|
+
rdoc.title = "provisional #{version}"
|
56
|
+
rdoc.rdoc_files.include('README*')
|
57
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
58
|
+
end
|
59
|
+
|
60
|
+
begin
|
61
|
+
require 'rake/contrib/sshpublisher'
|
62
|
+
namespace :rubyforge do
|
63
|
+
|
64
|
+
desc "Release gem and RDoc documentation to RubyForge"
|
65
|
+
task :release => ["rubyforge:release:gem"]
|
66
|
+
|
67
|
+
namespace :release do
|
68
|
+
desc "Publish RDoc to RubyForge."
|
69
|
+
task :docs => [:rdoc] do
|
70
|
+
config = YAML.load(
|
71
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
72
|
+
)
|
73
|
+
|
74
|
+
host = "#{config['username']}@rubyforge.org"
|
75
|
+
remote_dir = "/var/www/gforge-projects/provisional/"
|
76
|
+
local_dir = 'rdoc'
|
77
|
+
|
78
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
rescue LoadError
|
83
|
+
puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured."
|
84
|
+
end
|
data/VERSION.yml
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'provisional/repo_man'
|
3
|
+
require 'provisional/scm/git'
|
4
|
+
|
5
|
+
module Provisional
|
6
|
+
module SCM
|
7
|
+
class RepoManGit < Provisional::SCM::Git
|
8
|
+
def initialize(options)
|
9
|
+
raise ArgumentError, "domain must be specified" unless options['domain']
|
10
|
+
super
|
11
|
+
end
|
12
|
+
|
13
|
+
def checkin
|
14
|
+
begin
|
15
|
+
repo = super
|
16
|
+
RepoMan::Repository.site = "http://repoman.#{@options['domain']}/"
|
17
|
+
RepoMan::Repository.create(:name => @options['name'], :scm => 'git')
|
18
|
+
repo.add_remote('origin', "git.#{@options['domain']}:/srv/git/#{@options['name']}.git")
|
19
|
+
repo.push
|
20
|
+
rescue
|
21
|
+
raise RuntimeError, "Repository created locally, but not pushed to Repo Man due to exception: #{$!}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'provisional/repo_man'
|
3
|
+
require 'provisional/scm/svn'
|
4
|
+
require 'etc'
|
5
|
+
|
6
|
+
module Provisional
|
7
|
+
module SCM
|
8
|
+
class RepoManSvn < Provisional::SCM::Svn
|
9
|
+
def initialize(options)
|
10
|
+
raise ArgumentError, "domain must be specified" unless options['domain']
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
def init
|
15
|
+
begin
|
16
|
+
RepoMan::Repository.site = "http://repoman.#{@options['domain']}/"
|
17
|
+
RepoMan::Repository.create(:name => @options['name'], :scm => 'svn')
|
18
|
+
@options['url'] = "svn://svn.#{@options['domain']}/#{@options['name']}"
|
19
|
+
@options['username'] ||= Etc.getlogin
|
20
|
+
@options['password'] ||= "''"
|
21
|
+
rescue
|
22
|
+
raise RuntimeError, "Repository not created on Repo Man due to exception: #{$!}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def generate_rails
|
27
|
+
super(false)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
+
require File.dirname(__FILE__) + '/../../lib/provisional/scm/repo_man_git'
|
3
|
+
|
4
|
+
class RepoManGitTest < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
@scm = Provisional::SCM::RepoManGit.new(
|
7
|
+
{
|
8
|
+
'name' => 'name',
|
9
|
+
'template_path' => 'template_path',
|
10
|
+
'domain' => 'example.com'
|
11
|
+
}
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_checkin
|
16
|
+
repo_stub = stub()
|
17
|
+
repo_stub.expects(:add).with('.')
|
18
|
+
repo_stub.expects(:commit).with('Initial commit by Provisional')
|
19
|
+
repo_stub.expects(:add_remote)
|
20
|
+
repo_stub.expects(:push)
|
21
|
+
|
22
|
+
Git.expects(:open).returns(repo_stub)
|
23
|
+
Dir.expects(:chdir)
|
24
|
+
gitignore_file = stub()
|
25
|
+
gitignore_file.expects(:puts).with(@scm.gitignore)
|
26
|
+
File.expects(:open).with('.gitignore', 'w').yields(gitignore_file)
|
27
|
+
|
28
|
+
RepoMan::Repository.expects(:create).with(:name => 'name', :scm => 'git')
|
29
|
+
|
30
|
+
@scm.checkin
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_checkin_should_raise_RuntimeError_if_any_step_raises_any_exception
|
34
|
+
repo_stub = stub()
|
35
|
+
repo_stub.expects(:add).with('.')
|
36
|
+
repo_stub.expects(:commit).with('Initial commit by Provisional')
|
37
|
+
|
38
|
+
Git.expects(:open).returns(repo_stub)
|
39
|
+
Dir.expects(:chdir)
|
40
|
+
gitignore_file = stub()
|
41
|
+
gitignore_file.expects(:puts).with(@scm.gitignore)
|
42
|
+
File.expects(:open).with('.gitignore', 'w').yields(gitignore_file)
|
43
|
+
|
44
|
+
RepoMan::Repository.expects(:create).with(:name => 'name', :scm => 'git').raises(Errno::ECONNREFUSED)
|
45
|
+
|
46
|
+
assert_raise RuntimeError do
|
47
|
+
@scm.checkin
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
+
require File.dirname(__FILE__) + '/../../lib/provisional/scm/repo_man_svn'
|
3
|
+
|
4
|
+
class RepoManSvnTest < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
@scm = Provisional::SCM::RepoManSvn.new(
|
7
|
+
{
|
8
|
+
'name' => 'name',
|
9
|
+
'template_path' => 'template_path',
|
10
|
+
'url' => 'url',
|
11
|
+
'domain' => 'example.com'
|
12
|
+
}
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_init
|
17
|
+
RepoMan::Repository.expects(:create).with(:name => 'name', :scm => 'svn')
|
18
|
+
@scm.init
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_init_should_raise_RuntimeError_if_any_step_raises_any_exception
|
22
|
+
RepoMan::Repository.expects(:create).with(:name => 'name', :scm => 'svn').raises(Errno::ECONNREFUSED)
|
23
|
+
assert_raise RuntimeError do
|
24
|
+
@scm.init
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_generate_rails
|
29
|
+
@scm.expects(:system).with("svn co --username= --password= url name")
|
30
|
+
Dir.expects(:chdir).with('name')
|
31
|
+
Dir.expects(:chdir).with('trunk')
|
32
|
+
Rails::Generator::Base.expects(:use_application_sources!)
|
33
|
+
generator_stub = stub()
|
34
|
+
generator_stub.expects(:run).with(%w(. -m template_path), :generator => 'app')
|
35
|
+
Rails::Generator::Scripts::Generate.expects(:new).returns(generator_stub)
|
36
|
+
@scm.generate_rails
|
37
|
+
end
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vigetlabs-provisional-repoman
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mark Cornick
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-05-04 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: provisional
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.1.2
|
24
|
+
version:
|
25
|
+
description:
|
26
|
+
email: mark@viget.com
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- README.md
|
33
|
+
files:
|
34
|
+
- README.md
|
35
|
+
- Rakefile
|
36
|
+
- VERSION.yml
|
37
|
+
- lib/provisional/repo_man.rb
|
38
|
+
- lib/provisional/scm/repo_man_git.rb
|
39
|
+
- lib/provisional/scm/repo_man_svn.rb
|
40
|
+
- test/test_helper.rb
|
41
|
+
- test/unit/repo_man_git_test.rb
|
42
|
+
- test/unit/repo_man_svn_test.rb
|
43
|
+
has_rdoc: true
|
44
|
+
homepage: http://github.com/vigetlabs/provisional-repoman
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options:
|
47
|
+
- --charset=UTF-8
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: "0"
|
55
|
+
version:
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: "0"
|
61
|
+
version:
|
62
|
+
requirements: []
|
63
|
+
|
64
|
+
rubyforge_project: viget
|
65
|
+
rubygems_version: 1.2.0
|
66
|
+
signing_key:
|
67
|
+
specification_version: 3
|
68
|
+
summary: Repo Man methods for Provisional
|
69
|
+
test_files:
|
70
|
+
- test/test_helper.rb
|
71
|
+
- test/unit/repo_man_git_test.rb
|
72
|
+
- test/unit/repo_man_svn_test.rb
|