gritano 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +9 -17
- data/Gemfile.lock +78 -50
- data/Guardfile +9 -0
- data/README.rdoc +23 -24
- data/Rakefile +8 -12
- data/TODO +12 -8
- data/VERSION +1 -1
- data/bin/gritano +8 -1
- data/bin/gritano-remote +16 -2
- data/gritano.gemspec +52 -230
- data/lib/gritano.rb +12 -6
- data/lib/gritano/config.rb +11 -31
- data/lib/gritano/console/base.rb +6 -74
- data/lib/gritano/console/git.rb +29 -0
- data/lib/gritano/console/local.rb +131 -0
- data/lib/gritano/console/remote.rb +47 -93
- data/lib/gritano/core/key.rb +18 -0
- data/lib/gritano/core/user.rb +12 -0
- data/lib/gritano/helpers.rb +52 -0
- data/lib/gritano/renderer.rb +36 -0
- data/lib/gritano/thor.rb +27 -0
- data/spec/data/development.yml +2 -0
- data/spec/gritano/console/git_spec.rb +55 -0
- data/spec/gritano/console/local_spec.rb +148 -0
- data/spec/gritano/console/remote_spec.rb +56 -0
- data/spec/gritano/core/key_spec.rb +21 -0
- data/spec/gritano/core/user_spec.rb +43 -0
- data/spec/gritano/helpers_spec.rb +113 -0
- data/spec/gritano/thor_spec.rb +29 -0
- data/spec/spec_helper.rb +1 -16
- data/templates/local.gritano +4 -0
- data/templates/remote.gritano +5 -0
- metadata +61 -280
- data/.gritano/config.yml +0 -2
- data/.gritano/database.yml +0 -2
- data/.ssh/.gitignore +0 -4
- data/bin/gritano-pub-key +0 -15
- data/db/migrate/001_create_users.rb +0 -8
- data/db/migrate/002_create_repositories.rb +0 -9
- data/db/migrate/003_create_permissions.rb +0 -10
- data/db/migrate/004_create_keys.rb +0 -11
- data/db/migrate/005_add_admin_to_users.rb +0 -10
- data/db/migrate/006_add_email_to_users.rb +0 -10
- data/db/migrate/007_add_password_to_users.rb +0 -10
- data/db/migrate/008_remove_password_from_user.rb +0 -10
- data/db/migrate/009_remove_email_from_users.rb +0 -10
- data/features/data/config_true.yml +0 -2
- data/features/data/local_commands/repo_add_tmp_jeka_git.txt +0 -1
- data/features/data/local_commands/repo_add_tmp_p_lang_git.txt +0 -1
- data/features/data/local_commands/repo_add_tmp_p_lang_git_igorbonadio.txt +0 -1
- data/features/data/local_commands/repo_add_tmp_p_lang_git_igorbonadio_jessicaeto.txt +0 -1
- data/features/data/local_commands/repo_list.txt +0 -6
- data/features/data/local_commands/repo_read_add_tmp_gritano_git_arybonadio.txt +0 -1
- data/features/data/local_commands/repo_read_add_tmp_gritano_git_jessicaeto.txt +0 -1
- data/features/data/local_commands/repo_read_add_tmp_p_lang_git_jessicaeto.txt +0 -1
- data/features/data/local_commands/repo_read_rm_tmp_jeka_git_aribonadio.txt +0 -1
- data/features/data/local_commands/repo_read_rm_tmp_jeka_git_igorbonadio.txt +0 -1
- data/features/data/local_commands/repo_read_rm_tmp_p_lang_git_igorbonadio.txt +0 -1
- data/features/data/local_commands/repo_rm_tmp_jeka_git.txt +0 -1
- data/features/data/local_commands/repo_rm_tmp_p_lang_git.txt +0 -1
- data/features/data/local_commands/repo_user_list_tmp_jeka_git.txt +0 -6
- data/features/data/local_commands/repo_user_list_tmp_ruby_git.txt +0 -1
- data/features/data/local_commands/repo_write_add_tmp_gritano_git_arybonadio.txt +0 -1
- data/features/data/local_commands/repo_write_add_tmp_gritano_git_jessicaeto.txt +0 -1
- data/features/data/local_commands/repo_write_add_tmp_p_lang_git_jessicaeto.txt +0 -1
- data/features/data/local_commands/repo_write_rm_tmp_gritano_git_arybonadio.txt +0 -1
- data/features/data/local_commands/repo_write_rm_tmp_gritano_git_igorbonadio.txt +0 -1
- data/features/data/local_commands/repo_write_rm_tmp_p_lang_git_igorbonadio.txt +0 -1
- data/features/data/local_commands/user_add_igorbonadio.txt +0 -1
- data/features/data/local_commands/user_add_jose.txt +0 -1
- data/features/data/local_commands/user_admin_add_arybonadio.txt +0 -1
- data/features/data/local_commands/user_admin_add_igorbonadio.txt +0 -1
- data/features/data/local_commands/user_admin_rm_arybonadio.txt +0 -1
- data/features/data/local_commands/user_admin_rm_igorbonadio.txt +0 -1
- data/features/data/local_commands/user_key_add_igorbonadio_marvin.txt +0 -1
- data/features/data/local_commands/user_key_add_userrr_marvino.txt +0 -1
- data/features/data/local_commands/user_key_list_arybonadio.txt +0 -1
- data/features/data/local_commands/user_key_list_igorbonadio.txt +0 -5
- data/features/data/local_commands/user_key_rm_igorbonadio_eva.txt +0 -1
- data/features/data/local_commands/user_key_rm_igorbonadio_marvino.txt +0 -1
- data/features/data/local_commands/user_list.txt +0 -6
- data/features/data/local_commands/user_repo_list_arybonadio.txt +0 -1
- data/features/data/local_commands/user_repo_list_igorbonadio.txt +0 -6
- data/features/data/local_commands/user_rm_igorbonadio.txt +0 -1
- data/features/data/local_commands/user_rm_jose.txt +0 -1
- data/features/data/local_commands/version.txt +0 -1
- data/features/data/local_help.txt +0 -32
- data/features/data/remote_commands/admin_help_igorbonadio.txt +0 -32
- data/features/data/remote_commands/admin_help_jessicaeto.txt +0 -32
- data/features/data/remote_commands/admin_repo_add_tmp_jeka_git_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_repo_add_tmp_jeka_git_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_repo_add_tmp_p_lang_git_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_repo_add_tmp_p_lang_git_igorbonadio_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_repo_add_tmp_p_lang_git_igorbonadio_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_repo_add_tmp_p_lang_git_igorbonadio_jessicaeto_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_repo_add_tmp_p_lang_git_igorbonadio_jessicaeto_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_repo_add_tmp_p_lang_git_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_repo_list_igorbonadio.txt +0 -6
- data/features/data/remote_commands/admin_repo_list_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_repo_read_add_tmp_gritano_git_arybonadio_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_repo_read_add_tmp_gritano_git_arybonadio_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_repo_read_add_tmp_gritano_git_jessicaeto_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_repo_read_add_tmp_gritano_git_jessicaeto_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_repo_read_add_tmp_p_lang_git_jessicaeto_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_repo_read_add_tmp_p_lang_git_jessicaeto_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_repo_read_rm_tmp_jeka_git_aribonadio_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_repo_read_rm_tmp_jeka_git_aribonadio_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_repo_read_rm_tmp_jeka_git_igorbonadio_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_repo_read_rm_tmp_jeka_git_igorbonadio_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_repo_read_rm_tmp_p_lang_git_igorbonadio_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_repo_read_rm_tmp_p_lang_git_igorbonadio_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_repo_rm_tmp_jeka_git_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_repo_rm_tmp_jeka_git_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_repo_rm_tmp_p_lang_git_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_repo_rm_tmp_p_lang_git_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_repo_user_list_tmp_jeka_git_igorbonadio.txt +0 -6
- data/features/data/remote_commands/admin_repo_user_list_tmp_jeka_git_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_repo_user_list_tmp_ruby_git_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_repo_user_list_tmp_ruby_git_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_repo_write_add_tmp_gritano_git_arybonadio_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_repo_write_add_tmp_gritano_git_arybonadio_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_repo_write_add_tmp_gritano_git_jessicaeto_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_repo_write_add_tmp_gritano_git_jessicaeto_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_repo_write_add_tmp_p_lang_git_jessicaeto_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_repo_write_add_tmp_p_lang_git_jessicaeto_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_repo_write_rm_tmp_gritano_git_arybonadio_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_repo_write_rm_tmp_gritano_git_arybonadio_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_repo_write_rm_tmp_gritano_git_igorbonadio_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_repo_write_rm_tmp_gritano_git_igorbonadio_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_repo_write_rm_tmp_p_lang_git_igorbonadio_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_repo_write_rm_tmp_p_lang_git_igorbonadio_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_user_add_igorbonadio_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_user_add_igorbonadio_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_user_add_jose_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_user_add_jose_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_user_admin_add_arybonadio_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_user_admin_add_arybonadio_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_user_admin_add_igorbonadio_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_user_admin_add_igorbonadio_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_user_admin_rm_arybonadio_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_user_admin_rm_arybonadio_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_user_admin_rm_igorbonadio_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_user_admin_rm_igorbonadio_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_user_key_add_igorbonadio_marvin_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_user_key_add_igorbonadio_marvin_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_user_key_add_userrr_marvino_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_user_key_add_userrr_marvino_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_user_key_list_arybonadio_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_user_key_list_arybonadio_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_user_key_list_igorbonadio_igorbonadio.txt +0 -5
- data/features/data/remote_commands/admin_user_key_list_igorbonadio_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_user_key_rm_igorbonadio_eva_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_user_key_rm_igorbonadio_eva_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_user_key_rm_igorbonadio_marvino_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_user_key_rm_igorbonadio_marvino_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_user_list_igorbonadio.txt +0 -6
- data/features/data/remote_commands/admin_user_list_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_user_repo_list_arybonadio_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_user_repo_list_arybonadio_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_user_repo_list_igorbonadio_igorbonadio.txt +0 -6
- data/features/data/remote_commands/admin_user_repo_list_igorbonadio_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_user_rm_igorbonadio_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_user_rm_igorbonadio_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_user_rm_jose_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_user_rm_jose_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_version_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_version_jessicaeto.txt +0 -1
- data/features/data/remote_commands/email_get_igorbonadio.txt +0 -1
- data/features/data/remote_commands/email_get_jessicaeto.txt +0 -1
- data/features/data/remote_commands/email_update_email@server_com_igorbonadio.txt +0 -1
- data/features/data/remote_commands/email_update_email@server_com_jessicaeto.txt +0 -1
- data/features/data/remote_commands/help_igorbonadio.txt +0 -14
- data/features/data/remote_commands/help_jessicaeto.txt +0 -14
- data/features/data/remote_commands/invalid_command_igorbonadio.txt +0 -14
- data/features/data/remote_commands/invalid_command_jessicaeto.txt +0 -14
- data/features/data/remote_commands/key_add_keyname_igorbonadio.txt +0 -1
- data/features/data/remote_commands/key_add_keyname_jessicaeto.txt +0 -1
- data/features/data/remote_commands/key_list_igorbonadio.txt +0 -5
- data/features/data/remote_commands/key_list_jessicaeto.txt +0 -5
- data/features/data/remote_commands/key_rm_hal_igorbonadio.txt +0 -1
- data/features/data/remote_commands/key_rm_hal_jessicaeto.txt +0 -1
- data/features/data/remote_commands/repo_list_igorbonadio.txt +0 -6
- data/features/data/remote_commands/repo_list_jessicaeto.txt +0 -5
- data/features/data/remote_commands/version_igorbonadio.txt +0 -1
- data/features/data/remote_commands/version_jessicaeto.txt +0 -1
- data/features/data/remote_help.txt +0 -14
- data/features/install.feature +0 -40
- data/features/local.feature +0 -80
- data/features/pub_key.feature +0 -25
- data/features/remote.feature +0 -150
- data/features/step_definitions/background_step.rb +0 -26
- data/features/step_definitions/install_step.rb +0 -30
- data/features/step_definitions/local_step.rb +0 -25
- data/features/step_definitions/pub_key_step.rb +0 -15
- data/features/step_definitions/remote_step.rb +0 -49
- data/features/support/database_cleaner.rb +0 -15
- data/features/support/env.rb +0 -30
- data/lib/gritano/cli.rb +0 -49
- data/lib/gritano/console.rb +0 -26
- data/lib/gritano/console/executor.rb +0 -298
- data/lib/gritano/console/gritano.rb +0 -35
- data/lib/gritano/console/installer.rb +0 -55
- data/lib/gritano/models.rb +0 -7
- data/lib/gritano/models/key.rb +0 -37
- data/lib/gritano/models/permission.rb +0 -39
- data/lib/gritano/models/repository.rb +0 -29
- data/lib/gritano/models/user.rb +0 -39
- data/spec/cli_spec.rb +0 -26
- data/spec/config_spec.rb +0 -64
- data/spec/console_base_spec.rb +0 -61
- data/spec/console_executor_spec.rb +0 -183
- data/spec/console_gritano_spec.rb +0 -121
- data/spec/console_installer_spec.rb +0 -28
- data/spec/console_remote_spec.rb +0 -70
- data/spec/console_spec.rb +0 -27
- data/spec/data/help_command_name.txt +0 -7
- data/spec/model_key_spec.rb +0 -44
- data/spec/model_permission_spec.rb +0 -72
- data/spec/model_repository_spec.rb +0 -56
- data/spec/model_user_spec.rb +0 -96
data/features/pub_key.feature
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
Feature: Public Key
|
2
|
-
In order to allow users to user gritano
|
3
|
-
As a ssh
|
4
|
-
I want to check public keys
|
5
|
-
|
6
|
-
Background:
|
7
|
-
Given the following users exist:
|
8
|
-
| login | admin |
|
9
|
-
| igorbonadio | true |
|
10
|
-
| jessicaeto | false |
|
11
|
-
|
12
|
-
And the following keys exist:
|
13
|
-
| login | key |
|
14
|
-
| igorbonadio | eva |
|
15
|
-
| jessicaeto | hal |
|
16
|
-
|
17
|
-
Scenario: Valid key
|
18
|
-
Given I start the public key checker
|
19
|
-
When I receive "eva" public key
|
20
|
-
Then I should see "igorbonadio"'s "eva" pubkey entry
|
21
|
-
|
22
|
-
Scenario: Invalid key
|
23
|
-
Given I start the public key checker
|
24
|
-
When I receive "invalid" public key
|
25
|
-
Then I should see an invalid pubkey
|
data/features/remote.feature
DELETED
@@ -1,150 +0,0 @@
|
|
1
|
-
Feature: Remote access
|
2
|
-
In order to use gritano remotely
|
3
|
-
As a user
|
4
|
-
I want to execute some commands
|
5
|
-
|
6
|
-
Background:
|
7
|
-
Given the following users exist:
|
8
|
-
| login | admin |
|
9
|
-
| igorbonadio | true |
|
10
|
-
| jessicaeto | false |
|
11
|
-
|
12
|
-
And the following keys exist:
|
13
|
-
| login | key |
|
14
|
-
| igorbonadio | eva |
|
15
|
-
| jessicaeto | hal |
|
16
|
-
|
17
|
-
And the following repositories exist:
|
18
|
-
| name |
|
19
|
-
| tmp/gritano.git |
|
20
|
-
| tmp/jeka.git |
|
21
|
-
|
22
|
-
And the following permissions exist:
|
23
|
-
| user | repo | access |
|
24
|
-
| igorbonadio | tmp/gritano.git | read |
|
25
|
-
| igorbonadio | tmp/gritano.git | write |
|
26
|
-
| igorbonadio | tmp/jeka.git | read |
|
27
|
-
| jessicaeto | tmp/jeka.git | read |
|
28
|
-
| jessicaeto | tmp/jeka.git | write |
|
29
|
-
|
30
|
-
Scenario: Git read access
|
31
|
-
Given I start the remote console with "igorbonadio"
|
32
|
-
When I try to get "tmp/gritano.git"
|
33
|
-
Then I should get it
|
34
|
-
|
35
|
-
Scenario: Git write access
|
36
|
-
Given I start the remote console with "igorbonadio"
|
37
|
-
When I try to send data to "tmp/gritano.git"
|
38
|
-
Then I should send it
|
39
|
-
|
40
|
-
Scenario: Git read access denied
|
41
|
-
Given I start the remote console with "jessicaeto"
|
42
|
-
When I try to get "tmp/gritano.git"
|
43
|
-
Then I should not get it
|
44
|
-
|
45
|
-
Scenario: Git write access denied
|
46
|
-
Given I start the remote console with "jessicaeto"
|
47
|
-
When I try to send data to "tmp/gritano.git"
|
48
|
-
Then I should not send it
|
49
|
-
|
50
|
-
Scenario Outline: Normal user execute command
|
51
|
-
Given I start the remote console with "jessicaeto"
|
52
|
-
When I execute "<command>" via ssh
|
53
|
-
Then I should see a message via ssh
|
54
|
-
Examples:
|
55
|
-
| command |
|
56
|
-
| version |
|
57
|
-
| repo:list |
|
58
|
-
| key:list |
|
59
|
-
| key:add keyname |
|
60
|
-
| key:rm hal |
|
61
|
-
| admin:version |
|
62
|
-
| admin:user:add jose |
|
63
|
-
| admin:user:key:add igorbonadio marvin |
|
64
|
-
| admin:user:key:rm igorbonadio eva |
|
65
|
-
| admin:user:rm igorbonadio |
|
66
|
-
| admin:user:list |
|
67
|
-
| admin:user:key:list igorbonadio |
|
68
|
-
| admin:user:repo:list igorbonadio |
|
69
|
-
| admin:user:admin:add igorbonadio |
|
70
|
-
| admin:user:admin:rm igorbonadio |
|
71
|
-
| admin:repo:add tmp/p-lang.git |
|
72
|
-
| admin:repo:add tmp/p-lang.git igorbonadio |
|
73
|
-
| admin:repo:add tmp/p-lang.git igorbonadio jessicaeto |
|
74
|
-
| admin:repo:rm tmp/jeka.git |
|
75
|
-
| admin:repo:read:add tmp/gritano.git jessicaeto |
|
76
|
-
| admin:repo:write:add tmp/gritano.git jessicaeto |
|
77
|
-
| admin:repo:read:rm tmp/jeka.git igorbonadio |
|
78
|
-
| admin:repo:write:rm tmp/gritano.git igorbonadio |
|
79
|
-
| admin:repo:list |
|
80
|
-
| admin:repo:user:list tmp/jeka.git |
|
81
|
-
| admin:user:add igorbonadio |
|
82
|
-
| admin:user:rm jose |
|
83
|
-
| admin:user:key:add userrr marvino |
|
84
|
-
| admin:user:key:rm igorbonadio marvino |
|
85
|
-
| admin:user:key:list arybonadio |
|
86
|
-
| admin:user:repo:list arybonadio |
|
87
|
-
| admin:user:admin:add arybonadio |
|
88
|
-
| admin:user:admin:rm arybonadio |
|
89
|
-
| admin:repo:add tmp/jeka.git |
|
90
|
-
| admin:repo:rm tmp/p-lang.git |
|
91
|
-
| admin:repo:read:add tmp/gritano.git arybonadio |
|
92
|
-
| admin:repo:read:add tmp/p-lang.git jessicaeto |
|
93
|
-
| admin:repo:write:add tmp/gritano.git arybonadio |
|
94
|
-
| admin:repo:write:add tmp/p-lang.git jessicaeto |
|
95
|
-
| admin:repo:read:rm tmp/jeka.git aribonadio |
|
96
|
-
| admin:repo:read:rm tmp/p-lang.git igorbonadio |
|
97
|
-
| admin:repo:write:rm tmp/gritano.git arybonadio |
|
98
|
-
| admin:repo:write:rm tmp/p-lang.git igorbonadio |
|
99
|
-
| admin:repo:user:list tmp/ruby.git |
|
100
|
-
|
101
|
-
Scenario Outline: Admin user execute command
|
102
|
-
Given I start the remote console with "igorbonadio"
|
103
|
-
When I execute "<command>" via ssh
|
104
|
-
Then I should see a message via ssh
|
105
|
-
Examples:
|
106
|
-
| command |
|
107
|
-
| version |
|
108
|
-
| repo:list |
|
109
|
-
| key:list |
|
110
|
-
| key:add keyname |
|
111
|
-
| key:rm hal |
|
112
|
-
| admin:version |
|
113
|
-
| admin:user:add jose |
|
114
|
-
| admin:user:key:add igorbonadio marvin |
|
115
|
-
| admin:user:key:rm igorbonadio eva |
|
116
|
-
| admin:user:rm igorbonadio |
|
117
|
-
| admin:user:list |
|
118
|
-
| admin:user:key:list igorbonadio |
|
119
|
-
| admin:user:repo:list igorbonadio |
|
120
|
-
| admin:user:admin:add igorbonadio |
|
121
|
-
| admin:user:admin:rm igorbonadio |
|
122
|
-
| admin:repo:add tmp/p-lang.git |
|
123
|
-
| admin:repo:add tmp/p-lang.git igorbonadio |
|
124
|
-
| admin:repo:add tmp/p-lang.git igorbonadio jessicaeto |
|
125
|
-
| admin:repo:rm tmp/jeka.git |
|
126
|
-
| admin:repo:read:add tmp/gritano.git jessicaeto |
|
127
|
-
| admin:repo:write:add tmp/gritano.git jessicaeto |
|
128
|
-
| admin:repo:read:rm tmp/jeka.git igorbonadio |
|
129
|
-
| admin:repo:write:rm tmp/gritano.git igorbonadio |
|
130
|
-
| admin:repo:list |
|
131
|
-
| admin:repo:user:list tmp/jeka.git |
|
132
|
-
| admin:user:add igorbonadio |
|
133
|
-
| admin:user:rm jose |
|
134
|
-
| admin:user:key:add userrr marvino |
|
135
|
-
| admin:user:key:rm igorbonadio marvino |
|
136
|
-
| admin:user:key:list arybonadio |
|
137
|
-
| admin:user:repo:list arybonadio |
|
138
|
-
| admin:user:admin:add arybonadio |
|
139
|
-
| admin:user:admin:rm arybonadio |
|
140
|
-
| admin:repo:add tmp/jeka.git |
|
141
|
-
| admin:repo:rm tmp/p-lang.git |
|
142
|
-
| admin:repo:read:add tmp/gritano.git arybonadio |
|
143
|
-
| admin:repo:read:add tmp/p-lang.git jessicaeto |
|
144
|
-
| admin:repo:write:add tmp/gritano.git arybonadio |
|
145
|
-
| admin:repo:write:add tmp/p-lang.git jessicaeto |
|
146
|
-
| admin:repo:read:rm tmp/jeka.git aribonadio |
|
147
|
-
| admin:repo:read:rm tmp/p-lang.git igorbonadio |
|
148
|
-
| admin:repo:write:rm tmp/gritano.git arybonadio |
|
149
|
-
| admin:repo:write:rm tmp/p-lang.git igorbonadio |
|
150
|
-
| admin:repo:user:list tmp/ruby.git |
|
@@ -1,26 +0,0 @@
|
|
1
|
-
Given /^the following users exist:$/ do |table|
|
2
|
-
table.hashes.each do |user|
|
3
|
-
Gritano::User.create(user)
|
4
|
-
end
|
5
|
-
jessica = Gritano::User.find_by_login("jessicaeto")
|
6
|
-
jessica.save
|
7
|
-
end
|
8
|
-
|
9
|
-
Given /^the following keys exist:$/ do |table|
|
10
|
-
table.hashes.each do |key|
|
11
|
-
Gritano::User.find_by_login(key['login']).keys.create(name: key["key"], key: key["key"])
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
Given /^the following repositories exist:$/ do |table|
|
16
|
-
table.hashes.each do |repo|
|
17
|
-
Gritano::Repository.create(repo)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
Given /^the following permissions exist:$/ do |table|
|
22
|
-
table.hashes.each do |permission|
|
23
|
-
Gritano::User.find_by_login(permission['user'])
|
24
|
-
.add_access(Gritano::Repository.find_by_name(permission['repo']), permission['access'].to_sym)
|
25
|
-
end
|
26
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
Given /^I start the gritano console but gritano is not installed$/ do
|
2
|
-
stdin = double()
|
3
|
-
stdin.stub(:read).and_return("Your SSHKEY here...")
|
4
|
-
FileUtils.rm_rf(File.join("tmp", ".gritano"))
|
5
|
-
@home_dir = 'tmp'
|
6
|
-
@repo_dir = 'tmp'
|
7
|
-
@console = Gritano::CLI
|
8
|
-
end
|
9
|
-
|
10
|
-
When /^I execute any command$/ do
|
11
|
-
@command = "user:list"
|
12
|
-
end
|
13
|
-
|
14
|
-
Then /^I should see the error: "(.*?)"$/ do |error|
|
15
|
-
lambda {@console.execute(@command.split(' '), @stdin, @home_dir, @repo_dir)}.should raise_error SystemExit
|
16
|
-
end
|
17
|
-
|
18
|
-
When /^I install it$/ do
|
19
|
-
@prepare_output = @console.execute(['setup:prepare'], @stdin, @home_dir, @repo_dir)
|
20
|
-
@install_output = @console.execute(['setup:install'], @stdin, @home_dir, @repo_dir)
|
21
|
-
end
|
22
|
-
|
23
|
-
Then /^I should see that gritano was successful (installed|updated)$/ do |opt|
|
24
|
-
@prepare_output.should be == "Gritano's configuration has been generated.\nIf you want to customize it, check your '#{File.join(@home_dir, '.gritano')}' directory." if opt == 'installed'
|
25
|
-
@install_output.should be == 'gritano has been installed'
|
26
|
-
end
|
27
|
-
|
28
|
-
When /^I update it$/ do
|
29
|
-
@install_output = @console.execute(['setup:install'], @stdin, @home_dir, @repo_dir)
|
30
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
Given /^I start the gritano console$/ do
|
2
|
-
@stdin = double()
|
3
|
-
@stdin.stub(:read).and_return("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9UnnlDwmvid+WRAyIhVzFhIjUUxA3Wul7LN8mk18dHZDv5HSVADmM4EoqbVSbpeVIyTIchqS3y3XF1rh8dfM41f/W3lcTcFihHM6RDx45Q3Lz9hfyrT8tttlWRA7prvlXu6bUOqMmNtvFFow+bJEo/HgCZHshvoDHcnlHfziU7bDCo+p50SdafFwZRe3AWp/f4TsxiP7jpBnluQM0Dl9Om8jfW8IYAJ+WxlKBsKLMkRH/HWSuigs4AQBD4ADiQfOm2RO4yeSiVFNwGFmgG7NmEq1sNALLAQw+ijN9vyiD99ybr0pqoJX3vhyRBWvCrgQdHjh8ucaoMXI89LxyYts/ igorbonadio@marvin.local")
|
4
|
-
@home_dir = '.'
|
5
|
-
@repo_dir = 'tmp'
|
6
|
-
@console = Gritano::CLI
|
7
|
-
end
|
8
|
-
|
9
|
-
When /^I execute "(.*?)"$/ do |command|
|
10
|
-
@command = command.gsub(' ', '_').gsub(':', '_').gsub('/', '_').
|
11
|
-
gsub('-', '_').gsub('.', '_')
|
12
|
-
@output = @console.execute(command.split(' '), @stdin, @home_dir, @repo_dir)
|
13
|
-
end
|
14
|
-
|
15
|
-
Then /^I should see the local help$/ do
|
16
|
-
help = File.open("features/data/local_help.txt").readlines.join.
|
17
|
-
gsub('{{VERSION}}', File.open("VERSION").readlines.join)
|
18
|
-
@output.should be == help
|
19
|
-
end
|
20
|
-
|
21
|
-
Then /^I should see a message$/ do
|
22
|
-
msg = File.open("features/data/local_commands/#{@command}.txt").readlines.join.
|
23
|
-
gsub('{{VERSION}}', File.open("VERSION").readlines.join)
|
24
|
-
@output.should be == msg
|
25
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
Given /^I start the public key checker$/ do
|
2
|
-
@console = Gritano::CLI
|
3
|
-
end
|
4
|
-
|
5
|
-
When /^I receive "(.*?)" public key$/ do |key|
|
6
|
-
@output = @console.check_pub_key(key, '.')
|
7
|
-
end
|
8
|
-
|
9
|
-
Then /^I should see an invalid pubkey$/ do
|
10
|
-
@output.should be == "invalid"
|
11
|
-
end
|
12
|
-
|
13
|
-
Then /^I should see "(.*?)"'s "(.*?)" pubkey entry$/ do |user, key|
|
14
|
-
@output.should be == "command=\"gritano-remote #{user}\" #{key}"
|
15
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
Given /^I start the remote console with "(.*?)"$/ do |login|
|
2
|
-
@stdin = double()
|
3
|
-
@stdin.stub(:read).and_return("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9UnnlDwmvid+WRAyIhVzFhIjUUxA3Wul7LN8mk18dHZDv5HSVADmM4EoqbVSbpeVIyTIchqS3y3XF1rh8dfM41f/W3lcTcFihHM6RDx45Q3Lz9hfyrT8tttlWRA7prvlXu6bUOqMmNtvFFow+bJEo/HgCZHshvoDHcnlHfziU7bDCo+p50SdafFwZRe3AWp/f4TsxiP7jpBnluQM0Dl9Om8jfW8IYAJ+WxlKBsKLMkRH/HWSuigs4AQBD4ADiQfOm2RO4yeSiVFNwGFmgG7NmEq1sNALLAQw+ijN9vyiD99ybr0pqoJX3vhyRBWvCrgQdHjh8ucaoMXI89LxyYts/ igorbonadio@marvin.local")
|
4
|
-
@home_dir = '.'
|
5
|
-
@repo_dir = 'tmp'
|
6
|
-
@login = login
|
7
|
-
@console = Gritano::CLI
|
8
|
-
end
|
9
|
-
|
10
|
-
When /^I execute "(.*?)" via ssh$/ do |command|
|
11
|
-
@command = command + "_" + @login
|
12
|
-
@command = @command.gsub(' ', '_').gsub(':', '_').gsub('/', '_').
|
13
|
-
gsub('-', '_').gsub('.', '_')
|
14
|
-
@output = @console.check(command.split(' '), @login, @stdin, @home_dir, @repo_dir)
|
15
|
-
end
|
16
|
-
|
17
|
-
Then /^I should see a message via ssh$/ do
|
18
|
-
msg = File.open("features/data/remote_commands/#{@command}.txt").readlines.join.
|
19
|
-
gsub('{{VERSION}}', File.open("VERSION").readlines.join)
|
20
|
-
@output.should be == msg
|
21
|
-
end
|
22
|
-
|
23
|
-
When /^I try to get "(.*?)"$/ do |repo|
|
24
|
-
@command = ['git-receive-pack', repo]
|
25
|
-
end
|
26
|
-
|
27
|
-
Then /^I should get it$/ do
|
28
|
-
Kernel.should_receive(:exec)
|
29
|
-
@console.check(@command, @login, @stdin, @home_dir, @repo_dir)
|
30
|
-
end
|
31
|
-
|
32
|
-
Then /^I should not get it$/ do
|
33
|
-
Kernel.should_not_receive(:exec)
|
34
|
-
@console.check(@command, @login, @stdin, @home_dir, @repo_dir)
|
35
|
-
end
|
36
|
-
|
37
|
-
When /^I try to send data to "(.*?)"$/ do |repo|
|
38
|
-
@command = ['git-upload-pack', repo]
|
39
|
-
end
|
40
|
-
|
41
|
-
Then /^I should send it$/ do
|
42
|
-
Kernel.should_receive(:exec)
|
43
|
-
@console.check(@command, @login, @stdin, @home_dir, @repo_dir)
|
44
|
-
end
|
45
|
-
|
46
|
-
Then /^I should not send it$/ do
|
47
|
-
Kernel.should_not_receive(:exec)
|
48
|
-
@console.check(@command, @login, @stdin, @home_dir, @repo_dir)
|
49
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'database_cleaner'
|
3
|
-
require 'database_cleaner/cucumber'
|
4
|
-
DatabaseCleaner.strategy = :truncation
|
5
|
-
rescue NameError
|
6
|
-
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
|
7
|
-
end
|
8
|
-
|
9
|
-
Before do
|
10
|
-
DatabaseCleaner.start
|
11
|
-
end
|
12
|
-
|
13
|
-
After do |scenario|
|
14
|
-
DatabaseCleaner.clean
|
15
|
-
end
|
data/features/support/env.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'simplecov'
|
2
|
-
SimpleCov.start do
|
3
|
-
add_filter "/features/"
|
4
|
-
add_filter "/spec/"
|
5
|
-
add_filter "/db/"
|
6
|
-
end
|
7
|
-
|
8
|
-
require 'bundler'
|
9
|
-
begin
|
10
|
-
Bundler.setup(:default, :development)
|
11
|
-
rescue Bundler::BundlerError => e
|
12
|
-
$stderr.puts e.message
|
13
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
14
|
-
exit e.status_code
|
15
|
-
end
|
16
|
-
|
17
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
18
|
-
require 'gritano'
|
19
|
-
|
20
|
-
require 'rspec/expectations'
|
21
|
-
require 'cucumber/rspec/doubles'
|
22
|
-
|
23
|
-
require 'active_record'
|
24
|
-
|
25
|
-
Before do
|
26
|
-
ActiveRecord::Base.establish_connection(YAML::load(File.open('.gritano/database.yml')))
|
27
|
-
FileUtils.rm_rf(File.join("tmp", ".gritano"))
|
28
|
-
FileUtils.mkdir(File.join('tmp', '.gritano'))
|
29
|
-
Gritano::Console.remote_console(false, 'tmp')
|
30
|
-
end
|
data/lib/gritano/cli.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
module Gritano
|
2
|
-
module CLI
|
3
|
-
|
4
|
-
def CLI._execute(cmd, console)
|
5
|
-
begin
|
6
|
-
output = console.execute(cmd)
|
7
|
-
if output[0]
|
8
|
-
output[1].to_s
|
9
|
-
else
|
10
|
-
"error: #{output[1]}"
|
11
|
-
end
|
12
|
-
rescue
|
13
|
-
console.execute(["help"])[1]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def CLI.execute(cmd, stdin = STDIN, home_dir = Etc.getpwuid.dir, repo_dir = Etc.getpwuid.dir)
|
18
|
-
Gritano::Console.remote_console(false, home_dir)
|
19
|
-
_execute(cmd, Gritano::Console::Gritano.new(stdin, home_dir, repo_dir))
|
20
|
-
end
|
21
|
-
|
22
|
-
def CLI.check(cmd, login, stdin = STDIN, home_dir = Etc.getpwuid.dir, repo_dir = Etc.getpwuid.dir)
|
23
|
-
Gritano::Console.remote_console(true, home_dir)
|
24
|
-
_execute(cmd + [login], Gritano::Console::Remote.new(stdin, home_dir, repo_dir))
|
25
|
-
end
|
26
|
-
|
27
|
-
def CLI.check_pub_key(key, home_dir = Etc.getpwuid.dir)
|
28
|
-
ActiveRecord::Base.establish_connection(YAML::load(File.open(File.join(home_dir, '.gritano', 'database.yml'))))
|
29
|
-
k = Key.find_by_key(key)
|
30
|
-
if k
|
31
|
-
return "command=\"gritano-remote #{k.user.login}\" #{k.key}"
|
32
|
-
else
|
33
|
-
return "invalid"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def CLI.check_access(login, repo, access, home_dir = Etc.getpwuid.dir, repo_dir = Etc.getpwuid.dir)
|
38
|
-
ActiveRecord::Base.establish_connection(YAML::load(File.open(File.join(home_dir, '.gritano', 'database.yml'))))
|
39
|
-
user = User.find_by_login(login)
|
40
|
-
if user
|
41
|
-
repo = Gritano::Repository.find_by_name(repo)
|
42
|
-
if repo
|
43
|
-
return user.check_access(repo, access)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
return false
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
data/lib/gritano/console.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require File.join(ROOT_PATH, 'gritano/console/base')
|
2
|
-
require File.join(ROOT_PATH, 'gritano/console/executor')
|
3
|
-
require File.join(ROOT_PATH, 'gritano/console/installer')
|
4
|
-
require File.join(ROOT_PATH, 'gritano/console/gritano')
|
5
|
-
require File.join(ROOT_PATH, 'gritano/console/remote')
|
6
|
-
|
7
|
-
module Gritano
|
8
|
-
module Console
|
9
|
-
def Console.remote_console(remote, home_dir = Etc.getpwuid.dir)
|
10
|
-
if remote
|
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:"
|
17
|
-
else
|
18
|
-
Base.bin_name = "gritano "
|
19
|
-
Remote.bin_name = "gritano "
|
20
|
-
Executor.bin_name = "gritano "
|
21
|
-
Gritano.bin_name = "gritano "
|
22
|
-
Installer.bin_name = "gritano "
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|