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 CHANGED
@@ -6,6 +6,7 @@ source "http://rubygems.org"
6
6
  gem 'activerecord', ">= 3.2.8"
7
7
  gem 'sqlite3', ">= 1.3.6"
8
8
  gem 'grit', ">= 2.5.0"
9
+ gem 'terminal-table', ">= 1.4.5"
9
10
 
10
11
  # Add dependencies to develop your gem here.
11
12
  # Include everything needed to run rake, tests, features, etc.
@@ -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)
@@ -1,4 +1,4 @@
1
- = Gritano v0.3.0
1
+ = Gritano v0.3.1
2
2
 
3
3
  Gritano is the simplest way to configure a git server over ssh. You can create repositories and manage user access using this practical tool.
4
4
 
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 newrepo reponame.git
5
+ ssh git@host.com addrepo reponame.git
4
6
  ssh git@host.com rmrepo reponame.git
5
- - Stream de mensagens via ssh
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.0
1
+ 0.3.2
@@ -90,7 +90,7 @@ else
90
90
  begin
91
91
  cmd_return = console.execute(ARGV)
92
92
  if cmd_return[0]
93
- puts "success: #{cmd_return[1]}"
93
+ puts "#{cmd_return[1]}"
94
94
  else
95
95
  puts "error: #{cmd_return[1]}"
96
96
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "gritano"
8
- s.version = "0.3.0"
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-11-24"
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"])
@@ -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
- users.each do |user|
21
- msg += " - #{user.login}\n"
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 = "User's keys:\n"
33
- keys.each do |key|
34
- msg += " - #{key.name}\n"
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 = "User's repositories:\n"
49
- repos.each do |repo|
50
- msg += " - #{repo.name}\n"
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
- repos.each do |repo|
81
- msg += " - #{repo.name}\n"
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 = "Users:\n"
100
- users.each do |user|
101
- permissions = ""
102
- user.permissions.find_by_repository_id(repo.id) do |p|
103
- permissions += "r" if p.is(:read)
104
- permissions += "w" if p.is(:write)
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.0
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-11-24 00:00:00.000000000 Z
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: -3218000762772631933
265
+ hash: -4358117798513437799
250
266
  required_rubygems_version: !ruby/object:Gem::Requirement
251
267
  none: false
252
268
  requirements: