gritano 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gritano/database.yml +2 -0
- data/{tmp → .ssh}/.gitignore +1 -1
- data/README.rdoc +3 -3
- data/Rakefile +2 -2
- data/TODO +3 -1
- data/VERSION +1 -1
- data/bin/gritano +1 -96
- data/bin/gritano-check +1 -46
- data/features/cli.feature +183 -0
- data/features/console.feature +16 -0
- data/features/data/help-check.txt +13 -0
- data/features/data/help-test.txt +27 -0
- data/features/data/help.txt +27 -0
- data/features/help.feature +9 -0
- data/features/ssh.feature +150 -0
- data/features/step_definitions/cli_steps.rb +71 -0
- data/features/step_definitions/console_step.rb +28 -3
- data/features/step_definitions/help.rb +9 -0
- data/features/step_definitions/ssh_steps.rb +35 -0
- data/features/support/env.rb +4 -2
- data/gritano.gemspec +23 -10
- data/lib/gritano.rb +1 -1
- data/lib/gritano/cli.rb +33 -0
- data/lib/gritano/console.rb +18 -235
- data/lib/gritano/console/base.rb +74 -0
- data/lib/gritano/console/check.rb +83 -0
- data/lib/gritano/console/executor.rb +246 -0
- data/lib/gritano/console/gritano.rb +35 -0
- data/lib/gritano/console/installer.rb +37 -0
- data/spec/{console_spec.rb → executor_spec.rb} +24 -19
- data/spec/gritano_spec.rb +20 -0
- data/spec/installer_spec.rb +23 -0
- data/spec/spec_helper.rb +1 -1
- metadata +23 -10
- data/db/database.yml +0 -2
- data/features/command.feature +0 -32
- data/features/step_definitions/command_step.rb +0 -9
- data/lib/gritano/command.rb +0 -24
- data/spec/command_spec.rb +0 -41
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe Gritano::Console::Installer do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@console = Gritano::Console::Installer.new
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should respond to gritano setup:prepare" do
|
10
|
+
@console.should_receive(:setup_prepare)
|
11
|
+
@console.execute("setup:prepare".split(' '))
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should respond to gritano setup:install" do
|
15
|
+
@console.should_receive(:setup_install)
|
16
|
+
@console.execute("setup:install".split(' '))
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should respond to gritano help" do
|
20
|
+
@console.should_receive(:help)
|
21
|
+
@console.execute("help".split(' '))
|
22
|
+
end
|
23
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -17,7 +17,7 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
|
17
17
|
|
18
18
|
RSpec.configure do |config|
|
19
19
|
config.before(:suite) do
|
20
|
-
ActiveRecord::Base.establish_connection(YAML::load(File.open('
|
20
|
+
ActiveRecord::Base.establish_connection(YAML::load(File.open('.gritano/database.yml')))
|
21
21
|
DatabaseCleaner.strategy = :transaction
|
22
22
|
DatabaseCleaner.clean_with(:truncation)
|
23
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gritano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -200,7 +200,9 @@ extra_rdoc_files:
|
|
200
200
|
- TODO
|
201
201
|
files:
|
202
202
|
- .document
|
203
|
+
- .gritano/database.yml
|
203
204
|
- .rspec
|
205
|
+
- .ssh/.gitignore
|
204
206
|
- Gemfile
|
205
207
|
- Gemfile.lock
|
206
208
|
- LICENSE.txt
|
@@ -209,43 +211,54 @@ files:
|
|
209
211
|
- VERSION
|
210
212
|
- bin/gritano
|
211
213
|
- bin/gritano-check
|
212
|
-
- db/database.yml
|
213
214
|
- db/migrate/001_create_users.rb
|
214
215
|
- db/migrate/002_create_repositories.rb
|
215
216
|
- db/migrate/003_create_permissions.rb
|
216
217
|
- db/migrate/004_create_keys.rb
|
217
218
|
- db/migrate/005_add_admin_to_users.rb
|
218
|
-
- features/
|
219
|
+
- features/cli.feature
|
219
220
|
- features/console.feature
|
221
|
+
- features/data/help-check.txt
|
222
|
+
- features/data/help-test.txt
|
223
|
+
- features/data/help.txt
|
220
224
|
- features/data/keys/full_authorized_keys
|
221
225
|
- features/data/keys/igorbonadio.pub
|
222
226
|
- features/data/keys/igorbonadio_authorized_keys
|
223
227
|
- features/data/keys/jessicaeto.pub
|
224
228
|
- features/data/keys/jessicaeto_authorized_keys
|
229
|
+
- features/help.feature
|
225
230
|
- features/keys.feature
|
226
231
|
- features/polices.feature
|
227
|
-
- features/
|
232
|
+
- features/ssh.feature
|
233
|
+
- features/step_definitions/cli_steps.rb
|
228
234
|
- features/step_definitions/console_step.rb
|
235
|
+
- features/step_definitions/help.rb
|
229
236
|
- features/step_definitions/keys_steps.rb
|
230
237
|
- features/step_definitions/polices_steps.rb
|
238
|
+
- features/step_definitions/ssh_steps.rb
|
231
239
|
- features/support/database_cleaner.rb
|
232
240
|
- features/support/env.rb
|
233
241
|
- gritano.gemspec
|
234
242
|
- lib/gritano.rb
|
235
|
-
- lib/gritano/
|
243
|
+
- lib/gritano/cli.rb
|
236
244
|
- lib/gritano/console.rb
|
245
|
+
- lib/gritano/console/base.rb
|
246
|
+
- lib/gritano/console/check.rb
|
247
|
+
- lib/gritano/console/executor.rb
|
248
|
+
- lib/gritano/console/gritano.rb
|
249
|
+
- lib/gritano/console/installer.rb
|
237
250
|
- lib/gritano/models.rb
|
238
251
|
- lib/gritano/models/key.rb
|
239
252
|
- lib/gritano/models/permission.rb
|
240
253
|
- lib/gritano/models/repository.rb
|
241
254
|
- lib/gritano/models/user.rb
|
242
|
-
- spec/
|
243
|
-
- spec/
|
255
|
+
- spec/executor_spec.rb
|
256
|
+
- spec/gritano_spec.rb
|
257
|
+
- spec/installer_spec.rb
|
244
258
|
- spec/model_key_spec.rb
|
245
259
|
- spec/model_repository_spec.rb
|
246
260
|
- spec/model_user_spec.rb
|
247
261
|
- spec/spec_helper.rb
|
248
|
-
- tmp/.gitignore
|
249
262
|
- TODO
|
250
263
|
homepage: http://github.com/igorbonadio/gritano
|
251
264
|
licenses:
|
@@ -262,7 +275,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
262
275
|
version: '0'
|
263
276
|
segments:
|
264
277
|
- 0
|
265
|
-
hash:
|
278
|
+
hash: 1372008296266253540
|
266
279
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
267
280
|
none: false
|
268
281
|
requirements:
|
data/db/database.yml
DELETED
data/features/command.feature
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
Feature: Command
|
2
|
-
In order to restrict access to repositories
|
3
|
-
As Gritano
|
4
|
-
I want to know if a command is a read/write command
|
5
|
-
|
6
|
-
Scenario Outline: Write command
|
7
|
-
When I receive a "<original_command>" command
|
8
|
-
Then I should see that it is a "<access>": "<command>" "<repo>"
|
9
|
-
Examples:
|
10
|
-
| original_command | access | command | repo |
|
11
|
-
| git-receive-pack proj.git | write | git-receive-pack | proj.git |
|
12
|
-
| git-upload-pack proj.git | read | git-upload-pack | proj.git |
|
13
|
-
| repo:list | user_cmd | user:repo:list [USER] | |
|
14
|
-
| key:list | user_cmd | user:key:list [USER] | |
|
15
|
-
| key:add keyname | user_cmd | user:key:add [USER] keyname | |
|
16
|
-
| key:rm keyname | user_cmd | user:key:rm [USER] keyname | |
|
17
|
-
| admin:user:add username | admin_cmd | user:add username | |
|
18
|
-
| admin:user:rm username | admin_cmd | user:rm username | |
|
19
|
-
| admin:user:key:add username keyname | admin_cmd | user:key:add username keyname | |
|
20
|
-
| admin:user:key:rm username keyname | admin_cmd | user:key:rm username keyname | |
|
21
|
-
| admin:user:list | admin_cmd | user:list | |
|
22
|
-
| admin:user:key:list username | admin_cmd | user:key:list username | |
|
23
|
-
| admin:user:repo:list username | admin_cmd | user:repo:list username | |
|
24
|
-
| admin:repo:add reponame.git | admin_cmd | repo:add reponame.git | |
|
25
|
-
| admin:repo:rm reponame.git | admin_cmd | repo:rm reponame.git | |
|
26
|
-
| admin:repo:read:add reponame.git username | admin_cmd | repo:read:add reponame.git username | |
|
27
|
-
| admin:repo:write:add reponame.git username | admin_cmd | repo:write:add reponame.git username | |
|
28
|
-
| admin:repo:read:rm reponame.git username | admin_cmd | repo:read:rm reponame.git username | |
|
29
|
-
| admin:repo:write:rm reponame.git username | admin_cmd | repo:write:rm reponame.git username | |
|
30
|
-
| admin:repo:list | admin_cmd | repo:list | |
|
31
|
-
| admin:repo:user:list reponame.git | admin_cmd | repo:user:list reponame.git | |
|
32
|
-
| admin:help | admin_cmd | help | |
|
@@ -1,9 +0,0 @@
|
|
1
|
-
When /^I receive a "(.*?)" command$/ do |cmd|
|
2
|
-
@command = Gritano::Command.eval(cmd)
|
3
|
-
end
|
4
|
-
|
5
|
-
Then /^I should see that it is a "(.*?)": "(.*?)" "(.*?)"$/ do |access, command, repo|
|
6
|
-
@command[:access].to_s.should be == access
|
7
|
-
@command[:command].to_s.should be == command
|
8
|
-
@command[:repo].to_s.should be == repo if repo
|
9
|
-
end
|
data/lib/gritano/command.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
module Gritano
|
2
|
-
class Command
|
3
|
-
def self.eval(cmd)
|
4
|
-
case cmd
|
5
|
-
when /^git-receive-pack/ then
|
6
|
-
return {access: :write, command: "git-receive-pack", repo: self.repo(cmd)}
|
7
|
-
when /^git-upload-pack/ then
|
8
|
-
return {access: :read, command: "git-upload-pack", repo: self.repo(cmd)}
|
9
|
-
when /^repo:/ then
|
10
|
-
return {access: :user_cmd, command: ("user:#{cmd} [USER]")}
|
11
|
-
when /^key:/ then
|
12
|
-
cmd = cmd.split(" ")
|
13
|
-
cmd = [cmd[0]] + ["[USER]"] + cmd[1..-1]
|
14
|
-
return {access: :user_cmd, command: ("user:" + cmd.join(" "))}
|
15
|
-
when /admin:/ then
|
16
|
-
return {access: :admin_cmd, command: cmd.gsub("admin:", "")}
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.repo(cmd)
|
21
|
-
cmd.gsub(/^git-receive-pack/, '').gsub(/^git-upload-pack/, '').gsub("'", '').strip
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
data/spec/command_spec.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe Gritano::Command do
|
4
|
-
it 'should interpret git-receive-pack' do
|
5
|
-
command = Gritano::Command.eval("git-receive-pack 'teste.git'")
|
6
|
-
command[:access].to_s.should be == "write"
|
7
|
-
command[:command].should be == "git-receive-pack"
|
8
|
-
command[:repo].to_s.should be == "teste.git"
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'should interpret git-upload-pack' do
|
12
|
-
command = Gritano::Command.eval("git-upload-pack 'teste.git'")
|
13
|
-
command[:access].to_s.should be == "read"
|
14
|
-
command[:command].should be == "git-upload-pack"
|
15
|
-
command[:repo].to_s.should be == "teste.git"
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'should interpret repos' do
|
19
|
-
command = Gritano::Command.eval("repo:list")
|
20
|
-
command[:access].to_s.should be == "user_cmd"
|
21
|
-
command[:command].should be == "user:repo:list [USER]"
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'should interpret keys' do
|
25
|
-
command = Gritano::Command.eval("key:list")
|
26
|
-
command[:access].to_s.should be == "user_cmd"
|
27
|
-
command[:command].should be == "user:key:list [USER]"
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'should interpret addkey keyname' do
|
31
|
-
command = Gritano::Command.eval("key:add keyname")
|
32
|
-
command[:access].to_s.should be == "user_cmd"
|
33
|
-
command[:command].should be == "user:key:add [USER] keyname"
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'should interpret rmkey keyname' do
|
37
|
-
command = Gritano::Command.eval("key:rm keyname")
|
38
|
-
command[:access].to_s.should be == "user_cmd"
|
39
|
-
command[:command].should be == "user:key:rm [USER] keyname"
|
40
|
-
end
|
41
|
-
end
|