gritano 0.10.3 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -1
- data/Gemfile.lock +0 -2
- data/README.rdoc +0 -6
- data/TODO +8 -4
- data/VERSION +1 -1
- data/features/data/local_help.txt +0 -6
- data/features/data/remote_commands/admin_help_igorbonadio.txt +0 -6
- data/features/data/remote_commands/admin_help_jessicaeto.txt +0 -6
- data/features/data/remote_commands/help_igorbonadio.txt +0 -1
- data/features/data/remote_commands/help_jessicaeto.txt +0 -1
- data/features/data/remote_commands/invalid_command_igorbonadio.txt +0 -1
- data/features/data/remote_commands/invalid_command_jessicaeto.txt +0 -1
- data/features/data/remote_help.txt +0 -1
- data/features/local.feature +0 -10
- data/features/remote.feature +0 -12
- data/features/step_definitions/local_step.rb +0 -2
- data/gritano.gemspec +2 -37
- data/lib/gritano.rb +0 -1
- data/lib/gritano/console.rb +5 -7
- data/lib/gritano/console/executor.rb +0 -16
- data/lib/gritano/console/gritano.rb +0 -54
- data/lib/gritano/console/remote.rb +0 -5
- metadata +3 -51
- data/features/data/local_commands/addon_list.txt +0 -5
- data/features/data/local_commands/addon_ssh_install.txt +0 -0
- data/features/data/local_commands/plugin_add_ssh.txt +0 -1
- data/features/data/local_commands/plugin_add_sshs.txt +0 -1
- data/features/data/local_commands/plugin_exec_ssh_help.txt +0 -12
- data/features/data/local_commands/plugin_exec_ssh_helps.txt +0 -12
- data/features/data/local_commands/plugin_exec_sshs_help.txt +0 -1
- data/features/data/local_commands/plugin_info_ssh.txt +0 -1
- data/features/data/local_commands/plugin_info_sshs.txt +0 -1
- data/features/data/local_commands/plugin_list.txt +0 -6
- data/features/data/local_commands/plugin_rm_ssh.txt +0 -1
- data/features/data/local_commands/plugin_rm_sshs.txt +0 -1
- data/features/data/remote_commands/admin_addon_list_igorbonadio.txt +0 -5
- data/features/data/remote_commands/admin_addon_list_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_plugin_exec_ssh_help_igorbonadio.txt +0 -12
- data/features/data/remote_commands/admin_plugin_exec_ssh_help_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_plugin_exec_ssh_helps_igorbonadio.txt +0 -12
- data/features/data/remote_commands/admin_plugin_exec_ssh_helps_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_plugin_exec_sshs_help_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_plugin_exec_sshs_help_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_plugin_info_ssh_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_plugin_info_ssh_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_plugin_info_sshs_igorbonadio.txt +0 -1
- data/features/data/remote_commands/admin_plugin_info_sshs_jessicaeto.txt +0 -1
- data/features/data/remote_commands/admin_plugin_list_igorbonadio.txt +0 -6
- data/features/data/remote_commands/admin_plugin_list_jessicaeto.txt +0 -1
- data/features/data/ssh_help.txt +0 -12
- data/lib/gritano/plugin.rb +0 -85
- data/lib/gritano/plugin/http.rb +0 -73
- data/lib/gritano/plugin/ssh.rb +0 -121
- data/spec/plugin_spec.rb +0 -64
- data/spec/plugin_ssh_spec.rb +0 -16
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -55,7 +55,6 @@ GEM
|
|
55
55
|
simplecov-html (~> 0.7.1)
|
56
56
|
simplecov-html (0.7.1)
|
57
57
|
sqlite3 (1.3.7)
|
58
|
-
sshd_config (0.1.0)
|
59
58
|
terminal-table (1.4.5)
|
60
59
|
tzinfo (0.3.35)
|
61
60
|
|
@@ -74,5 +73,4 @@ DEPENDENCIES
|
|
74
73
|
rspec (>= 2.11.0)
|
75
74
|
simplecov (>= 0.6.4)
|
76
75
|
sqlite3 (>= 1.3.6)
|
77
|
-
sshd_config
|
78
76
|
terminal-table (>= 1.4.5)
|
data/README.rdoc
CHANGED
@@ -91,12 +91,6 @@ Starting from Gritano 0.3.0, administrators can execute commands via ssh:
|
|
91
91
|
|
92
92
|
$ ssh git@host.com admin:repo:list
|
93
93
|
|
94
|
-
== Plugins
|
95
|
-
|
96
|
-
Starting from Gritano 0.7.0, Gritano can be extended by plugins:
|
97
|
-
|
98
|
-
* SSH - It's a patched OpenSSH v6.1p1 used by Gritano that enables SSH lookup for public keys in a database.
|
99
|
-
|
100
94
|
== For more Information
|
101
95
|
|
102
96
|
http://igorbonadio.com.br/gritano
|
data/TODO
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
-
v0.
|
2
|
-
☐
|
3
|
-
|
1
|
+
v0.12.0:
|
2
|
+
☐ mostrar url ssh e https se existir
|
3
|
+
|
4
|
+
v1.0.0:
|
5
|
+
☐ testar instalação manual (anotar o processo)
|
6
|
+
☐ escrever um manual
|
7
|
+
☐ site
|
4
8
|
|
5
9
|
futuro:
|
6
10
|
☐ divulgar
|
7
|
-
☐
|
11
|
+
☐ criar um modulo puppet para instalação
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.11.0
|
@@ -3,11 +3,6 @@
|
|
3
3
|
Examples:
|
4
4
|
gritano help
|
5
5
|
gritano version
|
6
|
-
gritano plugin:list
|
7
|
-
gritano plugin:info plugin_name
|
8
|
-
gritano plugin:add plugin_name
|
9
|
-
gritano plugin:rm plugin_name
|
10
|
-
gritano plugin:exec plugin_name command
|
11
6
|
gritano setup:prepare
|
12
7
|
gritano setup:install
|
13
8
|
gritano user:list
|
@@ -31,7 +26,6 @@
|
|
31
26
|
gritano repo:write:add reponame.git username
|
32
27
|
gritano repo:read:rm reponame.git username
|
33
28
|
gritano repo:write:rm reponame.git username
|
34
|
-
gritano repo:info reponame.git
|
35
29
|
|
36
30
|
--
|
37
31
|
v{{VERSION}}
|
@@ -3,11 +3,6 @@
|
|
3
3
|
Examples:
|
4
4
|
ssh git@host.com admin:help
|
5
5
|
ssh git@host.com admin:version
|
6
|
-
ssh git@host.com admin:plugin:list
|
7
|
-
ssh git@host.com admin:plugin:info plugin_name
|
8
|
-
ssh git@host.com admin:plugin:add plugin_name
|
9
|
-
ssh git@host.com admin:plugin:rm plugin_name
|
10
|
-
ssh git@host.com admin:plugin:exec plugin_name command
|
11
6
|
ssh git@host.com admin:setup:prepare
|
12
7
|
ssh git@host.com admin:setup:install
|
13
8
|
ssh git@host.com admin:user:list
|
@@ -31,7 +26,6 @@
|
|
31
26
|
ssh git@host.com admin:repo:write:add reponame.git username
|
32
27
|
ssh git@host.com admin:repo:read:rm reponame.git username
|
33
28
|
ssh git@host.com admin:repo:write:rm reponame.git username
|
34
|
-
ssh git@host.com admin:repo:info reponame.git
|
35
29
|
|
36
30
|
--
|
37
31
|
v{{VERSION}}
|
@@ -3,11 +3,6 @@
|
|
3
3
|
Examples:
|
4
4
|
ssh git@host.com admin:help
|
5
5
|
ssh git@host.com admin:version
|
6
|
-
ssh git@host.com admin:plugin:list
|
7
|
-
ssh git@host.com admin:plugin:info plugin_name
|
8
|
-
ssh git@host.com admin:plugin:add plugin_name
|
9
|
-
ssh git@host.com admin:plugin:rm plugin_name
|
10
|
-
ssh git@host.com admin:plugin:exec plugin_name command
|
11
6
|
ssh git@host.com admin:setup:prepare
|
12
7
|
ssh git@host.com admin:setup:install
|
13
8
|
ssh git@host.com admin:user:list
|
@@ -31,7 +26,6 @@
|
|
31
26
|
ssh git@host.com admin:repo:write:add reponame.git username
|
32
27
|
ssh git@host.com admin:repo:read:rm reponame.git username
|
33
28
|
ssh git@host.com admin:repo:write:rm reponame.git username
|
34
|
-
ssh git@host.com admin:repo:info reponame.git
|
35
29
|
|
36
30
|
--
|
37
31
|
v{{VERSION}}
|
data/features/local.feature
CHANGED
@@ -82,14 +82,4 @@ Feature: Local access
|
|
82
82
|
| repo:write:rm tmp/gritano.git arybonadio |
|
83
83
|
| repo:write:rm tmp/p-lang.git igorbonadio |
|
84
84
|
| repo:user:list tmp/ruby.git |
|
85
|
-
| plugin:list |
|
86
|
-
| plugin:info ssh |
|
87
|
-
| plugin:add ssh |
|
88
|
-
| plugin:rm ssh |
|
89
|
-
| plugin:info sshs |
|
90
|
-
| plugin:exec ssh help |
|
91
|
-
| plugin:exec ssh helps |
|
92
|
-
| plugin:exec sshs help |
|
93
|
-
| plugin:add sshs |
|
94
|
-
| plugin:rm sshs |
|
95
85
|
|
data/features/remote.feature
CHANGED
@@ -107,12 +107,6 @@ Feature: Remote access
|
|
107
107
|
| admin:repo:write:rm tmp/gritano.git arybonadio |
|
108
108
|
| admin:repo:write:rm tmp/p-lang.git igorbonadio |
|
109
109
|
| admin:repo:user:list tmp/ruby.git |
|
110
|
-
| admin:plugin:list |
|
111
|
-
| admin:plugin:info ssh |
|
112
|
-
| admin:plugin:info sshs |
|
113
|
-
| admin:plugin:exec ssh help |
|
114
|
-
| admin:plugin:exec ssh helps |
|
115
|
-
| admin:plugin:exec sshs help |
|
116
110
|
|
117
111
|
Scenario Outline: Admin user execute command
|
118
112
|
Given I start the remote console with "igorbonadio"
|
@@ -174,9 +168,3 @@ Feature: Remote access
|
|
174
168
|
| admin:repo:write:rm tmp/gritano.git arybonadio |
|
175
169
|
| admin:repo:write:rm tmp/p-lang.git igorbonadio |
|
176
170
|
| admin:repo:user:list tmp/ruby.git |
|
177
|
-
| admin:plugin:list |
|
178
|
-
| admin:plugin:info ssh |
|
179
|
-
| admin:plugin:info sshs |
|
180
|
-
| admin:plugin:exec ssh help |
|
181
|
-
| admin:plugin:exec ssh helps |
|
182
|
-
| admin:plugin:exec sshs help |
|
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.
|
8
|
+
s.version = "0.11.0"
|
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-
|
12
|
+
s.date = "2013-05-13"
|
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"]
|
@@ -42,18 +42,6 @@ Gem::Specification.new do |s|
|
|
42
42
|
"db/migrate/006_add_email_to_users.rb",
|
43
43
|
"db/migrate/007_add_password_to_users.rb",
|
44
44
|
"features/data/config_true.yml",
|
45
|
-
"features/data/local_commands/addon_list.txt",
|
46
|
-
"features/data/local_commands/addon_ssh_install.txt",
|
47
|
-
"features/data/local_commands/plugin_add_ssh.txt",
|
48
|
-
"features/data/local_commands/plugin_add_sshs.txt",
|
49
|
-
"features/data/local_commands/plugin_exec_ssh_help.txt",
|
50
|
-
"features/data/local_commands/plugin_exec_ssh_helps.txt",
|
51
|
-
"features/data/local_commands/plugin_exec_sshs_help.txt",
|
52
|
-
"features/data/local_commands/plugin_info_ssh.txt",
|
53
|
-
"features/data/local_commands/plugin_info_sshs.txt",
|
54
|
-
"features/data/local_commands/plugin_list.txt",
|
55
|
-
"features/data/local_commands/plugin_rm_ssh.txt",
|
56
|
-
"features/data/local_commands/plugin_rm_sshs.txt",
|
57
45
|
"features/data/local_commands/repo_add_tmp_jeka_git.txt",
|
58
46
|
"features/data/local_commands/repo_add_tmp_p_lang_git.txt",
|
59
47
|
"features/data/local_commands/repo_add_tmp_p_lang_git_igorbonadio.txt",
|
@@ -99,22 +87,8 @@ Gem::Specification.new do |s|
|
|
99
87
|
"features/data/local_commands/user_rm_jose.txt",
|
100
88
|
"features/data/local_commands/version.txt",
|
101
89
|
"features/data/local_help.txt",
|
102
|
-
"features/data/remote_commands/admin_addon_list_igorbonadio.txt",
|
103
|
-
"features/data/remote_commands/admin_addon_list_jessicaeto.txt",
|
104
90
|
"features/data/remote_commands/admin_help_igorbonadio.txt",
|
105
91
|
"features/data/remote_commands/admin_help_jessicaeto.txt",
|
106
|
-
"features/data/remote_commands/admin_plugin_exec_ssh_help_igorbonadio.txt",
|
107
|
-
"features/data/remote_commands/admin_plugin_exec_ssh_help_jessicaeto.txt",
|
108
|
-
"features/data/remote_commands/admin_plugin_exec_ssh_helps_igorbonadio.txt",
|
109
|
-
"features/data/remote_commands/admin_plugin_exec_ssh_helps_jessicaeto.txt",
|
110
|
-
"features/data/remote_commands/admin_plugin_exec_sshs_help_igorbonadio.txt",
|
111
|
-
"features/data/remote_commands/admin_plugin_exec_sshs_help_jessicaeto.txt",
|
112
|
-
"features/data/remote_commands/admin_plugin_info_ssh_igorbonadio.txt",
|
113
|
-
"features/data/remote_commands/admin_plugin_info_ssh_jessicaeto.txt",
|
114
|
-
"features/data/remote_commands/admin_plugin_info_sshs_igorbonadio.txt",
|
115
|
-
"features/data/remote_commands/admin_plugin_info_sshs_jessicaeto.txt",
|
116
|
-
"features/data/remote_commands/admin_plugin_list_igorbonadio.txt",
|
117
|
-
"features/data/remote_commands/admin_plugin_list_jessicaeto.txt",
|
118
92
|
"features/data/remote_commands/admin_repo_add_tmp_jeka_git_igorbonadio.txt",
|
119
93
|
"features/data/remote_commands/admin_repo_add_tmp_jeka_git_jessicaeto.txt",
|
120
94
|
"features/data/remote_commands/admin_repo_add_tmp_p_lang_git_igorbonadio.txt",
|
@@ -222,7 +196,6 @@ Gem::Specification.new do |s|
|
|
222
196
|
"features/data/remote_commands/version_igorbonadio.txt",
|
223
197
|
"features/data/remote_commands/version_jessicaeto.txt",
|
224
198
|
"features/data/remote_help.txt",
|
225
|
-
"features/data/ssh_help.txt",
|
226
199
|
"features/install.feature",
|
227
200
|
"features/local.feature",
|
228
201
|
"features/pub_key.feature",
|
@@ -249,9 +222,6 @@ Gem::Specification.new do |s|
|
|
249
222
|
"lib/gritano/models/permission.rb",
|
250
223
|
"lib/gritano/models/repository.rb",
|
251
224
|
"lib/gritano/models/user.rb",
|
252
|
-
"lib/gritano/plugin.rb",
|
253
|
-
"lib/gritano/plugin/http.rb",
|
254
|
-
"lib/gritano/plugin/ssh.rb",
|
255
225
|
"spec/cli_spec.rb",
|
256
226
|
"spec/config_spec.rb",
|
257
227
|
"spec/console_base_spec.rb",
|
@@ -265,8 +235,6 @@ Gem::Specification.new do |s|
|
|
265
235
|
"spec/model_permission_spec.rb",
|
266
236
|
"spec/model_repository_spec.rb",
|
267
237
|
"spec/model_user_spec.rb",
|
268
|
-
"spec/plugin_spec.rb",
|
269
|
-
"spec/plugin_ssh_spec.rb",
|
270
238
|
"spec/spec_helper.rb"
|
271
239
|
]
|
272
240
|
s.homepage = "http://igorbonadio.com.br/gritano"
|
@@ -283,7 +251,6 @@ Gem::Specification.new do |s|
|
|
283
251
|
s.add_runtime_dependency(%q<sqlite3>, [">= 1.3.6"])
|
284
252
|
s.add_runtime_dependency(%q<grit>, [">= 2.5.0"])
|
285
253
|
s.add_runtime_dependency(%q<terminal-table>, [">= 1.4.5"])
|
286
|
-
s.add_runtime_dependency(%q<sshd_config>, [">= 0"])
|
287
254
|
s.add_runtime_dependency(%q<bcrypt-ruby>, [">= 0"])
|
288
255
|
s.add_development_dependency(%q<rspec>, [">= 2.11.0"])
|
289
256
|
s.add_development_dependency(%q<rdoc>, [">= 3.12"])
|
@@ -297,7 +264,6 @@ Gem::Specification.new do |s|
|
|
297
264
|
s.add_dependency(%q<sqlite3>, [">= 1.3.6"])
|
298
265
|
s.add_dependency(%q<grit>, [">= 2.5.0"])
|
299
266
|
s.add_dependency(%q<terminal-table>, [">= 1.4.5"])
|
300
|
-
s.add_dependency(%q<sshd_config>, [">= 0"])
|
301
267
|
s.add_dependency(%q<bcrypt-ruby>, [">= 0"])
|
302
268
|
s.add_dependency(%q<rspec>, [">= 2.11.0"])
|
303
269
|
s.add_dependency(%q<rdoc>, [">= 3.12"])
|
@@ -312,7 +278,6 @@ Gem::Specification.new do |s|
|
|
312
278
|
s.add_dependency(%q<sqlite3>, [">= 1.3.6"])
|
313
279
|
s.add_dependency(%q<grit>, [">= 2.5.0"])
|
314
280
|
s.add_dependency(%q<terminal-table>, [">= 1.4.5"])
|
315
|
-
s.add_dependency(%q<sshd_config>, [">= 0"])
|
316
281
|
s.add_dependency(%q<bcrypt-ruby>, [">= 0"])
|
317
282
|
s.add_dependency(%q<rspec>, [">= 2.11.0"])
|
318
283
|
s.add_dependency(%q<rdoc>, [">= 3.12"])
|
data/lib/gritano.rb
CHANGED
data/lib/gritano/console.rb
CHANGED
@@ -8,19 +8,17 @@ module Gritano
|
|
8
8
|
module Console
|
9
9
|
def Console.remote_console(remote)
|
10
10
|
if remote
|
11
|
-
Base.bin_name = "ssh #{
|
12
|
-
Remote.bin_name = "ssh #{
|
13
|
-
Executor.bin_name = "ssh #{
|
14
|
-
Gritano.bin_name = "ssh #{
|
15
|
-
Installer.bin_name = "ssh #{
|
16
|
-
Plugin.bin_name = "ssh #{::Gritano::Ssh.servername} admin:"
|
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:"
|
17
16
|
else
|
18
17
|
Base.bin_name = "gritano "
|
19
18
|
Remote.bin_name = "gritano "
|
20
19
|
Executor.bin_name = "gritano "
|
21
20
|
Gritano.bin_name = "gritano "
|
22
21
|
Installer.bin_name = "gritano "
|
23
|
-
Plugin.bin_name = "gritano "
|
24
22
|
end
|
25
23
|
end
|
26
24
|
end
|
@@ -319,22 +319,6 @@ module Gritano
|
|
319
319
|
end
|
320
320
|
return [false, "An error occurred. Permissions was not modified."]
|
321
321
|
end
|
322
|
-
|
323
|
-
add_command "repo:info", "reponame.git" do |argv|
|
324
|
-
repo_name, = argv
|
325
|
-
repo = Repository.find_by_name(repo_name)
|
326
|
-
if repo
|
327
|
-
msg = Terminal::Table.new do |t|
|
328
|
-
t << ['ssh', "#{Ssh.servername}:#{repo_name}"]
|
329
|
-
if ::Gritano::Http.check_install
|
330
|
-
t << :separator
|
331
|
-
t << ['http', "#{Http.servername}/#{repo_name}"]
|
332
|
-
end
|
333
|
-
end
|
334
|
-
return [true, msg]
|
335
|
-
end
|
336
|
-
return [false, "Repository #{repo_name} doesn't exist."]
|
337
|
-
end
|
338
322
|
|
339
323
|
end
|
340
324
|
end
|
@@ -19,60 +19,6 @@ module Gritano
|
|
19
19
|
version = "v#{File.open(File.join(File.dirname(__FILE__), '..', '..', '..', 'VERSION')).readlines.join}"
|
20
20
|
[true, version]
|
21
21
|
end
|
22
|
-
|
23
|
-
add_command "plugin:list" do |argv|
|
24
|
-
msg = Terminal::Table.new do |t|
|
25
|
-
t << ['plugin', 'installed']
|
26
|
-
t << :separator
|
27
|
-
Plugin.list.each do |plugin, params|
|
28
|
-
t.add_row [plugin, params[:installed].call]
|
29
|
-
end
|
30
|
-
end
|
31
|
-
return [true, msg]
|
32
|
-
end
|
33
|
-
|
34
|
-
add_command "plugin:info", "plugin_name" do |argv|
|
35
|
-
name, = argv
|
36
|
-
begin
|
37
|
-
return [true, Plugin.list[name][:klass].info]
|
38
|
-
rescue
|
39
|
-
return [false, "There isn't a plugin called #{name}"]
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
add_command "plugin:add", "plugin_name" do |argv|
|
44
|
-
name, = argv
|
45
|
-
begin
|
46
|
-
Plugin.list[name][:klass].new.add
|
47
|
-
return [true, "Plugin #{name} was added"]
|
48
|
-
rescue
|
49
|
-
return [false, "There isn't a plugin called #{name}"]
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
add_command "plugin:rm", "plugin_name" do |argv|
|
54
|
-
name, = argv
|
55
|
-
begin
|
56
|
-
Plugin.list[name][:klass].new(@stdin, @home_dir, @repo_path).remove
|
57
|
-
return [true, "Plugin #{name} was removed"]
|
58
|
-
rescue
|
59
|
-
return [false, "There isn't a plugin called #{name}"]
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
add_command "plugin:exec", "plugin_name command" do |argv|
|
64
|
-
name = argv[0]
|
65
|
-
params = argv[1..-1]
|
66
|
-
if Plugin.list[name]
|
67
|
-
begin
|
68
|
-
return [true, Plugin.list[name][:klass].new(@stdin, @home_dir, @repo_path).exec(params)]
|
69
|
-
rescue Exception => e
|
70
|
-
return [true, Plugin.list[name][:klass].help]
|
71
|
-
end
|
72
|
-
else
|
73
|
-
return [false, "There isn't a plugin called #{name}"]
|
74
|
-
end
|
75
|
-
end
|
76
22
|
|
77
23
|
def method_missing(meth, *args, &block)
|
78
24
|
params = [meth.to_s.gsub("_", ":")] + args[0]
|
@@ -36,11 +36,6 @@ module Gritano
|
|
36
36
|
login, = args
|
37
37
|
@executor.execute(["user:repo:list"] + [login])
|
38
38
|
end
|
39
|
-
|
40
|
-
add_command "repo:info", "reponame" do |args|
|
41
|
-
reponame, login = args
|
42
|
-
@executor.execute(["repo:info"] + [reponame])
|
43
|
-
end
|
44
39
|
|
45
40
|
add_command "key:list" do |args|
|
46
41
|
login, = args
|
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.11.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: 2013-05-
|
12
|
+
date: 2013-05-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -75,22 +75,6 @@ dependencies:
|
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: 1.4.5
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: sshd_config
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ! '>='
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '0'
|
86
|
-
type: :runtime
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
94
78
|
- !ruby/object:Gem::Dependency
|
95
79
|
name: bcrypt-ruby
|
96
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -255,18 +239,6 @@ files:
|
|
255
239
|
- db/migrate/006_add_email_to_users.rb
|
256
240
|
- db/migrate/007_add_password_to_users.rb
|
257
241
|
- features/data/config_true.yml
|
258
|
-
- features/data/local_commands/addon_list.txt
|
259
|
-
- features/data/local_commands/addon_ssh_install.txt
|
260
|
-
- features/data/local_commands/plugin_add_ssh.txt
|
261
|
-
- features/data/local_commands/plugin_add_sshs.txt
|
262
|
-
- features/data/local_commands/plugin_exec_ssh_help.txt
|
263
|
-
- features/data/local_commands/plugin_exec_ssh_helps.txt
|
264
|
-
- features/data/local_commands/plugin_exec_sshs_help.txt
|
265
|
-
- features/data/local_commands/plugin_info_ssh.txt
|
266
|
-
- features/data/local_commands/plugin_info_sshs.txt
|
267
|
-
- features/data/local_commands/plugin_list.txt
|
268
|
-
- features/data/local_commands/plugin_rm_ssh.txt
|
269
|
-
- features/data/local_commands/plugin_rm_sshs.txt
|
270
242
|
- features/data/local_commands/repo_add_tmp_jeka_git.txt
|
271
243
|
- features/data/local_commands/repo_add_tmp_p_lang_git.txt
|
272
244
|
- features/data/local_commands/repo_add_tmp_p_lang_git_igorbonadio.txt
|
@@ -312,22 +284,8 @@ files:
|
|
312
284
|
- features/data/local_commands/user_rm_jose.txt
|
313
285
|
- features/data/local_commands/version.txt
|
314
286
|
- features/data/local_help.txt
|
315
|
-
- features/data/remote_commands/admin_addon_list_igorbonadio.txt
|
316
|
-
- features/data/remote_commands/admin_addon_list_jessicaeto.txt
|
317
287
|
- features/data/remote_commands/admin_help_igorbonadio.txt
|
318
288
|
- features/data/remote_commands/admin_help_jessicaeto.txt
|
319
|
-
- features/data/remote_commands/admin_plugin_exec_ssh_help_igorbonadio.txt
|
320
|
-
- features/data/remote_commands/admin_plugin_exec_ssh_help_jessicaeto.txt
|
321
|
-
- features/data/remote_commands/admin_plugin_exec_ssh_helps_igorbonadio.txt
|
322
|
-
- features/data/remote_commands/admin_plugin_exec_ssh_helps_jessicaeto.txt
|
323
|
-
- features/data/remote_commands/admin_plugin_exec_sshs_help_igorbonadio.txt
|
324
|
-
- features/data/remote_commands/admin_plugin_exec_sshs_help_jessicaeto.txt
|
325
|
-
- features/data/remote_commands/admin_plugin_info_ssh_igorbonadio.txt
|
326
|
-
- features/data/remote_commands/admin_plugin_info_ssh_jessicaeto.txt
|
327
|
-
- features/data/remote_commands/admin_plugin_info_sshs_igorbonadio.txt
|
328
|
-
- features/data/remote_commands/admin_plugin_info_sshs_jessicaeto.txt
|
329
|
-
- features/data/remote_commands/admin_plugin_list_igorbonadio.txt
|
330
|
-
- features/data/remote_commands/admin_plugin_list_jessicaeto.txt
|
331
289
|
- features/data/remote_commands/admin_repo_add_tmp_jeka_git_igorbonadio.txt
|
332
290
|
- features/data/remote_commands/admin_repo_add_tmp_jeka_git_jessicaeto.txt
|
333
291
|
- features/data/remote_commands/admin_repo_add_tmp_p_lang_git_igorbonadio.txt
|
@@ -435,7 +393,6 @@ files:
|
|
435
393
|
- features/data/remote_commands/version_igorbonadio.txt
|
436
394
|
- features/data/remote_commands/version_jessicaeto.txt
|
437
395
|
- features/data/remote_help.txt
|
438
|
-
- features/data/ssh_help.txt
|
439
396
|
- features/install.feature
|
440
397
|
- features/local.feature
|
441
398
|
- features/pub_key.feature
|
@@ -462,9 +419,6 @@ files:
|
|
462
419
|
- lib/gritano/models/permission.rb
|
463
420
|
- lib/gritano/models/repository.rb
|
464
421
|
- lib/gritano/models/user.rb
|
465
|
-
- lib/gritano/plugin.rb
|
466
|
-
- lib/gritano/plugin/http.rb
|
467
|
-
- lib/gritano/plugin/ssh.rb
|
468
422
|
- spec/cli_spec.rb
|
469
423
|
- spec/config_spec.rb
|
470
424
|
- spec/console_base_spec.rb
|
@@ -478,8 +432,6 @@ files:
|
|
478
432
|
- spec/model_permission_spec.rb
|
479
433
|
- spec/model_repository_spec.rb
|
480
434
|
- spec/model_user_spec.rb
|
481
|
-
- spec/plugin_spec.rb
|
482
|
-
- spec/plugin_ssh_spec.rb
|
483
435
|
- spec/spec_helper.rb
|
484
436
|
- TODO
|
485
437
|
homepage: http://igorbonadio.com.br/gritano
|
@@ -497,7 +449,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
497
449
|
version: '0'
|
498
450
|
segments:
|
499
451
|
- 0
|
500
|
-
hash: -
|
452
|
+
hash: -1882815293766482329
|
501
453
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
502
454
|
none: false
|
503
455
|
requirements:
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
Plugin ssh was added
|
@@ -1 +0,0 @@
|
|
1
|
-
error: There isn't a plugin called sshs
|
@@ -1,12 +0,0 @@
|
|
1
|
-
gritano plugin:exec ssh [command]
|
2
|
-
|
3
|
-
Examples:
|
4
|
-
gritano plugin:exec ssh help
|
5
|
-
gritano plugin:exec ssh install gritano_path
|
6
|
-
gritano plugin:exec ssh start
|
7
|
-
gritano plugin:exec ssh stop
|
8
|
-
gritano plugin:exec ssh servername:get
|
9
|
-
gritano plugin:exec ssh servername:set servername
|
10
|
-
|
11
|
-
--
|
12
|
-
v{{VERSION}}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
gritano plugin:exec ssh [command]
|
2
|
-
|
3
|
-
Examples:
|
4
|
-
gritano plugin:exec ssh help
|
5
|
-
gritano plugin:exec ssh install gritano_path
|
6
|
-
gritano plugin:exec ssh start
|
7
|
-
gritano plugin:exec ssh stop
|
8
|
-
gritano plugin:exec ssh servername:get
|
9
|
-
gritano plugin:exec ssh servername:set servername
|
10
|
-
|
11
|
-
--
|
12
|
-
v{{VERSION}}
|
@@ -1 +0,0 @@
|
|
1
|
-
error: There isn't a plugin called sshs
|
@@ -1 +0,0 @@
|
|
1
|
-
It installs a patched OpenSSH version used by Gritano that enables SSH lookup for public keys in a database
|
@@ -1 +0,0 @@
|
|
1
|
-
error: There isn't a plugin called sshs
|
@@ -1 +0,0 @@
|
|
1
|
-
Plugin ssh was removed
|
@@ -1 +0,0 @@
|
|
1
|
-
error: There isn't a plugin called sshs
|
@@ -1 +0,0 @@
|
|
1
|
-
error: access denied
|
@@ -1,12 +0,0 @@
|
|
1
|
-
ssh git@host.com admin:plugin:exec ssh [command]
|
2
|
-
|
3
|
-
Examples:
|
4
|
-
ssh git@host.com admin:plugin:exec ssh help
|
5
|
-
ssh git@host.com admin:plugin:exec ssh install gritano_path
|
6
|
-
ssh git@host.com admin:plugin:exec ssh start
|
7
|
-
ssh git@host.com admin:plugin:exec ssh stop
|
8
|
-
ssh git@host.com admin:plugin:exec ssh servername:get
|
9
|
-
ssh git@host.com admin:plugin:exec ssh servername:set servername
|
10
|
-
|
11
|
-
--
|
12
|
-
v{{VERSION}}
|
@@ -1 +0,0 @@
|
|
1
|
-
error: access denied
|
@@ -1,12 +0,0 @@
|
|
1
|
-
ssh git@host.com admin:plugin:exec ssh [command]
|
2
|
-
|
3
|
-
Examples:
|
4
|
-
ssh git@host.com admin:plugin:exec ssh help
|
5
|
-
ssh git@host.com admin:plugin:exec ssh install gritano_path
|
6
|
-
ssh git@host.com admin:plugin:exec ssh start
|
7
|
-
ssh git@host.com admin:plugin:exec ssh stop
|
8
|
-
ssh git@host.com admin:plugin:exec ssh servername:get
|
9
|
-
ssh git@host.com admin:plugin:exec ssh servername:set servername
|
10
|
-
|
11
|
-
--
|
12
|
-
v{{VERSION}}
|
@@ -1 +0,0 @@
|
|
1
|
-
error: access denied
|
@@ -1 +0,0 @@
|
|
1
|
-
error: There isn't a plugin called sshs
|
@@ -1 +0,0 @@
|
|
1
|
-
error: access denied
|
@@ -1 +0,0 @@
|
|
1
|
-
It installs a patched OpenSSH version used by Gritano that enables SSH lookup for public keys in a database
|
@@ -1 +0,0 @@
|
|
1
|
-
error: access denied
|
@@ -1 +0,0 @@
|
|
1
|
-
error: There isn't a plugin called sshs
|
@@ -1 +0,0 @@
|
|
1
|
-
error: access denied
|
@@ -1 +0,0 @@
|
|
1
|
-
error: access denied
|
data/features/data/ssh_help.txt
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
gritano plugin:exec ssh [command]
|
2
|
-
|
3
|
-
Examples:
|
4
|
-
gritano plugin:exec ssh help
|
5
|
-
gritano plugin:exec ssh install gritano_path
|
6
|
-
gritano plugin:exec ssh start
|
7
|
-
gritano plugin:exec ssh stop
|
8
|
-
gritano plugin:exec ssh servername:get
|
9
|
-
gritano plugin:exec ssh servername:set servername
|
10
|
-
|
11
|
-
--
|
12
|
-
v{{VERSION}}
|
data/lib/gritano/plugin.rb
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
module Gritano
|
2
|
-
class Plugin
|
3
|
-
|
4
|
-
def initialize(stdin = STDIN, home_dir = Etc.getpwuid.dir, repo_path = Etc.getpwuid.dir)
|
5
|
-
@stdin = stdin
|
6
|
-
@home_dir = home_dir
|
7
|
-
@repo_path = repo_path
|
8
|
-
@ssh_path = File.join(@home_dir, '.ssh')
|
9
|
-
end
|
10
|
-
|
11
|
-
def add
|
12
|
-
on_add
|
13
|
-
end
|
14
|
-
|
15
|
-
def remove
|
16
|
-
on_remove
|
17
|
-
end
|
18
|
-
|
19
|
-
def on_add
|
20
|
-
raise NotImplementedError
|
21
|
-
end
|
22
|
-
|
23
|
-
def on_remove
|
24
|
-
raise NotImplementedError
|
25
|
-
end
|
26
|
-
|
27
|
-
def exec(cmd)
|
28
|
-
method = cmd[0].split(':').join('_')
|
29
|
-
params = cmd[1..-1]
|
30
|
-
send(method, params)
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.name
|
34
|
-
self.to_s.downcase.split('::')[-1]
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.info
|
38
|
-
raise NotImplementedError
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.check_install
|
42
|
-
false
|
43
|
-
end
|
44
|
-
|
45
|
-
def self.list
|
46
|
-
@subclass
|
47
|
-
end
|
48
|
-
|
49
|
-
def self.inherited(subclass)
|
50
|
-
@subclass ||= Hash.new
|
51
|
-
@subclass[subclass.name] = {klass: subclass, installed: lambda { subclass.check_install }}
|
52
|
-
end
|
53
|
-
|
54
|
-
def self.add_command(command, parameters = "", &block)
|
55
|
-
define_method(command.gsub(':', '_'), &block)
|
56
|
-
commands[command] = parameters
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.commands
|
60
|
-
@commands || @commands = Hash.new
|
61
|
-
end
|
62
|
-
|
63
|
-
def self.bin_name=(name)
|
64
|
-
@bin_name = name
|
65
|
-
end
|
66
|
-
|
67
|
-
def self.bin_name
|
68
|
-
@bin_name || "gritano "
|
69
|
-
end
|
70
|
-
|
71
|
-
def self.help
|
72
|
-
msg = " #{Plugin.bin_name}plugin:exec #{self.name} [command]\n\n"
|
73
|
-
msg += " Examples:\n"
|
74
|
-
commands.each do |command, parameters|
|
75
|
-
msg += " #{Plugin.bin_name}plugin:exec #{self.name} #{command} #{parameters}\n"
|
76
|
-
end
|
77
|
-
msg += "\n --\n v#{File.open(File.join(File.dirname(__FILE__), '..', '..', 'VERSION')).readlines.join}"
|
78
|
-
msg
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
require File.join(ROOT_PATH, 'gritano/plugin/ssh')
|
85
|
-
require File.join(ROOT_PATH, 'gritano/plugin/http')
|
data/lib/gritano/plugin/http.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
module Gritano
|
2
|
-
class Http < Plugin
|
3
|
-
|
4
|
-
def self.info
|
5
|
-
"TODO"
|
6
|
-
end
|
7
|
-
|
8
|
-
def on_add
|
9
|
-
config = Config.new(File.join(@home_dir, '.gritano', 'config.yml'))
|
10
|
-
config.http = true
|
11
|
-
config.save
|
12
|
-
end
|
13
|
-
|
14
|
-
def on_remove
|
15
|
-
config = Config.new(File.join(@home_dir, '.gritano', 'config.yml'))
|
16
|
-
config.http = false
|
17
|
-
config.save
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.check_install
|
21
|
-
home = Etc.getpwuid.dir
|
22
|
-
if File.exist?(File.join(home, '.gritano', 'config.yml'))
|
23
|
-
config = Config.new(File.join(home, '.gritano', 'config.yml'))
|
24
|
-
if config.http
|
25
|
-
return config.http
|
26
|
-
else
|
27
|
-
return false
|
28
|
-
end
|
29
|
-
else
|
30
|
-
return false
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.servername
|
35
|
-
home = Etc.getpwuid.dir
|
36
|
-
if File.exist?(File.join(home, '.gritano', 'config.yml'))
|
37
|
-
config = Config.new(File.join(home, '.gritano', 'config.yml'))
|
38
|
-
if config.http_servername
|
39
|
-
return config.http_servername
|
40
|
-
end
|
41
|
-
end
|
42
|
-
return "http://git.server.com"
|
43
|
-
end
|
44
|
-
|
45
|
-
add_command "help" do |params|
|
46
|
-
Http.help
|
47
|
-
end
|
48
|
-
|
49
|
-
add_command "install", "install_dir" do |params|
|
50
|
-
install_dir, = params
|
51
|
-
puts "[git] Cloning"
|
52
|
-
if system "git clone git://github.com/igorbonadio/gritano-grack.git #{install_dir}"
|
53
|
-
puts "Please, edit the gritano-grack/config.yml file to finish your installation."
|
54
|
-
return "Done"
|
55
|
-
end
|
56
|
-
return "error"
|
57
|
-
end
|
58
|
-
|
59
|
-
add_command "servername:get" do |params|
|
60
|
-
return Http.servername
|
61
|
-
end
|
62
|
-
|
63
|
-
add_command "servername:set", "servername" do |params|
|
64
|
-
servername, = params
|
65
|
-
home = Etc.getpwuid.dir
|
66
|
-
config = Config.new(File.join(home, '.gritano', 'config.yml'))
|
67
|
-
config.http_servername = servername
|
68
|
-
config.save
|
69
|
-
return "done!"
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
end
|
data/lib/gritano/plugin/ssh.rb
DELETED
@@ -1,121 +0,0 @@
|
|
1
|
-
require "sshd_config"
|
2
|
-
|
3
|
-
module Gritano
|
4
|
-
class Ssh < Plugin
|
5
|
-
|
6
|
-
def self.info
|
7
|
-
"It installs a patched OpenSSH version used by Gritano that enables SSH lookup for public keys in a database"
|
8
|
-
end
|
9
|
-
|
10
|
-
def on_add
|
11
|
-
config = Config.new(File.join(@home_dir, '.gritano', 'config.yml'))
|
12
|
-
config.ssh = true
|
13
|
-
config.save
|
14
|
-
File.open(File.join(@ssh_path, 'authorized_keys'), "w").write('')
|
15
|
-
gritano_pub_key_path = `which gritano-pub-key`[0..-2]
|
16
|
-
`ln -s #{gritano_pub_key_path} #{File.join(@home_dir, '.gritano', 'gritano-pub-key')}`
|
17
|
-
end
|
18
|
-
|
19
|
-
def on_remove
|
20
|
-
config = Config.new(File.join(@home_dir, '.gritano', 'config.yml'))
|
21
|
-
config.ssh = false
|
22
|
-
config.save
|
23
|
-
File.open(File.join(@ssh_path, 'authorized_keys'), 'w').write(Key.authorized_keys)
|
24
|
-
FileUtils.rm(File.join(@home_dir, '.gritano', 'gritano-pub-key')) if File.exist?(File.join(@home_dir, '.gritano', 'gritano-pub-key'))
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.check_install
|
28
|
-
home = Etc.getpwuid.dir
|
29
|
-
if File.exist?(File.join(home, '.gritano', 'config.yml'))
|
30
|
-
config = Config.new(File.join(home, '.gritano', 'config.yml'))
|
31
|
-
if config.ssh
|
32
|
-
return config.ssh
|
33
|
-
else
|
34
|
-
return false
|
35
|
-
end
|
36
|
-
else
|
37
|
-
return false
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.servername
|
42
|
-
home = Etc.getpwuid.dir
|
43
|
-
if File.exist?(File.join(home, '.gritano', 'config.yml'))
|
44
|
-
config = Config.new(File.join(home, '.gritano', 'config.yml'))
|
45
|
-
if config.ssh_servername
|
46
|
-
return config.ssh_servername
|
47
|
-
end
|
48
|
-
end
|
49
|
-
return "git@host.com"
|
50
|
-
end
|
51
|
-
|
52
|
-
add_command "help" do |params|
|
53
|
-
Ssh.help
|
54
|
-
end
|
55
|
-
|
56
|
-
add_command "install", "gritano_path" do |params|
|
57
|
-
gritano_dir, = params
|
58
|
-
FileUtils.rm_rf(File.join('/tmp', 'gritano-openssh')) if Dir.exist?(File.join('/tmp', 'gritano-openssh'))
|
59
|
-
|
60
|
-
puts "[git] Cloning"
|
61
|
-
if system "git clone git://github.com/igorbonadio/gritano-openssh.git /tmp/gritano-openssh"
|
62
|
-
puts "[build] Configuring"
|
63
|
-
if system "cd /tmp/gritano-openssh/src && ./configure"
|
64
|
-
puts "[build] Compiling"
|
65
|
-
if system "cd /tmp/gritano-openssh/src && make"
|
66
|
-
puts "[build] Installing"
|
67
|
-
if system "cd /tmp/gritano-openssh/src && make install"
|
68
|
-
sshd_config = SshdConfig::SshdConfig.read(File.join("/usr", "local", "etc", "sshd_config"))
|
69
|
-
sshd_config.AuthorizedKeysScript = File.join(gritano_dir, 'gritano-pub-key')
|
70
|
-
sshd_config.save
|
71
|
-
return "Installed"
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
return "error"
|
78
|
-
end
|
79
|
-
|
80
|
-
add_command "start" do |params|
|
81
|
-
`/usr/local/sbin/sshd`
|
82
|
-
end
|
83
|
-
|
84
|
-
add_command "stop" do |params|
|
85
|
-
pid = `ps aux | grep -e /usr/local/sbin/sshd | grep -v grep | tr -s \" \" | cut -d \" \" -f2`
|
86
|
-
`kill -9 #{pid}`
|
87
|
-
end
|
88
|
-
|
89
|
-
add_command "servername:get" do |params|
|
90
|
-
return Ssh.servername
|
91
|
-
end
|
92
|
-
|
93
|
-
add_command "servername:set", "servername" do |params|
|
94
|
-
servername, = params
|
95
|
-
home = Etc.getpwuid.dir
|
96
|
-
config = Config.new(File.join(home, '.gritano', 'config.yml'))
|
97
|
-
config.ssh_servername = servername
|
98
|
-
config.save
|
99
|
-
return "done!"
|
100
|
-
end
|
101
|
-
|
102
|
-
def method_missing(name, *args, &body)
|
103
|
-
case name.to_s
|
104
|
-
when /^get_/ then
|
105
|
-
begin
|
106
|
-
sshd_config = SshdConfig::SshdConfig.read(File.join("/usr", "local", "etc", "sshd_config"))
|
107
|
-
return sshd_config.send(name.to_s.gsub(/^get_/, ''))
|
108
|
-
rescue Exception => e
|
109
|
-
return "invalid property"
|
110
|
-
end
|
111
|
-
when /^set_/ then
|
112
|
-
sshd_config = SshdConfig::SshdConfig.read(File.join("/usr", "local", "etc", "sshd_config"))
|
113
|
-
sshd_config.send("#{name.to_s.gsub(/^set_/, '')}=", args[0])
|
114
|
-
sshd_config.save
|
115
|
-
return "property #{name.to_s.gsub(/^set_/, '')} updated"
|
116
|
-
end
|
117
|
-
raise NoMethodError
|
118
|
-
end
|
119
|
-
|
120
|
-
end
|
121
|
-
end
|
data/spec/plugin_spec.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
module Gritano
|
4
|
-
describe Plugin do
|
5
|
-
it "should have an on_add method" do
|
6
|
-
Plugin.new.should respond_to :on_add
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should have an on_remove method" do
|
10
|
-
Plugin.new.should respond_to :on_remove
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should have an exec method" do
|
14
|
-
Plugin.new.should respond_to :exec
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should have an info method" do
|
18
|
-
Plugin.should respond_to :info
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should raise an NotImplementedError if on_add is not overrided" do
|
22
|
-
lambda { Plugin.new.on_add }.should raise_error NotImplementedError
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should raise an NotImplementedError if on_remove is not overrided" do
|
26
|
-
lambda { Plugin.new.on_remove }.should raise_error NotImplementedError
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should raise an NotImplementedError if info is not overrided" do
|
30
|
-
lambda { Plugin.info }.should raise_error NotImplementedError
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should exec commands" do
|
34
|
-
plugin = Plugin.new
|
35
|
-
plugin.should_receive(:config_port).with(["2222"])
|
36
|
-
plugin.exec("config:port 2222".split(" "))
|
37
|
-
|
38
|
-
plugin.should_receive(:start).with([])
|
39
|
-
plugin.exec("start".split(" "))
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should have a ssh pluging" do
|
43
|
-
Plugin.list['ssh'][:klass].should be == Ssh
|
44
|
-
Plugin.list['ssh'][:installed].call.should be == false
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should call on_remove when it receives remove" do
|
48
|
-
plugin = Plugin.new
|
49
|
-
plugin.should_receive(:on_remove)
|
50
|
-
plugin.remove
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should call on_add when it receives add" do
|
54
|
-
plugin = Plugin.new
|
55
|
-
plugin.should_receive(:on_add)
|
56
|
-
plugin.add
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should not be installed" do
|
60
|
-
Plugin.check_install.should be_false
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
64
|
-
end
|
data/spec/plugin_ssh_spec.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
module Gritano
|
4
|
-
describe Ssh do
|
5
|
-
it "should show information" do
|
6
|
-
Ssh.info.should be == "It installs a patched OpenSSH version used by Gritano that enables SSH lookup for public keys in a database"
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should show the help" do
|
10
|
-
Console.remote_console(false)
|
11
|
-
Ssh.help.should be == File.open("features/data/ssh_help.txt").readlines.join.
|
12
|
-
gsub('{{VERSION}}', File.open("VERSION").readlines.join)
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|