hubbard 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -10,7 +10,7 @@ Hubbard was heavily inspired by gitosis, another tool for managing git repositor
10
10
  How It Works
11
11
  ============
12
12
 
13
- All comminication between users and the Hubbard server happens over SSH. Users must register their public SSH keys with the server before they can connect to it.
13
+ All communication between users and the Hubbard server happens over SSH. Users must register their public SSH keys with the server before they can connect to it.
14
14
 
15
15
  When a user connects to the Hubbard server, the SSH daemon tries to find the user's public SSH key the "~/.ssh/authorized_keys" file on the server. That file also contains information about which user to associate with that SSH key. That information is automatically passed to the "hubbard" executable, so there is no way for users to run other programs on the server.
16
16
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.9
1
+ 0.0.10
data/bin/hubbard CHANGED
@@ -6,8 +6,8 @@ require 'yaml'
6
6
  $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))
7
7
  require 'hubbard'
8
8
 
9
- FileUtils.mkdir_p(File.join(Hubbard::HUB_DATA, "projects"))
10
- FileUtils.mkdir_p(File.join(Hubbard::HUB_DATA, "accounts"))
9
+ FileUtils.mkdir_p(Hubbard::PROJECTS_PATH)
10
+ FileUtils.mkdir_p(Hubbard::ACCOUNTS_PATH)
11
11
 
12
12
  def next_arg(msg)
13
13
  if ARGV.length < 1
@@ -45,8 +45,8 @@ def validate_user_name(name)
45
45
  end
46
46
  end
47
47
 
48
- def validate_action_name(name)
49
- unless name == 'read' || name == 'write' || name == 'admin'
48
+ def validate_action_name(action)
49
+ unless Hubbard::ACTIONS.member?(action)
50
50
  $stderr.put "Not a valid action (must be one of: read, write, admin)"
51
51
  exit 1
52
52
  end
@@ -61,10 +61,10 @@ if ENV['SSH_ORIGINAL_COMMAND']
61
61
  end
62
62
  end
63
63
 
64
- defaults = { :format => :text }
64
+ formats = [:text, :yaml]
65
+ defaults = { :format => formats.first }
65
66
  options = {}
66
67
  OptionParser.new do |opts|
67
- formats = [:text, :yaml]
68
68
  opts.on("--private", "Create project with visibility set to private") do |o|
69
69
  options[:private] = o
70
70
  end
@@ -110,8 +110,10 @@ def authorize(project_name, action)
110
110
  end
111
111
 
112
112
  def is_authorized(project_name, action)
113
+ project_dir = find_project_dir(project_name)
114
+ return false if not File.exist?(project_dir)
113
115
  return true if @username == 'admin'
114
- Dir.chdir(find_project_dir(project_name)) do
116
+ Dir.chdir(project_dir) do
115
117
  if action == 'read' && File.read('.visibility').strip == 'public'
116
118
  return true
117
119
  end
@@ -128,15 +130,15 @@ def is_authorized(project_name, action)
128
130
  end
129
131
 
130
132
  def find_account_dir(user_name)
131
- File.join(Hubbard::HUB_DATA, "accounts", user_name)
133
+ File.join(Hubbard::ACCOUNTS_PATH, user_name)
132
134
  end
133
135
 
134
136
  def find_project_dir(project_name)
135
- File.join(Hubbard::HUB_DATA, "projects", project_name)
137
+ File.join(Hubbard::PROJECTS_PATH, project_name)
136
138
  end
137
139
 
138
140
  def find_repository_dir(project_name, repository_dir)
139
- File.join(find_project_dir(project_name), repository_dir)
141
+ File.join(find_project_dir(project_name), repository_dir + '.git')
140
142
  end
141
143
 
142
144
  def read_project_name
@@ -159,9 +161,9 @@ end
159
161
 
160
162
  def sync_keys
161
163
  File.open(File.expand_path("~/.ssh/authorized_keys"), "w") do |file|
162
- Dir.entries(File.join(Hubbard::HUB_DATA, "accounts")).each do |account|
164
+ Dir.entries(Hubbard::ACCOUNTS_PATH).each do |account|
163
165
  next if account == '.' || account == '..'
164
- key_dir = File.join(Hubbard::HUB_DATA, "accounts", account, "keys")
166
+ key_dir = File.join(Hubbard::ACCOUNTS_PATH, account, "keys")
165
167
  Dir.entries(key_dir).each do |name|
166
168
  next if name == '.' || name == '..'
167
169
  key = File.read(File.join(key_dir, name))
data/commands/add-key.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  name = next_arg("Please specify the key name")
2
- if name !~ /[a-zA-Z0-9]+/
2
+ if name !~ Hubbard::KEY_NAME_REGEX
3
3
  $stderr.puts "Not a valid key name (letters and numbers only)"
4
4
  exit 1
5
5
  end
6
6
 
7
7
  key = $stdin.read.strip
8
- if key !~ /(ssh-rsa|ssh-dsa) ([a-zA-Z0-9\+\/]+[=]*)/
8
+ if key !~ Hubbard::KEY_REGEX
9
9
  $stderr.puts "Not a valid key"
10
10
  exit 1
11
11
  end
@@ -3,10 +3,7 @@ authorize(project_name, 'admin')
3
3
  dir = find_project_dir(project_name)
4
4
  username = ARGV.shift
5
5
  action = ARGV.shift
6
- unless ['admin','write','read'].member?(action)
7
- $stderr.puts "Not a valid action (must be one of: read, write, admin)"
8
- exit 1
9
- end
6
+ validate_action_name(action)
10
7
 
11
8
  File.open(File.join(dir, ".lock"), "w+") do |lock|
12
9
  lock.flock(File::LOCK_EX)
@@ -1,6 +1,7 @@
1
1
  require 'fileutils'
2
2
 
3
3
  project_name = read_project_name
4
+ description = next_arg "Please specify a project description"
4
5
  dir = find_project_dir(project_name)
5
6
  if File.exist?(dir)
6
7
  $stderr.puts "Project already exists with that name"
@@ -10,5 +11,8 @@ unless Dir.mkdir(dir)
10
11
  $stderr.puts "Unable to create directory: #{dir}"
11
12
  end
12
13
  visibility = OPTIONS[:private] ? "private" : "public"
13
- File.open(File.join(dir, ".permissions"), "w") { |f| f << "#{@username}=admin\n" }
14
+ if @username != 'admin'
15
+ File.open(File.join(dir, ".permissions"), "w") { |f| f << "#{@username}=admin\n" }
16
+ end
14
17
  File.open(File.join(dir, ".visibility"), "w") { |f| f << "#{visibility}\n" }
18
+ File.open(File.join(dir, ".description"), "w") { |f| f << "#{description}\n" }
@@ -4,6 +4,6 @@ authorize(project_name, 'admin')
4
4
  dir = find_repository_dir(project_name, repository_name)
5
5
  FileUtils.mkdir_p(dir)
6
6
  Dir.chdir(dir) do
7
- exit $? unless system "git init --bare"
7
+ exit $? unless system "git --bare init --shared"
8
8
  exec "git config hubbard.forkid #{project_name}/#{repository_name}/#{Time.now.to_i}"
9
9
  end
@@ -8,7 +8,7 @@ from_dir = find_repository_dir(from_project_name, from_repository_name)
8
8
  to_dir = find_repository_dir(to_project_name, to_repository_name)
9
9
  forkid = Dir.chdir(from_dir) { `git config --get hubbard.forkid` }
10
10
  FileUtils.mkdir_p(to_dir)
11
- exit $? unless system "git clone --bare #{from_dir} #{to_dir}"
11
+ exit $? unless system "git clone --bare --shared #{from_dir} #{to_dir}"
12
12
  Dir.chdir(to_dir) do
13
13
  exec "git config hubbard.forkid #{forkid}"
14
14
  end
@@ -3,11 +3,12 @@ repository_name = read_repository_name
3
3
  authorize(project_name, 'read')
4
4
  forkid = Dir.chdir(find_repository_dir(project_name, repository_name)) { `git config --get hubbard.forkid` }
5
5
  project_dir = find_project_dir(project_name)
6
- Dir.foreach(File.join(Hubbard::HUB_DATA, 'projects')) do |dir|
6
+ Dir.foreach(File.join(Hubbard::PROJECTS_PATH)) do |dir|
7
7
  next if dir == "." || dir == ".."
8
8
  next unless is_authorized(dir, 'read')
9
- Dir.foreach(find_project_dir(project_name)) do |repository_name|
10
- next if repository_name =~ /^\./
9
+ Dir.foreach(find_project_dir(project_name)) do |repository_dir|
10
+ next if repository_dir =~ /^\./
11
+ repository_name = repository_dir.chomp('.git')
11
12
  Dir.chdir(find_repository_dir(project_name, repository_name)) do
12
13
  if forkid == `git config --get hubbard.forkid`
13
14
  puts "#{project_name}/#{repository_name}"
@@ -1,13 +1,18 @@
1
1
  projects = []
2
- Dir.foreach(File.join(Hubbard::HUB_DATA, 'projects')) do |dir|
3
- next if dir == "." || dir == ".."
4
- if is_authorized(dir, 'read')
5
- projects << dir
2
+ Dir.foreach(Hubbard::PROJECTS_PATH) do |project|
3
+ next if project == "." || project == ".."
4
+ if is_authorized(project, 'read')
5
+ project_path = File.join(Hubbard::PROJECTS_PATH, project)
6
+ vis = File.read(File.join(project_path, ".visibility")).strip
7
+ desc = File.read(File.join(project_path, ".description")).strip
8
+ projects << { :name => project, :visibility => vis, :description => desc }
6
9
  end
7
10
  end
8
11
 
9
12
  if OPTIONS[:format] == :yaml
10
13
  puts YAML::dump(projects)
11
14
  else
12
- projects.each { |p| puts p }
15
+ projects.each do |p|
16
+ puts "#{p[:name].ljust(16)} #{p[:visibility].ljust(10)} #{p[:description]}"
17
+ end
13
18
  end
@@ -1,10 +1,10 @@
1
1
  project_name = read_project_name
2
2
  authorize(project_name, 'read')
3
3
  repositories = []
4
- Dir.foreach(find_project_dir(project_name)) do |repository_name|
5
- next if repository_name =~ /^\./
6
- git_url = "#{ENV['USER']}@#{Hubbard::HUB_HOST}:#{project_name}/#{repository_name}.git"
7
- repositories << { :name => repository_name, :url => git_url }
4
+ Dir.foreach(find_project_dir(project_name)) do |repository_dir|
5
+ next if repository_dir =~ /^\./
6
+ git_url = "#{ENV['USER']}@#{Hubbard::HUB_HOST}:#{project_name}/#{repository_dir}"
7
+ repositories << { :name => repository_dir.chomp('.git'), :url => git_url }
8
8
  end
9
9
 
10
10
  if OPTIONS[:format] == :yaml
@@ -1,11 +1,9 @@
1
- users = []
2
- Dir.entries(File.join(Hubbard::HUB_DATA, "accounts")).each do |entry|
3
- next if entry == '.' || entry == '..'
4
- users << entry
1
+ if @username != 'admin'
2
+ $stderr.puts "You don't have permission to do that"
3
+ exit 3
5
4
  end
6
5
 
7
- if OPTIONS[:format] == :yaml
8
- puts YAML::dump(users)
9
- else
10
- users.each { |u| puts u }
6
+ Dir.entries(Hubbard::ACCOUNTS_PATH)).each do |account|
7
+ next if account == '.' || account == '..'
8
+ puts account
11
9
  end
@@ -0,0 +1,23 @@
1
+ from_project_name = read_project_name
2
+ from_repository_name = read_repository_name
3
+
4
+ to_project_name = read_project_name
5
+ to_repository_name = read_repository_name
6
+
7
+ from_dir = find_repository_dir(from_project_name, from_repository_name)
8
+ to_dir = find_repository_dir(to_project_name, to_repository_name)
9
+
10
+ authorize(from_project_name, 'admin')
11
+ authorize(to_project_name, 'admin')
12
+
13
+ if not File.exist?(from_dir)
14
+ $stderr.puts "Repository not found"
15
+ exit 4
16
+ end
17
+
18
+ if File.exist?(to_dir)
19
+ $stderr.puts "Repository already exists with that name"
20
+ exit 4
21
+ end
22
+
23
+ FileUtils.mv(from_dir, to_dir)
@@ -1,5 +1,5 @@
1
1
  name = next_arg("Please specify the key name")
2
- if name !~ /[a-zA-Z0-9]+/
2
+ if name !~ Hubbard::KEY_NAME_REGEX
3
3
  $stderr.puts "Not a valid key name (letters and numbers only)"
4
4
  exit 1
5
5
  end
@@ -0,0 +1,11 @@
1
+ from_project_name = read_project_name
2
+ to_project_name = next_arg "Please specify the new project name"
3
+ from_dir = find_project_dir(from_project_name)
4
+ to_dir = find_project_dir(to_project_name)
5
+ if File.exist?(to_dir)
6
+ $stderr.puts "A project already exists with that name"
7
+ exit 3
8
+ end
9
+
10
+ authorize(from_project_name, 'admin')
11
+ FileUtils.mv(from_dir, to_dir)
@@ -0,0 +1,15 @@
1
+ require 'fileutils'
2
+
3
+ project_name = read_project_name
4
+ authorize(project_name, 'admin')
5
+
6
+ description = next_arg "Please specify the description"
7
+
8
+ dir = find_project_dir(project_name)
9
+ if !File.exist?(dir)
10
+ $stderr.puts "Project not found"
11
+ exit 4
12
+ end
13
+
14
+ File.open(File.join(dir, ".description"), "w") { |f| f << description << "\n" }
15
+
@@ -0,0 +1,17 @@
1
+ require 'fileutils'
2
+
3
+ project_name = read_project_name
4
+ visibility = next_arg "Please specify one of: public, private"
5
+ if visibility != 'public' and visibility != 'private'
6
+ $stderr.puts "Please specify one of: public, private"
7
+ exit 3
8
+ end
9
+
10
+ dir = find_project_dir(project_name)
11
+ if !File.exist?(dir)
12
+ $stderr.puts "Project not found"
13
+ exit 4
14
+ end
15
+
16
+ File.open(File.join(dir, ".visibility"), "w") { |f| f << visibility << "\n" }
17
+
@@ -0,0 +1 @@
1
+ puts @username
data/hubbard.gemspec ADDED
@@ -0,0 +1,82 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{hubbard}
8
+ s.version = "0.0.10"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Matthew Foemmel"]
12
+ s.date = %q{2010-01-30}
13
+ s.description = %q{Hubbard is a command line tool for managing git repositories.}
14
+ s.email = %q{git@foemmel.com}
15
+ s.executables = ["hubbard", "hubbard~", "hubbard"]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE",
18
+ "README.md"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ ".gitignore",
23
+ "LICENSE",
24
+ "README.md",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "bin/hubbard",
28
+ "commands/add-key.rb",
29
+ "commands/add-permission.rb",
30
+ "commands/create-project.rb",
31
+ "commands/create-repository.rb",
32
+ "commands/delete-project.rb",
33
+ "commands/fork-repository.rb",
34
+ "commands/git-receive-pack.rb",
35
+ "commands/git-upload-pack.rb",
36
+ "commands/help.rb",
37
+ "commands/list-forks.rb",
38
+ "commands/list-keys.rb",
39
+ "commands/list-permissions.rb",
40
+ "commands/list-projects.rb",
41
+ "commands/list-repositories.rb",
42
+ "commands/list-users.rb",
43
+ "commands/move-repository.rb",
44
+ "commands/remove-key.rb",
45
+ "commands/remove-permission.rb",
46
+ "commands/rename-project.rb",
47
+ "commands/set-description.rb",
48
+ "commands/set-visibility.rb",
49
+ "commands/whoami.rb",
50
+ "hubbard.gemspec",
51
+ "lib/hubbard.rb",
52
+ "spec/gitssh",
53
+ "spec/hubbard_spec.rb",
54
+ "spec/spec.opts",
55
+ "spec/spec_helper.rb",
56
+ "spec/yaml_spec.rb"
57
+ ]
58
+ s.homepage = %q{http://github.com/mfoemmel/hubbard}
59
+ s.rdoc_options = ["--charset=UTF-8"]
60
+ s.require_paths = ["lib"]
61
+ s.rubygems_version = %q{1.3.5}
62
+ s.summary = %q{Hubbard is a command line tool for managing git repositories.}
63
+ s.test_files = [
64
+ "spec/hubbard_spec.rb",
65
+ "spec/spec_helper.rb",
66
+ "spec/yaml_spec.rb"
67
+ ]
68
+
69
+ if s.respond_to? :specification_version then
70
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
71
+ s.specification_version = 3
72
+
73
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
74
+ s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
75
+ else
76
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
77
+ end
78
+ else
79
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
80
+ end
81
+ end
82
+
data/lib/hubbard.rb CHANGED
@@ -4,7 +4,13 @@ module Hubbard
4
4
  PROJECT_REGEX='[a-zA-Z0-9\-]{1,32}'
5
5
  REPOSITORY_REGEX='[a-zA-Z0-9\-]{1,32}'
6
6
  USERNAME_REGEX='[a-zA-Z0-9\-]{1,32}'
7
+ KEY_NAME_REGEX = /[a-zA-Z0-9]+/
8
+ KEY_REGEX = /(ssh-rsa|ssh-dsa) ([a-zA-Z0-9\+\/]+[=]*)/
7
9
 
8
10
  HUB_DATA = ENV['HUB_DATA'] || File.expand_path("~/.hubbard")
9
11
  HUB_HOST = ENV['HUB_HOST'] || Socket.gethostname
12
+ PROJECTS_PATH = File.join(HUB_DATA, "projects")
13
+ ACCOUNTS_PATH = File.join(HUB_DATA, "accounts")
14
+
15
+ ACTIONS = ['read', 'write', 'admin']
10
16
  end
data/spec/hubbard_spec.rb CHANGED
@@ -6,19 +6,44 @@ describe "Hubble" do
6
6
  reset_file_system
7
7
  end
8
8
 
9
+ after(:all) do
10
+ reset_file_system
11
+ end
12
+
9
13
  it "should create project" do
10
- hub("kipper", "create-project foo")
11
- projects = hub("kipper", "list-projects").split("\n")
14
+ hub("kipper", "create-project foo foo-desc")
15
+ projects = list_projects('kipper')
12
16
  projects.should == ["foo"]
13
17
  end
14
18
 
19
+ it "should set project description" do
20
+ hub("kipper", "create-project foo old-desc")
21
+ hub("kipper", "set-description foo new-desc")
22
+ project = hub("kipper", "list-projects").split("\n")[0].split
23
+ project[2].should == "new-desc"
24
+ end
25
+
26
+ it "should set project visibility" do
27
+ hub("kipper", "create-project foo foo-desc")
28
+ hub("kipper", "set-visibility foo private")
29
+ project = hub("kipper", "list-projects").split("\n")[0].split
30
+ project[1].should == "private"
31
+ end
32
+
33
+ it "should rename project" do
34
+ hub("kipper", "create-project foo foo-desc")
35
+ hub("kipper", "rename-project foo bar")
36
+ project = hub("kipper", "list-projects").split("\n")[0].split
37
+ project[0].should == "bar"
38
+ end
39
+
15
40
  it "should not allow multiple projects with same name" do
16
- hub("kipper", "create-project foo")
41
+ hub("kipper", "create-project foo foo-desc")
17
42
  lambda { hub("kipper", "create-project foo") }.should raise_error
18
43
  end
19
44
 
20
45
  it "should delete project" do
21
- hub("kipper", "create-project foo")
46
+ hub("kipper", "create-project foo foo-desc")
22
47
  hub("kipper", "delete-project foo")
23
48
 
24
49
  projects = hub("kipper", "list-projects").split("\n")
@@ -26,10 +51,10 @@ describe "Hubble" do
26
51
  end
27
52
 
28
53
  it "should default to public project" do
29
- hub("kipper", "create-project foo")
54
+ hub("kipper", "create-project foo foo-desc")
30
55
 
31
56
  # Other users can see...
32
- projects = hub("tiger", "list-projects").split("\n")
57
+ projects = list_projects("tiger")
33
58
  projects.should == ["foo"]
34
59
 
35
60
  # But not delete
@@ -37,7 +62,7 @@ describe "Hubble" do
37
62
  end
38
63
 
39
64
  it "should support private project" do
40
- hub("kipper", "create-project foo --private")
65
+ hub("kipper", "create-project foo foo-desc --private")
41
66
 
42
67
  # Other users can't see
43
68
  projects = hub("tiger", "list-projects").split("\n")
@@ -45,7 +70,7 @@ describe "Hubble" do
45
70
  end
46
71
 
47
72
  it "should create repositories" do
48
- hub("kipper", "create-project foo")
73
+ hub("kipper", "create-project foo foo-desc")
49
74
  hub("kipper", "create-repository foo bar")
50
75
 
51
76
  repositories = hub("kipper", "list-repositories foo").split("\n")
@@ -67,7 +92,7 @@ describe "Hubble" do
67
92
  end
68
93
 
69
94
  it "should allow git push" do
70
- hub("kipper", "create-project foo")
95
+ hub("kipper", "create-project foo foo-desc")
71
96
  hub("kipper", "create-repository foo bar")
72
97
 
73
98
  with_test_project do
@@ -75,8 +100,20 @@ describe "Hubble" do
75
100
  end
76
101
  end
77
102
 
103
+ it "should move repository" do
104
+ hub("kipper", "create-project foo foo-desc")
105
+ hub("kipper", "create-project new-foo foo-desc")
106
+ hub("kipper", "create-repository foo bar")
107
+
108
+ with_test_project do
109
+ git("kipper", "push #{ENV['USER']}@#{HUB_HOST}:foo/bar.git master")
110
+ hub("kipper", "move-repository foo bar new-foo baz")
111
+ git("kipper", "push #{ENV['USER']}@#{HUB_HOST}:new-foo/baz.git master")
112
+ end
113
+ end
114
+
78
115
  it "should allow git push with write permissions" do
79
- hub("kipper", "create-project foo")
116
+ hub("kipper", "create-project foo foo-desc")
80
117
  hub("kipper", "add-permission foo tiger write")
81
118
  hub("kipper", "create-repository foo bar")
82
119
 
@@ -86,7 +123,7 @@ describe "Hubble" do
86
123
  end
87
124
 
88
125
  it "should not allow git push with read permissions" do
89
- hub("kipper", "create-project foo")
126
+ hub("kipper", "create-project foo foo-desc")
90
127
  hub("kipper", "add-permission foo tiger read")
91
128
  hub("kipper", "create-repository foo bar")
92
129
 
@@ -96,7 +133,7 @@ describe "Hubble" do
96
133
  end
97
134
 
98
135
  it "should allow git pull" do
99
- hub("kipper", "create-project foo")
136
+ hub("kipper", "create-project foo foo-desc")
100
137
  hub("kipper", "create-repository foo bar")
101
138
 
102
139
  with_test_project do
@@ -106,7 +143,7 @@ describe "Hubble" do
106
143
  end
107
144
 
108
145
  it "should not allow git pull with no permissions" do
109
- hub("kipper", "create-project foo --private")
146
+ hub("kipper", "create-project foo foo-desc --private")
110
147
  hub("kipper", "create-repository foo bar")
111
148
 
112
149
  with_test_project do
@@ -116,7 +153,7 @@ describe "Hubble" do
116
153
  end
117
154
 
118
155
  it "should allow git pull with read permissions" do
119
- hub("kipper", "create-project foo")
156
+ hub("kipper", "create-project foo foo-desc")
120
157
  hub("kipper", "create-repository foo bar")
121
158
 
122
159
  with_test_project do
@@ -126,7 +163,7 @@ describe "Hubble" do
126
163
  end
127
164
 
128
165
  it "should fork repository in same project" do
129
- hub("kipper", "create-project foo")
166
+ hub("kipper", "create-project foo foo-desc")
130
167
  hub("kipper", "create-repository foo bar")
131
168
 
132
169
  with_test_project do
@@ -137,8 +174,8 @@ describe "Hubble" do
137
174
  end
138
175
 
139
176
  it "should fork repository in different project" do
140
- hub("kipper", "create-project foo")
141
- hub("kipper", "create-project foo2")
177
+ hub("kipper", "create-project foo foo-desc")
178
+ hub("kipper", "create-project foo2 foo2-desc")
142
179
  hub("kipper", "create-repository foo bar")
143
180
 
144
181
  with_test_project do
@@ -149,7 +186,7 @@ describe "Hubble" do
149
186
  end
150
187
 
151
188
  it "should track projects related by forking" do
152
- hub("kipper", "create-project foo")
189
+ hub("kipper", "create-project foo foo-desc")
153
190
  hub("kipper", "create-repository foo bar")
154
191
 
155
192
  with_test_project do
@@ -160,8 +197,8 @@ describe "Hubble" do
160
197
  end
161
198
 
162
199
  it "should require read access to fork repository" do
163
- hub("kipper", "create-project foo")
164
- hub("kipper", "create-project foo2")
200
+ hub("kipper", "create-project foo foo-desc")
201
+ hub("kipper", "create-project foo2 foo-desc")
165
202
  hub("kipper", "create-repository foo bar")
166
203
 
167
204
  with_test_project do
@@ -178,7 +215,7 @@ describe "Hubble" do
178
215
  end
179
216
 
180
217
  it "should remove permission" do
181
- hub("kipper", "create-project foo")
218
+ hub("kipper", "create-project foo foo-desc")
182
219
  hub("kipper", "create-repository foo bar")
183
220
  hub("kipper", "add-permission foo tiger read")
184
221
  hub("kipper", "remove-permission foo tiger")
@@ -193,8 +230,8 @@ describe "Hubble" do
193
230
  end
194
231
 
195
232
  it "should allow admin to run-as another user" do
196
- hub("admin", "run-as kipper create-project foo")
197
- projects = hub("kipper", "list-projects").split("\n")
233
+ hub("admin", "run-as kipper create-project foo foo-desc")
234
+ projects = list_projects("kipper")
198
235
  projects.should == ["foo"]
199
236
  end
200
237
  end
data/spec/spec.opts CHANGED
@@ -1 +1,6 @@
1
- --color
1
+ --colour
2
+ --format
3
+ progress
4
+ --loadby
5
+ mtime
6
+ --reverse
data/spec/spec_helper.rb CHANGED
@@ -45,3 +45,8 @@ def reset_file_system
45
45
  FileUtils.rm_rf HUB_DATA
46
46
  FileUtils.rm_rf "tmp"
47
47
  end
48
+
49
+ def list_projects(user)
50
+ hub(user, "list-projects").split("\n").map { |line| line.split[0] }
51
+ end
52
+
data/spec/yaml_spec.rb CHANGED
@@ -7,17 +7,21 @@ describe "Hubble with yaml output" do
7
7
  reset_file_system
8
8
  end
9
9
 
10
+ after(:all) do
11
+ reset_file_system
12
+ end
13
+
10
14
  it "should load list-projects" do
11
- hub("yammer", "create-project a")
12
- hub("yammer", "create-project b")
13
- hub("yammer", "create-project c")
15
+ hub("yammer", "create-project a a-desc")
16
+ hub("yammer", "create-project b b-desc")
17
+ hub("yammer", "create-project c c-desc")
14
18
 
15
- projects = YAML::load(hub("#{YAML_OPTION} yammer", "list-projects"))
19
+ projects = YAML::load(hub("yammer", "#{YAML_OPTION} list-projects")).map{|project|project[:name]}
16
20
  projects.should == ["a", "b", "c"]
17
21
  end
18
22
 
19
23
  it "should create repositories" do
20
- hub("yammer", "create-project a")
24
+ hub("yammer", "create-project a a-desc")
21
25
  hub("yammer", "create-repository a b")
22
26
 
23
27
  repositories = YAML::load(hub("yammer", "#{YAML_OPTION} list-repositories a"))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hubbard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Foemmel
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-29 00:00:00 -06:00
12
+ date: 2010-01-30 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -56,8 +56,14 @@ files:
56
56
  - commands/list-projects.rb
57
57
  - commands/list-repositories.rb
58
58
  - commands/list-users.rb
59
+ - commands/move-repository.rb
59
60
  - commands/remove-key.rb
60
61
  - commands/remove-permission.rb
62
+ - commands/rename-project.rb
63
+ - commands/set-description.rb
64
+ - commands/set-visibility.rb
65
+ - commands/whoami.rb
66
+ - hubbard.gemspec
61
67
  - lib/hubbard.rb
62
68
  - spec/gitssh
63
69
  - spec/hubbard_spec.rb