gritano 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/README.rdoc +1 -1
- data/TODO +4 -3
- data/VERSION +1 -1
- data/bin/gritano +1 -1
- data/gritano.gemspec +5 -2
- data/lib/gritano/console.rb +36 -19
- data/lib/gritano/models/repository.rb +5 -0
- metadata +19 -3
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -54,6 +54,7 @@ GEM
|
|
54
54
|
simplecov-html (~> 0.5.3)
|
55
55
|
simplecov-html (0.5.3)
|
56
56
|
sqlite3 (1.3.6)
|
57
|
+
terminal-table (1.4.5)
|
57
58
|
tzinfo (0.3.33)
|
58
59
|
|
59
60
|
PLATFORMS
|
@@ -70,3 +71,4 @@ DEPENDENCIES
|
|
70
71
|
rspec (>= 2.11.0)
|
71
72
|
simplecov (>= 0.6.4)
|
72
73
|
sqlite3 (>= 1.3.6)
|
74
|
+
terminal-table (>= 1.4.5)
|
data/README.rdoc
CHANGED
data/TODO
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
Outros
|
2
|
+
- melhorar comandos
|
3
|
+
gritano user:add igorbonadio
|
2
4
|
- usuário pode (ou não) criar repositorios via ssh
|
3
|
-
ssh git@host.com
|
5
|
+
ssh git@host.com addrepo reponame.git
|
4
6
|
ssh git@host.com rmrepo reponame.git
|
5
|
-
-
|
6
|
-
- Melhorar specs e features
|
7
|
+
- recuperar acesso via email/código e envio de chave via código
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/bin/gritano
CHANGED
data/gritano.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "gritano"
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Igor Bonadio"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-12-07"
|
13
13
|
s.description = "Gritano is the simplest way to configure your git server over ssh. You can create repositories and manage user access."
|
14
14
|
s.email = "igorbonadio@gmail.com"
|
15
15
|
s.executables = ["gritano", "gritano-check"]
|
@@ -80,6 +80,7 @@ Gem::Specification.new do |s|
|
|
80
80
|
s.add_runtime_dependency(%q<activerecord>, [">= 3.2.8"])
|
81
81
|
s.add_runtime_dependency(%q<sqlite3>, [">= 1.3.6"])
|
82
82
|
s.add_runtime_dependency(%q<grit>, [">= 2.5.0"])
|
83
|
+
s.add_runtime_dependency(%q<terminal-table>, [">= 1.4.5"])
|
83
84
|
s.add_development_dependency(%q<rspec>, [">= 2.11.0"])
|
84
85
|
s.add_development_dependency(%q<rdoc>, [">= 3.12"])
|
85
86
|
s.add_development_dependency(%q<cucumber>, [">= 1.2.1"])
|
@@ -91,6 +92,7 @@ Gem::Specification.new do |s|
|
|
91
92
|
s.add_dependency(%q<activerecord>, [">= 3.2.8"])
|
92
93
|
s.add_dependency(%q<sqlite3>, [">= 1.3.6"])
|
93
94
|
s.add_dependency(%q<grit>, [">= 2.5.0"])
|
95
|
+
s.add_dependency(%q<terminal-table>, [">= 1.4.5"])
|
94
96
|
s.add_dependency(%q<rspec>, [">= 2.11.0"])
|
95
97
|
s.add_dependency(%q<rdoc>, [">= 3.12"])
|
96
98
|
s.add_dependency(%q<cucumber>, [">= 1.2.1"])
|
@@ -103,6 +105,7 @@ Gem::Specification.new do |s|
|
|
103
105
|
s.add_dependency(%q<activerecord>, [">= 3.2.8"])
|
104
106
|
s.add_dependency(%q<sqlite3>, [">= 1.3.6"])
|
105
107
|
s.add_dependency(%q<grit>, [">= 2.5.0"])
|
108
|
+
s.add_dependency(%q<terminal-table>, [">= 1.4.5"])
|
106
109
|
s.add_dependency(%q<rspec>, [">= 2.11.0"])
|
107
110
|
s.add_dependency(%q<rdoc>, [">= 3.12"])
|
108
111
|
s.add_dependency(%q<cucumber>, [">= 1.2.1"])
|
data/lib/gritano/console.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "terminal-table"
|
2
|
+
|
1
3
|
module Gritano
|
2
4
|
class Console
|
3
5
|
|
@@ -15,10 +17,13 @@ module Gritano
|
|
15
17
|
end
|
16
18
|
|
17
19
|
def user_list(argv)
|
18
|
-
msg = "Users:\n"
|
19
20
|
users = User.all
|
20
|
-
|
21
|
-
|
21
|
+
msg = Terminal::Table.new do |t|
|
22
|
+
t << ['user']
|
23
|
+
t << :separator
|
24
|
+
users.each do |user|
|
25
|
+
t.add_row [user.login]
|
26
|
+
end
|
22
27
|
end
|
23
28
|
msg = "there is no user registered" if users.count == 0
|
24
29
|
return [true, msg]
|
@@ -29,9 +34,12 @@ module Gritano
|
|
29
34
|
user = User.find_by_login(login)
|
30
35
|
if user
|
31
36
|
keys = user.keys
|
32
|
-
msg =
|
33
|
-
|
34
|
-
|
37
|
+
msg = Terminal::Table.new do |t|
|
38
|
+
t << ['keys']
|
39
|
+
t << :separator
|
40
|
+
keys.each do |key|
|
41
|
+
t.add_row [key.name]
|
42
|
+
end
|
35
43
|
end
|
36
44
|
msg = "there is no key registered" if keys.count == 0
|
37
45
|
return [true, msg]
|
@@ -45,9 +53,12 @@ module Gritano
|
|
45
53
|
user = User.find_by_login(login)
|
46
54
|
if user
|
47
55
|
repos = user.repositories
|
48
|
-
msg =
|
49
|
-
|
50
|
-
|
56
|
+
msg = Terminal::Table.new do |t|
|
57
|
+
t << ['repositories']
|
58
|
+
t << :separator
|
59
|
+
repos.each do |repo|
|
60
|
+
t.add_row [repo.name]
|
61
|
+
end
|
51
62
|
end
|
52
63
|
msg = "there is no repository registered" if repos.count == 0
|
53
64
|
return [true, msg]
|
@@ -75,10 +86,13 @@ module Gritano
|
|
75
86
|
end
|
76
87
|
|
77
88
|
def repo_list(argv)
|
78
|
-
msg = "Repositories:\n"
|
79
89
|
repos = Repository.all
|
80
|
-
|
81
|
-
|
90
|
+
msg = Terminal::Table.new do |t|
|
91
|
+
t << ['repositories']
|
92
|
+
t << :separator
|
93
|
+
repos.each do |repo|
|
94
|
+
t.add_row [repo.name]
|
95
|
+
end
|
82
96
|
end
|
83
97
|
msg = "there is no repository registered" if repos.count == 0
|
84
98
|
return [true, msg]
|
@@ -96,14 +110,17 @@ module Gritano
|
|
96
110
|
repo = Repository.find_by_name(name)
|
97
111
|
if repo
|
98
112
|
users = repo.users
|
99
|
-
msg =
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
permissions
|
104
|
-
permissions
|
113
|
+
msg = Terminal::Table.new do |t|
|
114
|
+
t << ['user', 'permission']
|
115
|
+
t << :separator
|
116
|
+
users.each do |user|
|
117
|
+
permissions = ""
|
118
|
+
user.permissions.find_by_repository_id(repo.id) do |p|
|
119
|
+
permissions += "r" if p.is(:read)
|
120
|
+
permissions += "w" if p.is(:write)
|
121
|
+
end
|
122
|
+
t.add_row [user.login, permissions]
|
105
123
|
end
|
106
|
-
msg += " - #{user.login}\t #{permissions}\n"
|
107
124
|
end
|
108
125
|
msg = "No user have access to this repository" if users.count == 0
|
109
126
|
return [true, msg]
|
@@ -7,11 +7,16 @@ module Gritano
|
|
7
7
|
has_many :users, through: :permissions
|
8
8
|
|
9
9
|
before_create :create_bare_repo
|
10
|
+
after_destroy :destroy_bare_repo
|
10
11
|
|
11
12
|
def create_bare_repo
|
12
13
|
Grit::Repo.init_bare(full_path)
|
13
14
|
end
|
14
15
|
|
16
|
+
def destroy_bare_repo
|
17
|
+
FileUtils.rm_r(full_path, force: true)
|
18
|
+
end
|
19
|
+
|
15
20
|
def full_path
|
16
21
|
if path
|
17
22
|
File.join(path, name)
|
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.3.
|
4
|
+
version: 0.3.2
|
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
|
+
date: 2012-12-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -59,6 +59,22 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 2.5.0
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: terminal-table
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.4.5
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.4.5
|
62
78
|
- !ruby/object:Gem::Dependency
|
63
79
|
name: rspec
|
64
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -246,7 +262,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
246
262
|
version: '0'
|
247
263
|
segments:
|
248
264
|
- 0
|
249
|
-
hash: -
|
265
|
+
hash: -4358117798513437799
|
250
266
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
251
267
|
none: false
|
252
268
|
requirements:
|