gritano 0.11.0 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/.gritano/config.yml +2 -2
  2. data/TODO +2 -3
  3. data/VERSION +1 -1
  4. data/db/migrate/008_remove_password_from_user.rb +10 -0
  5. data/db/migrate/009_remove_email_from_users.rb +10 -0
  6. data/features/data/local_commands/user_list.txt +6 -6
  7. data/features/data/local_help.txt +5 -4
  8. data/features/data/remote_commands/admin_help_igorbonadio.txt +27 -26
  9. data/features/data/remote_commands/admin_help_jessicaeto.txt +27 -26
  10. data/features/data/remote_commands/admin_user_list_igorbonadio.txt +6 -6
  11. data/features/data/remote_commands/help_igorbonadio.txt +9 -12
  12. data/features/data/remote_commands/help_jessicaeto.txt +9 -12
  13. data/features/data/remote_commands/invalid_command_igorbonadio.txt +9 -12
  14. data/features/data/remote_commands/invalid_command_jessicaeto.txt +9 -12
  15. data/features/data/remote_help.txt +0 -3
  16. data/features/local.feature +0 -5
  17. data/features/remote.feature +0 -20
  18. data/features/step_definitions/background_step.rb +0 -1
  19. data/features/support/env.rb +3 -1
  20. data/gritano.gemspec +4 -17
  21. data/lib/gritano/cli.rb +2 -2
  22. data/lib/gritano/config.rb +5 -1
  23. data/lib/gritano/console.rb +7 -6
  24. data/lib/gritano/console/executor.rb +31 -58
  25. data/lib/gritano/console/remote.rb +0 -15
  26. data/lib/gritano/models/user.rb +0 -9
  27. data/spec/cli_spec.rb +2 -2
  28. data/spec/config_spec.rb +15 -15
  29. data/spec/console_executor_spec.rb +1 -1
  30. data/spec/console_spec.rb +11 -7
  31. data/spec/model_user_spec.rb +0 -10
  32. metadata +5 -18
  33. data/features/data/local_commands/user_email_get_igorbonadio.txt +0 -1
  34. data/features/data/local_commands/user_email_get_jessicaeto.txt +0 -1
  35. data/features/data/local_commands/user_email_get_wrong.txt +0 -1
  36. data/features/data/local_commands/user_email_update_igorbonadio_igor@bonadio_com.txt +0 -1
  37. data/features/data/local_commands/user_email_update_wrong_igor@bonadio_com.txt +0 -1
  38. data/features/data/remote_commands/admin_user_email_get_igorbonadio_igorbonadio.txt +0 -1
  39. data/features/data/remote_commands/admin_user_email_get_igorbonadio_jessicaeto.txt +0 -1
  40. data/features/data/remote_commands/admin_user_email_get_jessicaeto_igorbonadio.txt +0 -1
  41. data/features/data/remote_commands/admin_user_email_get_jessicaeto_jessicaeto.txt +0 -1
  42. data/features/data/remote_commands/admin_user_email_get_wrong_igorbonadio.txt +0 -1
  43. data/features/data/remote_commands/admin_user_email_get_wrong_jessicaeto.txt +0 -1
  44. data/features/data/remote_commands/admin_user_email_update_igorbonadio_igor@bonadio_com_igorbonadio.txt +0 -1
  45. data/features/data/remote_commands/admin_user_email_update_igorbonadio_igor@bonadio_com_jessicaeto.txt +0 -1
  46. data/features/data/remote_commands/admin_user_email_update_wrong_igor@bonadio_com_igorbonadio.txt +0 -1
  47. data/features/data/remote_commands/admin_user_email_update_wrong_igor@bonadio_com_jessicaeto.txt +0 -1
data/.gritano/config.yml CHANGED
@@ -1,2 +1,2 @@
1
- ---
2
- ssh: false
1
+ host_url: "gritano.org"
2
+ ssh_user: "git"
data/TODO CHANGED
@@ -1,8 +1,7 @@
1
- v0.12.0:
2
- mostrar url ssh e https se existir
1
+ v0.13.0:
2
+ criar uma api
3
3
 
4
4
  v1.0.0:
5
- ☐ testar instalação manual (anotar o processo)
6
5
  ☐ escrever um manual
7
6
  ☐ site
8
7
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.0
1
+ 0.11.1
@@ -0,0 +1,10 @@
1
+ class RemovePasswordFromUser < ActiveRecord::Migration
2
+ def up
3
+ remove_column :users, :crypted_password
4
+ end
5
+
6
+ def down
7
+ add_column :users, :crypted_password, :string, :default => nil
8
+ end
9
+ end
10
+
@@ -0,0 +1,10 @@
1
+ class RemoveEmailFromUsers < ActiveRecord::Migration
2
+ def up
3
+ remove_column :users, :email
4
+ end
5
+
6
+ def down
7
+ add_column :users, :email, :string
8
+ end
9
+ end
10
+
@@ -1,6 +1,6 @@
1
- +-------------+-----------------+-------+
2
- | user | email | admin |
3
- +-------------+-----------------+-------+
4
- | igorbonadio | - | true |
5
- | jessicaeto | jessica@eto.com | false |
6
- +-------------+-----------------+-------+
1
+ +-------------+-------+
2
+ | user | admin |
3
+ +-------------+-------+
4
+ | igorbonadio | true |
5
+ | jessicaeto | false |
6
+ +-------------+-------+
@@ -8,11 +8,8 @@
8
8
  gritano user:list
9
9
  gritano user:key:list username
10
10
  gritano user:repo:list username
11
- gritano user:add username [email admin]*
12
- gritano user:password:set username
11
+ gritano user:add username [admin]*
13
12
  gritano user:rm username
14
- gritano user:email:update username email@server.com
15
- gritano user:email:get username
16
13
  gritano user:key:add username keyname < key.pub
17
14
  gritano user:key:rm username keyname
18
15
  gritano user:admin:add username
@@ -26,6 +23,10 @@
26
23
  gritano repo:write:add reponame.git username
27
24
  gritano repo:read:rm reponame.git username
28
25
  gritano repo:write:rm reponame.git username
26
+ gritano config:host_url:set url
27
+ gritano config:host_url:get
28
+ gritano config:ssh_user:set user
29
+ gritano config:ssh_user:get
29
30
 
30
31
  --
31
32
  v{{VERSION}}
@@ -1,31 +1,32 @@
1
- ssh git@host.com admin:[command]
1
+ ssh undefined@undefined admin:[command]
2
2
 
3
3
  Examples:
4
- ssh git@host.com admin:help
5
- ssh git@host.com admin:version
6
- ssh git@host.com admin:setup:prepare
7
- ssh git@host.com admin:setup:install
8
- ssh git@host.com admin:user:list
9
- ssh git@host.com admin:user:key:list username
10
- ssh git@host.com admin:user:repo:list username
11
- ssh git@host.com admin:user:add username [email admin]*
12
- ssh git@host.com admin:user:password:set username
13
- ssh git@host.com admin:user:rm username
14
- ssh git@host.com admin:user:email:update username email@server.com
15
- ssh git@host.com admin:user:email:get username
16
- ssh git@host.com admin:user:key:add username keyname < key.pub
17
- ssh git@host.com admin:user:key:rm username keyname
18
- ssh git@host.com admin:user:admin:add username
19
- ssh git@host.com admin:user:admin:rm username
20
- ssh git@host.com admin:user:admin username
21
- ssh git@host.com admin:repo:list
22
- ssh git@host.com admin:repo:add reponame.git [username1 username2 ...]*
23
- ssh git@host.com admin:repo:user:list reponame.git
24
- ssh git@host.com admin:repo:rm reponame.git
25
- ssh git@host.com admin:repo:read:add reponame.git username
26
- ssh git@host.com admin:repo:write:add reponame.git username
27
- ssh git@host.com admin:repo:read:rm reponame.git username
28
- ssh git@host.com admin:repo:write:rm reponame.git username
4
+ ssh undefined@undefined admin:help
5
+ ssh undefined@undefined admin:version
6
+ ssh undefined@undefined admin:setup:prepare
7
+ ssh undefined@undefined admin:setup:install
8
+ ssh undefined@undefined admin:user:list
9
+ ssh undefined@undefined admin:user:key:list username
10
+ ssh undefined@undefined admin:user:repo:list username
11
+ ssh undefined@undefined admin:user:add username [admin]*
12
+ ssh undefined@undefined admin:user:rm username
13
+ ssh undefined@undefined admin:user:key:add username keyname < key.pub
14
+ ssh undefined@undefined admin:user:key:rm username keyname
15
+ ssh undefined@undefined admin:user:admin:add username
16
+ ssh undefined@undefined admin:user:admin:rm username
17
+ ssh undefined@undefined admin:user:admin username
18
+ ssh undefined@undefined admin:repo:list
19
+ ssh undefined@undefined admin:repo:add reponame.git [username1 username2 ...]*
20
+ ssh undefined@undefined admin:repo:user:list reponame.git
21
+ ssh undefined@undefined admin:repo:rm reponame.git
22
+ ssh undefined@undefined admin:repo:read:add reponame.git username
23
+ ssh undefined@undefined admin:repo:write:add reponame.git username
24
+ ssh undefined@undefined admin:repo:read:rm reponame.git username
25
+ ssh undefined@undefined admin:repo:write:rm reponame.git username
26
+ ssh undefined@undefined admin:config:host_url:set url
27
+ ssh undefined@undefined admin:config:host_url:get
28
+ ssh undefined@undefined admin:config:ssh_user:set user
29
+ ssh undefined@undefined admin:config:ssh_user:get
29
30
 
30
31
  --
31
32
  v{{VERSION}}
@@ -1,31 +1,32 @@
1
- ssh git@host.com admin:[command]
1
+ ssh undefined@undefined admin:[command]
2
2
 
3
3
  Examples:
4
- ssh git@host.com admin:help
5
- ssh git@host.com admin:version
6
- ssh git@host.com admin:setup:prepare
7
- ssh git@host.com admin:setup:install
8
- ssh git@host.com admin:user:list
9
- ssh git@host.com admin:user:key:list username
10
- ssh git@host.com admin:user:repo:list username
11
- ssh git@host.com admin:user:add username [email admin]*
12
- ssh git@host.com admin:user:password:set username
13
- ssh git@host.com admin:user:rm username
14
- ssh git@host.com admin:user:email:update username email@server.com
15
- ssh git@host.com admin:user:email:get username
16
- ssh git@host.com admin:user:key:add username keyname < key.pub
17
- ssh git@host.com admin:user:key:rm username keyname
18
- ssh git@host.com admin:user:admin:add username
19
- ssh git@host.com admin:user:admin:rm username
20
- ssh git@host.com admin:user:admin username
21
- ssh git@host.com admin:repo:list
22
- ssh git@host.com admin:repo:add reponame.git [username1 username2 ...]*
23
- ssh git@host.com admin:repo:user:list reponame.git
24
- ssh git@host.com admin:repo:rm reponame.git
25
- ssh git@host.com admin:repo:read:add reponame.git username
26
- ssh git@host.com admin:repo:write:add reponame.git username
27
- ssh git@host.com admin:repo:read:rm reponame.git username
28
- ssh git@host.com admin:repo:write:rm reponame.git username
4
+ ssh undefined@undefined admin:help
5
+ ssh undefined@undefined admin:version
6
+ ssh undefined@undefined admin:setup:prepare
7
+ ssh undefined@undefined admin:setup:install
8
+ ssh undefined@undefined admin:user:list
9
+ ssh undefined@undefined admin:user:key:list username
10
+ ssh undefined@undefined admin:user:repo:list username
11
+ ssh undefined@undefined admin:user:add username [admin]*
12
+ ssh undefined@undefined admin:user:rm username
13
+ ssh undefined@undefined admin:user:key:add username keyname < key.pub
14
+ ssh undefined@undefined admin:user:key:rm username keyname
15
+ ssh undefined@undefined admin:user:admin:add username
16
+ ssh undefined@undefined admin:user:admin:rm username
17
+ ssh undefined@undefined admin:user:admin username
18
+ ssh undefined@undefined admin:repo:list
19
+ ssh undefined@undefined admin:repo:add reponame.git [username1 username2 ...]*
20
+ ssh undefined@undefined admin:repo:user:list reponame.git
21
+ ssh undefined@undefined admin:repo:rm reponame.git
22
+ ssh undefined@undefined admin:repo:read:add reponame.git username
23
+ ssh undefined@undefined admin:repo:write:add reponame.git username
24
+ ssh undefined@undefined admin:repo:read:rm reponame.git username
25
+ ssh undefined@undefined admin:repo:write:rm reponame.git username
26
+ ssh undefined@undefined admin:config:host_url:set url
27
+ ssh undefined@undefined admin:config:host_url:get
28
+ ssh undefined@undefined admin:config:ssh_user:set user
29
+ ssh undefined@undefined admin:config:ssh_user:get
29
30
 
30
31
  --
31
32
  v{{VERSION}}
@@ -1,6 +1,6 @@
1
- +-------------+-----------------+-------+
2
- | user | email | admin |
3
- +-------------+-----------------+-------+
4
- | igorbonadio | - | true |
5
- | jessicaeto | jessica@eto.com | false |
6
- +-------------+-----------------+-------+
1
+ +-------------+-------+
2
+ | user | admin |
3
+ +-------------+-------+
4
+ | igorbonadio | true |
5
+ | jessicaeto | false |
6
+ +-------------+-------+
@@ -1,17 +1,14 @@
1
- ssh git@host.com [command]
1
+ ssh undefined@undefined [command]
2
2
 
3
3
  Examples:
4
- ssh git@host.com version
5
- ssh git@host.com help
6
- ssh git@host.com username
7
- ssh git@host.com repo:list
8
- ssh git@host.com key:list
9
- ssh git@host.com key:add keyname < key.pub
10
- ssh git@host.com key:rm keyname
11
- ssh git@host.com email:get
12
- ssh git@host.com email:update email@server.com
13
- ssh git@host.com password:set
14
- ssh git@host.com admin:help
4
+ ssh undefined@undefined version
5
+ ssh undefined@undefined help
6
+ ssh undefined@undefined username
7
+ ssh undefined@undefined repo:list
8
+ ssh undefined@undefined key:list
9
+ ssh undefined@undefined key:add keyname < key.pub
10
+ ssh undefined@undefined key:rm keyname
11
+ ssh undefined@undefined admin:help
15
12
 
16
13
  --
17
14
  v{{VERSION}}
@@ -1,17 +1,14 @@
1
- ssh git@host.com [command]
1
+ ssh undefined@undefined [command]
2
2
 
3
3
  Examples:
4
- ssh git@host.com version
5
- ssh git@host.com help
6
- ssh git@host.com username
7
- ssh git@host.com repo:list
8
- ssh git@host.com key:list
9
- ssh git@host.com key:add keyname < key.pub
10
- ssh git@host.com key:rm keyname
11
- ssh git@host.com email:get
12
- ssh git@host.com email:update email@server.com
13
- ssh git@host.com password:set
14
- ssh git@host.com admin:help
4
+ ssh undefined@undefined version
5
+ ssh undefined@undefined help
6
+ ssh undefined@undefined username
7
+ ssh undefined@undefined repo:list
8
+ ssh undefined@undefined key:list
9
+ ssh undefined@undefined key:add keyname < key.pub
10
+ ssh undefined@undefined key:rm keyname
11
+ ssh undefined@undefined admin:help
15
12
 
16
13
  --
17
14
  v{{VERSION}}
@@ -1,17 +1,14 @@
1
- ssh git@host.com [command]
1
+ ssh undefined@undefined [command]
2
2
 
3
3
  Examples:
4
- ssh git@host.com version
5
- ssh git@host.com help
6
- ssh git@host.com username
7
- ssh git@host.com repo:list
8
- ssh git@host.com key:list
9
- ssh git@host.com key:add keyname < key.pub
10
- ssh git@host.com key:rm keyname
11
- ssh git@host.com email:get
12
- ssh git@host.com email:update email@server.com
13
- ssh git@host.com password:set
14
- ssh git@host.com admin:help
4
+ ssh undefined@undefined version
5
+ ssh undefined@undefined help
6
+ ssh undefined@undefined username
7
+ ssh undefined@undefined repo:list
8
+ ssh undefined@undefined key:list
9
+ ssh undefined@undefined key:add keyname < key.pub
10
+ ssh undefined@undefined key:rm keyname
11
+ ssh undefined@undefined admin:help
15
12
 
16
13
  --
17
14
  v{{VERSION}}
@@ -1,17 +1,14 @@
1
- ssh git@host.com [command]
1
+ ssh undefined@undefined [command]
2
2
 
3
3
  Examples:
4
- ssh git@host.com version
5
- ssh git@host.com help
6
- ssh git@host.com username
7
- ssh git@host.com repo:list
8
- ssh git@host.com key:list
9
- ssh git@host.com key:add keyname < key.pub
10
- ssh git@host.com key:rm keyname
11
- ssh git@host.com email:get
12
- ssh git@host.com email:update email@server.com
13
- ssh git@host.com password:set
14
- ssh git@host.com admin:help
4
+ ssh undefined@undefined version
5
+ ssh undefined@undefined help
6
+ ssh undefined@undefined username
7
+ ssh undefined@undefined repo:list
8
+ ssh undefined@undefined key:list
9
+ ssh undefined@undefined key:add keyname < key.pub
10
+ ssh undefined@undefined key:rm keyname
11
+ ssh undefined@undefined admin:help
15
12
 
16
13
  --
17
14
  v{{VERSION}}
@@ -8,9 +8,6 @@
8
8
  gritano key:list
9
9
  gritano key:add keyname < key.pub
10
10
  gritano key:rm keyname
11
- gritano email:get
12
- gritano email:update email@server.com
13
- gritano password:set
14
11
  gritano admin:help
15
12
 
16
13
  --
@@ -43,11 +43,6 @@ Feature: Local access
43
43
  | user:key:add igorbonadio marvin |
44
44
  | user:key:rm igorbonadio eva |
45
45
  | user:rm igorbonadio |
46
- | user:email:update igorbonadio igor@bonadio.com |
47
- | user:email:update wrong igor@bonadio.com |
48
- | user:email:get igorbonadio |
49
- | user:email:get jessicaeto |
50
- | user:email:get wrong |
51
46
  | user:list |
52
47
  | user:key:list igorbonadio |
53
48
  | user:repo:list igorbonadio |
@@ -53,25 +53,15 @@ Feature: Remote access
53
53
  Then I should see a message via ssh
54
54
  Examples:
55
55
  | command |
56
- | invalid:command |
57
56
  | version |
58
- | help |
59
57
  | repo:list |
60
58
  | key:list |
61
59
  | key:add keyname |
62
60
  | key:rm hal |
63
- | email:get |
64
- | email:update email@server.com |
65
- | admin:help |
66
61
  | admin:version |
67
62
  | admin:user:add jose |
68
63
  | admin:user:key:add igorbonadio marvin |
69
64
  | admin:user:key:rm igorbonadio eva |
70
- | admin:user:email:update igorbonadio igor@bonadio.com |
71
- | admin:user:email:update wrong igor@bonadio.com |
72
- | admin:user:email:get igorbonadio |
73
- | admin:user:email:get wrong |
74
- | admin:user:email:get jessicaeto |
75
65
  | admin:user:rm igorbonadio |
76
66
  | admin:user:list |
77
67
  | admin:user:key:list igorbonadio |
@@ -114,23 +104,13 @@ Feature: Remote access
114
104
  Then I should see a message via ssh
115
105
  Examples:
116
106
  | command |
117
- | invalid:command |
118
107
  | version |
119
- | help |
120
108
  | repo:list |
121
109
  | key:list |
122
110
  | key:add keyname |
123
111
  | key:rm hal |
124
- | email:get |
125
- | email:update email@server.com |
126
- | admin:help |
127
112
  | admin:version |
128
113
  | admin:user:add jose |
129
- | admin:user:email:update igorbonadio igor@bonadio.com |
130
- | admin:user:email:update wrong igor@bonadio.com |
131
- | admin:user:email:get igorbonadio |
132
- | admin:user:email:get wrong |
133
- | admin:user:email:get jessicaeto |
134
114
  | admin:user:key:add igorbonadio marvin |
135
115
  | admin:user:key:rm igorbonadio eva |
136
116
  | admin:user:rm igorbonadio |
@@ -3,7 +3,6 @@ Given /^the following users exist:$/ do |table|
3
3
  Gritano::User.create(user)
4
4
  end
5
5
  jessica = Gritano::User.find_by_login("jessicaeto")
6
- jessica.email = "jessica@eto.com"
7
6
  jessica.save
8
7
  end
9
8
 
@@ -24,5 +24,7 @@ require 'active_record'
24
24
 
25
25
  Before do
26
26
  ActiveRecord::Base.establish_connection(YAML::load(File.open('.gritano/database.yml')))
27
- Gritano::Console.remote_console(false)
27
+ FileUtils.rm_rf(File.join("tmp", ".gritano"))
28
+ FileUtils.mkdir(File.join('tmp', '.gritano'))
29
+ Gritano::Console.remote_console(false, 'tmp')
28
30
  end
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.11.0"
8
+ s.version = "0.11.1"
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 = "2013-05-13"
12
+ s.date = "2013-05-15"
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-pub-key", "gritano-remote"]
@@ -41,6 +41,8 @@ Gem::Specification.new do |s|
41
41
  "db/migrate/005_add_admin_to_users.rb",
42
42
  "db/migrate/006_add_email_to_users.rb",
43
43
  "db/migrate/007_add_password_to_users.rb",
44
+ "db/migrate/008_remove_password_from_user.rb",
45
+ "db/migrate/009_remove_email_from_users.rb",
44
46
  "features/data/config_true.yml",
45
47
  "features/data/local_commands/repo_add_tmp_jeka_git.txt",
46
48
  "features/data/local_commands/repo_add_tmp_p_lang_git.txt",
@@ -69,11 +71,6 @@ Gem::Specification.new do |s|
69
71
  "features/data/local_commands/user_admin_add_igorbonadio.txt",
70
72
  "features/data/local_commands/user_admin_rm_arybonadio.txt",
71
73
  "features/data/local_commands/user_admin_rm_igorbonadio.txt",
72
- "features/data/local_commands/user_email_get_igorbonadio.txt",
73
- "features/data/local_commands/user_email_get_jessicaeto.txt",
74
- "features/data/local_commands/user_email_get_wrong.txt",
75
- "features/data/local_commands/user_email_update_igorbonadio_igor@bonadio_com.txt",
76
- "features/data/local_commands/user_email_update_wrong_igor@bonadio_com.txt",
77
74
  "features/data/local_commands/user_key_add_igorbonadio_marvin.txt",
78
75
  "features/data/local_commands/user_key_add_userrr_marvino.txt",
79
76
  "features/data/local_commands/user_key_list_arybonadio.txt",
@@ -143,16 +140,6 @@ Gem::Specification.new do |s|
143
140
  "features/data/remote_commands/admin_user_admin_rm_arybonadio_jessicaeto.txt",
144
141
  "features/data/remote_commands/admin_user_admin_rm_igorbonadio_igorbonadio.txt",
145
142
  "features/data/remote_commands/admin_user_admin_rm_igorbonadio_jessicaeto.txt",
146
- "features/data/remote_commands/admin_user_email_get_igorbonadio_igorbonadio.txt",
147
- "features/data/remote_commands/admin_user_email_get_igorbonadio_jessicaeto.txt",
148
- "features/data/remote_commands/admin_user_email_get_jessicaeto_igorbonadio.txt",
149
- "features/data/remote_commands/admin_user_email_get_jessicaeto_jessicaeto.txt",
150
- "features/data/remote_commands/admin_user_email_get_wrong_igorbonadio.txt",
151
- "features/data/remote_commands/admin_user_email_get_wrong_jessicaeto.txt",
152
- "features/data/remote_commands/admin_user_email_update_igorbonadio_igor@bonadio_com_igorbonadio.txt",
153
- "features/data/remote_commands/admin_user_email_update_igorbonadio_igor@bonadio_com_jessicaeto.txt",
154
- "features/data/remote_commands/admin_user_email_update_wrong_igor@bonadio_com_igorbonadio.txt",
155
- "features/data/remote_commands/admin_user_email_update_wrong_igor@bonadio_com_jessicaeto.txt",
156
143
  "features/data/remote_commands/admin_user_key_add_igorbonadio_marvin_igorbonadio.txt",
157
144
  "features/data/remote_commands/admin_user_key_add_igorbonadio_marvin_jessicaeto.txt",
158
145
  "features/data/remote_commands/admin_user_key_add_userrr_marvino_igorbonadio.txt",
data/lib/gritano/cli.rb CHANGED
@@ -15,12 +15,12 @@ module Gritano
15
15
  end
16
16
 
17
17
  def CLI.execute(cmd, stdin = STDIN, home_dir = Etc.getpwuid.dir, repo_dir = Etc.getpwuid.dir)
18
- Gritano::Console.remote_console(false)
18
+ Gritano::Console.remote_console(false, home_dir)
19
19
  _execute(cmd, Gritano::Console::Gritano.new(stdin, home_dir, repo_dir))
20
20
  end
21
21
 
22
22
  def CLI.check(cmd, login, stdin = STDIN, home_dir = Etc.getpwuid.dir, repo_dir = Etc.getpwuid.dir)
23
- Gritano::Console.remote_console(true)
23
+ Gritano::Console.remote_console(true, home_dir)
24
24
  _execute(cmd + [login], Gritano::Console::Remote.new(stdin, home_dir, repo_dir))
25
25
  end
26
26
 
@@ -29,7 +29,11 @@ module Gritano
29
29
  if name[-1] == '='
30
30
  @config[name.to_s[0..-2]] = args[0]
31
31
  else
32
- @config[name.to_s]
32
+ if @config[name.to_s]
33
+ @config[name.to_s]
34
+ else
35
+ "undefined"
36
+ end
33
37
  end
34
38
  end
35
39
  end
@@ -6,13 +6,14 @@ require File.join(ROOT_PATH, 'gritano/console/remote')
6
6
 
7
7
  module Gritano
8
8
  module Console
9
- def Console.remote_console(remote)
9
+ def Console.remote_console(remote, home_dir = Etc.getpwuid.dir)
10
10
  if remote
11
- Base.bin_name = "ssh #{"git@host.com"} admin:"
12
- Remote.bin_name = "ssh #{"git@host.com"} "
13
- Executor.bin_name = "ssh #{"git@host.com"} admin:"
14
- Gritano.bin_name = "ssh #{"git@host.com"} admin:"
15
- Installer.bin_name = "ssh #{"git@host.com"} admin:"
11
+ config = Config.new(File.join(home_dir, '.gritano', 'config.yml'))
12
+ Base.bin_name = "ssh #{config.ssh_user}@#{config.host_url} admin:"
13
+ Remote.bin_name = "ssh #{config.ssh_user}@#{config.host_url} "
14
+ Executor.bin_name = "ssh #{config.ssh_user}@#{config.host_url} admin:"
15
+ Gritano.bin_name = "ssh #{config.ssh_user}@#{config.host_url} admin:"
16
+ Installer.bin_name = "ssh #{config.ssh_user}@#{config.host_url} admin:"
16
17
  else
17
18
  Base.bin_name = "gritano "
18
19
  Remote.bin_name = "gritano "
@@ -23,12 +23,10 @@ module Gritano
23
23
  add_command "user:list" do |argv|
24
24
  users = User.all
25
25
  msg = Terminal::Table.new do |t|
26
- t << ['user', 'email', 'admin']
26
+ t << ['user', 'admin']
27
27
  t << :separator
28
28
  users.each do |user|
29
- email = "-"
30
- email = user.email if user.email
31
- t.add_row [user.login, email, user.admin]
29
+ t.add_row [user.login, user.admin]
32
30
  end
33
31
  end
34
32
  msg = "there is no user registered" if users.count == 0
@@ -73,47 +71,18 @@ module Gritano
73
71
  end
74
72
  end
75
73
 
76
- add_command "user:add", "username [email admin]*" do |argv|
77
- login, email, admin = argv
74
+ add_command "user:add", "username [admin]*" do |argv|
75
+ login, admin = argv
78
76
  if admin == 'true'
79
77
  admin = true
80
78
  else
81
79
  admin = false
82
80
  end
83
- user = User.new(login: login, email: email, admin: admin)
81
+ user = User.new(login: login, admin: admin)
84
82
  return [true, "User #{login} added."] if user.save
85
83
  return [false, "#{user.errors.full_messages.join(", ")}."]
86
84
  end
87
85
 
88
- add_command "user:password:set", "username" do |argv|
89
- login, = argv
90
- user = User.find_by_login(login)
91
- if user.crypted_password == nil
92
- puts "You have not set your password yet."
93
- print "Please, set one now: "
94
- user.password = @stdin.noecho(&:gets).gsub("\n", "")
95
- puts
96
- if user.save
97
- return [true, "Done!"]
98
- end
99
- else
100
- print "Before you start, enter you current password: "
101
- if user.password == @stdin.noecho(&:gets).gsub("\n", "")
102
- puts
103
- print "Now, enter you new password: "
104
- user.password = @stdin.noecho(&:gets).gsub("\n", "")
105
- puts
106
- if user.save
107
- return [true, "Done!"]
108
- end
109
- else
110
- puts
111
- return [false, "Password you entered do not match."]
112
- end
113
- end
114
- return [false, "Password could not be changed."]
115
- end
116
-
117
86
  add_command "user:rm", "username" do |argv|
118
87
  login, = argv
119
88
  user = User.find_by_login(login)
@@ -124,28 +93,6 @@ module Gritano
124
93
  end
125
94
  return [false, "User #{login} could not be removed."]
126
95
  end
127
-
128
- add_command "user:email:update", "username email@server.com" do |argv|
129
- login, email = argv
130
- user = User.find_by_login(login)
131
- if user
132
- user.email = email
133
- if user.save
134
- return [true, "Email added."]
135
- end
136
- end
137
- return [false, "Email could not be added."]
138
- end
139
-
140
- add_command "user:email:get", "username" do |argv|
141
- login = argv
142
- user = User.find_by_login(login)
143
- if user
144
- return [true, user.email] if user.email
145
- return [false, "User does not have email."]
146
- end
147
- return [false, "User does not exist."]
148
- end
149
96
 
150
97
  add_command "user:key:add", "username keyname < key.pub" do |argv|
151
98
  login, key_name, key_file = argv
@@ -319,6 +266,32 @@ module Gritano
319
266
  end
320
267
  return [false, "An error occurred. Permissions was not modified."]
321
268
  end
269
+
270
+ add_command "config:host_url:set", "url" do |argv|
271
+ url, = argv
272
+ config = Config.new(File.join(@home_dir, '.gritano', 'config.yml'))
273
+ config.host_url = url
274
+ config.save
275
+ return [true, "done!"]
276
+ end
277
+
278
+ add_command "config:host_url:get" do |argv|
279
+ config = Config.new(File.join(@home_dir, '.gritano', 'config.yml'))
280
+ return [true, config.host_url]
281
+ end
282
+
283
+ add_command "config:ssh_user:set", "user" do |argv|
284
+ user, = argv
285
+ config = Config.new(File.join(@home_dir, '.gritano', 'config.yml'))
286
+ config.ssh_user = user
287
+ config.save
288
+ return [true, "done!"]
289
+ end
290
+
291
+ add_command "config:ssh_user:get" do |argv|
292
+ config = Config.new(File.join(@home_dir, '.gritano', 'config.yml'))
293
+ return [true, config.ssh_user]
294
+ end
322
295
 
323
296
  end
324
297
  end
@@ -51,21 +51,6 @@ module Gritano
51
51
  keyname, login = args
52
52
  @executor.execute(["user:key:rm"] + [login, keyname])
53
53
  end
54
-
55
- add_command "email:get" do |args|
56
- login, = args
57
- @executor.execute(["user:email:get"] + [login])
58
- end
59
-
60
- add_command "email:update", "email@server.com" do |args|
61
- email, login = args
62
- @executor.execute(["user:email:update"] + [login, email])
63
- end
64
-
65
- add_command "password:set" do |args|
66
- login, = args
67
- @executor.execute(["user:password:set"] + [login])
68
- end
69
54
 
70
55
  add_command "admin:help" do |args|
71
56
  gritano = Gritano.new(@stdin)
@@ -10,15 +10,6 @@ module Gritano
10
10
  has_many :permissions
11
11
  has_many :repositories, through: :permissions
12
12
  has_many :keys
13
-
14
- def password
15
- @password ||= Password.new(crypted_password)
16
- end
17
-
18
- def password=(new_password)
19
- @password = Password.create(new_password)
20
- self.crypted_password = @password
21
- end
22
13
 
23
14
  def add_access(repo, access)
24
15
  change_access(repo, "add", access)
data/spec/cli_spec.rb CHANGED
@@ -5,7 +5,7 @@ module Gritano
5
5
  it "should execute local commands" do
6
6
  console = double()
7
7
  console.should_receive(:execute).and_return([true, "ok"])
8
- Gritano::Console.should_receive(:remote_console).with(false)
8
+ Gritano::Console.should_receive(:remote_console).with(false, Etc.getpwuid.dir)
9
9
  Gritano::Console::Gritano.should_receive(:new).and_return(console)
10
10
  CLI.execute(["user:list"])
11
11
  end
@@ -13,7 +13,7 @@ module Gritano
13
13
  it "should execute remote commands" do
14
14
  console = double()
15
15
  console.should_receive(:execute).and_return([true, "ok"])
16
- Gritano::Console.should_receive(:remote_console).with(true)
16
+ Gritano::Console.should_receive(:remote_console).with(true, Etc.getpwuid.dir)
17
17
  Gritano::Console::Remote.should_receive(:new).and_return(console)
18
18
  CLI.check(["repo:list"], "login")
19
19
  end
data/spec/config_spec.rb CHANGED
@@ -4,7 +4,7 @@ module Gritano
4
4
  describe Config do
5
5
  it "should get parameters" do
6
6
  config = Config.new(File.join(".gritano", "config.yml"))
7
- config.ssh.should be == false
7
+ config.host_url.should be == "gritano.org"
8
8
  end
9
9
 
10
10
  it "should add parameters" do
@@ -13,9 +13,9 @@ module Gritano
13
13
  FileUtils.rm(File.join("tmp", "config_test.yml"))
14
14
  end
15
15
  config = Config.new(File.join("tmp", "config_test.yml"))
16
- config.ssh.should be == nil
17
- config.ssh = true
18
- config.ssh.should be == true
16
+ config.host_url.should be == "undefined"
17
+ config.host_url = "gritano.org"
18
+ config.host_url.should be == "gritano.org"
19
19
  end
20
20
 
21
21
  it "should remove parameters" do
@@ -25,11 +25,11 @@ module Gritano
25
25
  end
26
26
  config = Config.new(File.join("tmp", "config_test.yml"))
27
27
 
28
- config.ssh = true
29
- config.ssh.should be == true
28
+ config.host_url = "gritano.org"
29
+ config.host_url.should be == "gritano.org"
30
30
 
31
- config.remove(:ssh)
32
- config.ssh.should be == nil
31
+ config.remove(:host_url)
32
+ config.host_url.should be == "undefined"
33
33
  end
34
34
 
35
35
  it "should modify parameters" do
@@ -38,11 +38,11 @@ module Gritano
38
38
  FileUtils.rm(File.join("tmp", "config_test.yml"))
39
39
  end
40
40
  config = Config.new(File.join("tmp", "config_test.yml"))
41
- config.ssh.should be == nil
42
- config.ssh = true
43
- config.ssh.should be == true
44
- config.ssh = false
45
- config.ssh.should be == false
41
+ config.host_url.should be == "undefined"
42
+ config.host_url = "gritano.org"
43
+ config.host_url.should be == "gritano.org"
44
+ config.host_url = "host.org"
45
+ config.host_url.should be == "host.org"
46
46
  end
47
47
 
48
48
  it "should save a config file" do
@@ -51,12 +51,12 @@ module Gritano
51
51
  FileUtils.rm(File.join("tmp", "config_test.yml"))
52
52
  end
53
53
  config = Config.new(File.join("tmp", "config_test.yml"))
54
- config.ssh = true
54
+ config.host_url = "gritano.org"
55
55
  config.email = {login: 'igor', smtp: 'smtp.igor.com'}
56
56
  config.save
57
57
 
58
58
  config2 = Config.new(File.join("tmp", "config_test.yml"))
59
- config2.ssh.should be == true
59
+ config2.host_url.should be == "gritano.org"
60
60
  config2.email[:login].should be == "igor"
61
61
  config2.email[:smtp].should be == "smtp.igor.com"
62
62
  end
@@ -31,7 +31,7 @@ module Gritano
31
31
  it "should add users" do
32
32
  user = double()
33
33
  user.should_receive(:save).and_return(true)
34
- User.should_receive(:new).with(login: "login", email: nil, admin: false).and_return(user)
34
+ User.should_receive(:new).with(login: "login", admin: false).and_return(user)
35
35
  create_executor('.', 'tmp').execute(["user:add", "login"])
36
36
  end
37
37
 
data/spec/console_spec.rb CHANGED
@@ -8,16 +8,20 @@ module Gritano
8
8
  Console::Executor.should_receive(:bin_name=).with("gritano ")
9
9
  Console::Gritano.should_receive(:bin_name=).with("gritano ")
10
10
  Console::Installer.should_receive(:bin_name=).with("gritano ")
11
- Console.remote_console(false)
11
+ FileUtils.rm_rf(File.join("tmp", ".gritano"))
12
+ FileUtils.mkdir(File.join('tmp', '.gritano'))
13
+ Console.remote_console(false, 'tmp')
12
14
  end
13
15
 
14
16
  it "should setup a remote console" do
15
- Console::Base.should_receive(:bin_name=).with("ssh git@host.com admin:")
16
- Console::Remote.should_receive(:bin_name=).with("ssh git@host.com ")
17
- Console::Executor.should_receive(:bin_name=).with("ssh git@host.com admin:")
18
- Console::Gritano.should_receive(:bin_name=).with("ssh git@host.com admin:")
19
- Console::Installer.should_receive(:bin_name=).with("ssh git@host.com admin:")
20
- Console.remote_console(true)
17
+ Console::Base.should_receive(:bin_name=).with("ssh undefined@undefined admin:")
18
+ Console::Remote.should_receive(:bin_name=).with("ssh undefined@undefined ")
19
+ Console::Executor.should_receive(:bin_name=).with("ssh undefined@undefined admin:")
20
+ Console::Gritano.should_receive(:bin_name=).with("ssh undefined@undefined admin:")
21
+ Console::Installer.should_receive(:bin_name=).with("ssh undefined@undefined admin:")
22
+ FileUtils.rm_rf(File.join("tmp", ".gritano"))
23
+ FileUtils.mkdir(File.join('tmp', '.gritano'))
24
+ Console.remote_console(true, 'tmp')
21
25
  end
22
26
  end
23
27
  end
@@ -92,15 +92,5 @@ module Gritano
92
92
  user.add_access(repo, :write).should be_true
93
93
  user.check_access(repo, :write).should be_true
94
94
  end
95
-
96
- it "can have a password" do
97
- user = User.create(login: 'user', password: '123')
98
- user.should be_valid
99
- end
100
-
101
- it "can if a password is valid" do
102
- user = User.create(login: 'user', password: '123')
103
- user.password.should be == '123'
104
- end
105
95
  end
106
96
  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.11.0
4
+ version: 0.11.1
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: 2013-05-13 00:00:00.000000000 Z
12
+ date: 2013-05-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -238,6 +238,8 @@ files:
238
238
  - db/migrate/005_add_admin_to_users.rb
239
239
  - db/migrate/006_add_email_to_users.rb
240
240
  - db/migrate/007_add_password_to_users.rb
241
+ - db/migrate/008_remove_password_from_user.rb
242
+ - db/migrate/009_remove_email_from_users.rb
241
243
  - features/data/config_true.yml
242
244
  - features/data/local_commands/repo_add_tmp_jeka_git.txt
243
245
  - features/data/local_commands/repo_add_tmp_p_lang_git.txt
@@ -266,11 +268,6 @@ files:
266
268
  - features/data/local_commands/user_admin_add_igorbonadio.txt
267
269
  - features/data/local_commands/user_admin_rm_arybonadio.txt
268
270
  - features/data/local_commands/user_admin_rm_igorbonadio.txt
269
- - features/data/local_commands/user_email_get_igorbonadio.txt
270
- - features/data/local_commands/user_email_get_jessicaeto.txt
271
- - features/data/local_commands/user_email_get_wrong.txt
272
- - features/data/local_commands/user_email_update_igorbonadio_igor@bonadio_com.txt
273
- - features/data/local_commands/user_email_update_wrong_igor@bonadio_com.txt
274
271
  - features/data/local_commands/user_key_add_igorbonadio_marvin.txt
275
272
  - features/data/local_commands/user_key_add_userrr_marvino.txt
276
273
  - features/data/local_commands/user_key_list_arybonadio.txt
@@ -340,16 +337,6 @@ files:
340
337
  - features/data/remote_commands/admin_user_admin_rm_arybonadio_jessicaeto.txt
341
338
  - features/data/remote_commands/admin_user_admin_rm_igorbonadio_igorbonadio.txt
342
339
  - features/data/remote_commands/admin_user_admin_rm_igorbonadio_jessicaeto.txt
343
- - features/data/remote_commands/admin_user_email_get_igorbonadio_igorbonadio.txt
344
- - features/data/remote_commands/admin_user_email_get_igorbonadio_jessicaeto.txt
345
- - features/data/remote_commands/admin_user_email_get_jessicaeto_igorbonadio.txt
346
- - features/data/remote_commands/admin_user_email_get_jessicaeto_jessicaeto.txt
347
- - features/data/remote_commands/admin_user_email_get_wrong_igorbonadio.txt
348
- - features/data/remote_commands/admin_user_email_get_wrong_jessicaeto.txt
349
- - features/data/remote_commands/admin_user_email_update_igorbonadio_igor@bonadio_com_igorbonadio.txt
350
- - features/data/remote_commands/admin_user_email_update_igorbonadio_igor@bonadio_com_jessicaeto.txt
351
- - features/data/remote_commands/admin_user_email_update_wrong_igor@bonadio_com_igorbonadio.txt
352
- - features/data/remote_commands/admin_user_email_update_wrong_igor@bonadio_com_jessicaeto.txt
353
340
  - features/data/remote_commands/admin_user_key_add_igorbonadio_marvin_igorbonadio.txt
354
341
  - features/data/remote_commands/admin_user_key_add_igorbonadio_marvin_jessicaeto.txt
355
342
  - features/data/remote_commands/admin_user_key_add_userrr_marvino_igorbonadio.txt
@@ -449,7 +436,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
449
436
  version: '0'
450
437
  segments:
451
438
  - 0
452
- hash: -1882815293766482329
439
+ hash: 2131381228569288873
453
440
  required_rubygems_version: !ruby/object:Gem::Requirement
454
441
  none: false
455
442
  requirements:
@@ -1 +0,0 @@
1
- error: User does not have email.
@@ -1 +0,0 @@
1
- jessica@eto.com
@@ -1 +0,0 @@
1
- error: User does not exist.
@@ -1 +0,0 @@
1
- error: Email could not be added.
@@ -1 +0,0 @@
1
- error: User does not have email.
@@ -1 +0,0 @@
1
- error: User does not exist.
@@ -1 +0,0 @@
1
- error: access denied