irgat 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +11 -5
- data/Manifest.txt +2 -0
- data/README.rdoc +2 -1
- data/bin/irgat +4 -0
- data/lang/help_cmd_en.rb +51 -0
- data/lib/irgat.rb +16 -4
- data/lib/irgat/dependencies.rb +1 -1
- data/lib/irgat/execs.rb +2 -2
- data/lib/irgat/help.rb +52 -0
- data/lib/irgat/log.rb +2 -2
- data/lib/irgat/version.rb +1 -1
- data/script/txt2html +1 -1
- data/website/index.html +3 -6
- metadata +4 -2
data/History.txt
CHANGED
@@ -1,14 +1,20 @@
|
|
1
|
+
|
2
|
+
== 0.0.3 2008-11-5
|
3
|
+
|
4
|
+
* ChangeLog:
|
5
|
+
* Fixed some !@log methods
|
6
|
+
* Fixed output_log to Irgat::Irgat process
|
7
|
+
* Implemented in gem the help module
|
8
|
+
|
1
9
|
== 0.0.2 2008-11-3
|
2
10
|
|
3
|
-
*
|
11
|
+
* ChangeLog:
|
4
12
|
* Fixed Purge and Move old Backups method
|
5
13
|
* Implemented new methods
|
6
|
-
|
7
|
-
* Irgat Base:
|
14
|
+
* Irgat Base:
|
8
15
|
* Fixed bug in log Module (!@log error)
|
9
16
|
* Fixed commands_launched resume (!@command_log)
|
10
|
-
|
11
|
-
* Intituive
|
17
|
+
* Intituive
|
12
18
|
* Added some colors in cmd
|
13
19
|
|
14
20
|
== 0.0.1 2008-10-24
|
data/Manifest.txt
CHANGED
@@ -9,10 +9,12 @@ bin/irgat_setup
|
|
9
9
|
bin/irgat_updater
|
10
10
|
config/hoe.rb
|
11
11
|
config/requirements.rb
|
12
|
+
lang/help_cmd_en.rb
|
12
13
|
lib/irgat.rb
|
13
14
|
lib/irgat/console.rb
|
14
15
|
lib/irgat/dependencies.rb
|
15
16
|
lib/irgat/execs.rb
|
17
|
+
lib/irgat/help.rb
|
16
18
|
lib/irgat/log.rb
|
17
19
|
lib/irgat/mail.rb
|
18
20
|
lib/irgat/utils.rb
|
data/README.rdoc
CHANGED
data/bin/irgat
CHANGED
@@ -39,8 +39,12 @@ begin
|
|
39
39
|
require 'rdoc/markup/simple_markup/to_flow'
|
40
40
|
require 'rdoc/ri/ri_formatter'
|
41
41
|
require 'rdoc/ri/ri_options'
|
42
|
+
# Email sender
|
42
43
|
require 'net/smtp'
|
43
44
|
require 'tmail'
|
45
|
+
# Ssh connections
|
46
|
+
require 'termios'
|
47
|
+
require 'net/ssh'
|
44
48
|
# irgat Base
|
45
49
|
require 'irgat'
|
46
50
|
rescue LoadError => msj
|
data/lang/help_cmd_en.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
#= Index
|
2
|
+
#
|
3
|
+
# IRGAT::Irgat Class
|
4
|
+
# ----------------
|
5
|
+
# get more info typing @your_object.help '<reference word>'
|
6
|
+
#
|
7
|
+
# * Config:
|
8
|
+
# - load_options # Load a hash of options taked from a yml config file
|
9
|
+
# - subsytems # print info about the subsytems in irgat
|
10
|
+
#
|
11
|
+
# * Check utility:
|
12
|
+
# - check_programs # check the availability of an array commands names
|
13
|
+
# - check_tree_for # check a tree for a subsytem
|
14
|
+
# - check_mounted_folder # check if a folder is mounted
|
15
|
+
#
|
16
|
+
# * Logging:
|
17
|
+
# - set_log_output_to_file # set log to a specifed file or default
|
18
|
+
# - log # log a formated text to default log output
|
19
|
+
# - init_info # log init info for a irgat process
|
20
|
+
# - process_report # log information about the state of a process
|
21
|
+
#
|
22
|
+
# * Exec:
|
23
|
+
# - execute_command # exec a command, log it, and control output
|
24
|
+
#
|
25
|
+
# * Help:
|
26
|
+
# - help # info about the help method helpper
|
27
|
+
#
|
28
|
+
#
|
29
|
+
#= Usage
|
30
|
+
#
|
31
|
+
# irgat -v || --version || version # display version information and exit
|
32
|
+
# irgat -h || --help || help # display help and exit
|
33
|
+
# irgat < args > # process an irgat petition
|
34
|
+
#
|
35
|
+
# Options
|
36
|
+
# -w || --without_output # no output to standin out
|
37
|
+
# -d <debug_level> || --debug_level <debug_level> # override config debug level
|
38
|
+
#
|
39
|
+
# ---------------------
|
40
|
+
# irgat works like a modular tool. For example, the syntaxis for a backup is:
|
41
|
+
# $: irgat backup launch
|
42
|
+
#
|
43
|
+
#= License
|
44
|
+
#
|
45
|
+
# IRGAT (Intuitive Ruby for Gnoxys Administration Tools)
|
46
|
+
# 2007 - 2008 Gnoxys. info@gnoxys.net
|
47
|
+
# This program is released under the terms of the GPL v3 license as you cand find in http://www.gnu.org/licenses/gpl.html
|
48
|
+
#
|
49
|
+
#= Mierda
|
50
|
+
#
|
51
|
+
# no content
|
data/lib/irgat.rb
CHANGED
@@ -145,10 +145,22 @@ module Irgat
|
|
145
145
|
|
146
146
|
# method to load the config options for a module and return a hash symbol
|
147
147
|
def load_config(config_file = nil)
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
148
|
+
module_name = self.class.to_s.downcase.split('::').last
|
149
|
+
config_file ||= "#{ IRGAT_CONFIG }/#{ module_name }.yml"
|
150
|
+
|
151
|
+
if test(?e,config_file)
|
152
|
+
config_yml = YAML.load_file(config_file )
|
153
|
+
# parse to symbols the config options
|
154
|
+
config_to_symbols = Hash.new
|
155
|
+
config_yml.each{|k, v| config_to_symbols[k.to_sym] = v}
|
156
|
+
else
|
157
|
+
log("warning", "No config '#{ config_file } found. Loading module with empty config", 2)
|
158
|
+
config_to_symbols = {:subsystem_name => module_name,
|
159
|
+
:subsystem_description => "Irgat #{ module_name } module",
|
160
|
+
:log_file_actions => [],
|
161
|
+
:log_mail_actions => []
|
162
|
+
}
|
163
|
+
end
|
152
164
|
config_to_symbols
|
153
165
|
end
|
154
166
|
|
data/lib/irgat/dependencies.rb
CHANGED
@@ -64,7 +64,7 @@ module Irgat
|
|
64
64
|
"Getting irgat launcher user",
|
65
65
|
{ :debug => 3 })
|
66
66
|
if user != command[:output].strip
|
67
|
-
exit_with_error("#{ @config_module[:subsystem_name] }
|
67
|
+
exit_with_error("Irgat '#{ @config_module[:subsystem_name] }' module must run as #{ user } user")
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
data/lib/irgat/execs.rb
CHANGED
@@ -56,10 +56,10 @@ module Irgat
|
|
56
56
|
def exit_with_error(msj, options = {})
|
57
57
|
log("error", msj, 1)
|
58
58
|
|
59
|
-
|
59
|
+
# output unless irgat is not running a module
|
60
60
|
output_log(self,
|
61
61
|
{ :main_msj => "[IRGAT] [#{ self.config_module[:subsystem_name].capitalize }] [ERROR] #{ self.action } process in #{ @config[:server_name] }",
|
62
|
-
:fatal => true })
|
62
|
+
:fatal => true }) unless self.class.to_s == "Irgat::Irgat"
|
63
63
|
|
64
64
|
exit (options[:exit_level] ? options[:exit_level] : 1)
|
65
65
|
end
|
data/lib/irgat/help.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# add utils to irgat::irgat class
|
2
|
+
|
3
|
+
module Irgat
|
4
|
+
module Help
|
5
|
+
|
6
|
+
def show_help(pattern, exit_irgat = false)
|
7
|
+
help_file = IRGAT_LANG + "/help_cmd_#{ @config[:lang] }.rb"
|
8
|
+
if ! test(?e, help_file)
|
9
|
+
puts "Help file #{ help_file } not found. Check the install or choose another language in your irgat config file"
|
10
|
+
puts "Loading default Lang"
|
11
|
+
help_file = IRGAT_LANG + "/help_cmd_en.rb"
|
12
|
+
end
|
13
|
+
|
14
|
+
#get comments in file
|
15
|
+
comment = File.open(help_file) do |file|
|
16
|
+
RDoc.find_comment(file)
|
17
|
+
end
|
18
|
+
|
19
|
+
# parse it, and create needed objects
|
20
|
+
comment = comment.gsub(/^\s*#/, '')
|
21
|
+
markup = SM::SimpleMarkup.new
|
22
|
+
flow_convertor = SM::ToFlow.new
|
23
|
+
flow = markup.convert(comment, flow_convertor)
|
24
|
+
|
25
|
+
#define output format
|
26
|
+
format = "plain"
|
27
|
+
#index help if nothing was wrotten
|
28
|
+
pattern = (pattern.length == 0 ? 'index' : pattern.to_s)
|
29
|
+
|
30
|
+
#i don't want output in these...
|
31
|
+
$stdout = File.new('/dev/null',"w+")
|
32
|
+
searched_flow = RDoc.extract_sections(flow, pattern)
|
33
|
+
#retake output
|
34
|
+
$stdout = STDOUT
|
35
|
+
|
36
|
+
# i don't like the rdoc way to return the things... it is assumed, that if you don't found your desired section, you want to see all!! O_o
|
37
|
+
if flow == searched_flow
|
38
|
+
puts "[ Error ] No section founded for your petition #{ pattern }"
|
39
|
+
puts "Try a diffent pattern search or try $ irgat help without search pattern to view a list of avaibles sections"
|
40
|
+
else
|
41
|
+
#we have found, render it
|
42
|
+
options = RI::Options.instance
|
43
|
+
if args = ENV["RI"]
|
44
|
+
options.parse(args.split)
|
45
|
+
end
|
46
|
+
formatter = options.formatter.new(options, "")
|
47
|
+
formatter.display_flow(searched_flow)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
data/lib/irgat/log.rb
CHANGED
@@ -111,7 +111,7 @@ module Irgat
|
|
111
111
|
end
|
112
112
|
|
113
113
|
if fatal
|
114
|
-
report_resume << "\n [ **FATAL** ] -> Irgat Process ended in command: '#{ module_process.commands_launched.last.keys.to_s }'"
|
114
|
+
report_resume << "\n [ **FATAL** ] -> Irgat Process ended in command: '#{ module_process.commands_launched.last.keys.to_s }'" unless !module_process.commands_launched
|
115
115
|
end
|
116
116
|
|
117
117
|
return report_resume
|
@@ -124,7 +124,7 @@ module Irgat
|
|
124
124
|
when "error"
|
125
125
|
return_msj = "\n \x1b[#{ 38 };5;#{ 160 }m#{ "ERROR!!" } \x1b[0m" + log_entry[:msj].gsub(/#{ "FATAL" }/, "\x1b[#{38};5;#{ 160 }m#{ "*FATAL*" }\x1b[0m")
|
126
126
|
when "warning"
|
127
|
-
return_msj = "\x1b[#{ 38 };5;#{ 240 }m#{ log_entry[:msj] }\x1b[0m"
|
127
|
+
return_msj = "\n \x1b[#{ 38 };5;#{ 220 }m#{ "WARNING" } \x1b[0m \x1b[#{ 38 };5;#{ 240 }m#{ log_entry[:msj] }\x1b[0m"
|
128
128
|
when "point"
|
129
129
|
return_msj = "\n\x1b[#{ 48 };5;#{ 252 }m#{ log_entry[:msj] }\x1b[0m \n"
|
130
130
|
when "command"
|
data/lib/irgat/version.rb
CHANGED
data/script/txt2html
CHANGED
@@ -17,7 +17,7 @@ require 'syntax/convertors/html'
|
|
17
17
|
require 'erb'
|
18
18
|
require File.dirname(__FILE__) + "/../lib/#{GEM_NAME}/version.rb"
|
19
19
|
|
20
|
-
version = Irgat::
|
20
|
+
version = "#{::Irgat::Version}"
|
21
21
|
download = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
22
22
|
|
23
23
|
def rubyforge_project_id
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>irgat</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/irgat"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/irgat" class="numbers">0.0.
|
36
|
+
<a href="http://rubyforge.org/projects/irgat" class="numbers">0.0.2</a>
|
37
37
|
</div>
|
38
38
|
<h1>&#x2192; ‘irgat’</h1>
|
39
39
|
<h2>What</h2>
|
@@ -51,12 +51,9 @@
|
|
51
51
|
<p><span class="caps">OOOORRRR</span></p>
|
52
52
|
<p>You can fetch the source from either:</p>
|
53
53
|
<ul>
|
54
|
-
<li>rubyforge: <
|
54
|
+
<li>rubyforge: <a href="http://rubyforge.org/scm/?group_id=7188">http://rubyforge.org/scm/?group_id=7188</a></li>
|
55
55
|
</ul>
|
56
|
-
<
|
57
|
-
yet to refresh your local rubyforge data with this projects’ id information.</p>
|
58
|
-
<p>When you do this, this message will magically disappear!</p>
|
59
|
-
<p>Or you can hack website/index.txt and make it all go away!!</p>
|
56
|
+
<pre>git clone git://rubyforge.org/irgat.git</pre>
|
60
57
|
<ul>
|
61
58
|
<li>github: <a href="http://github.com/GITHUB_USERNAME/irgat/tree/master">http://github.com/GITHUB_USERNAME/irgat/tree/master</a></li>
|
62
59
|
</ul>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: irgat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gnoxys
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-11-
|
12
|
+
date: 2008-11-05 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -78,10 +78,12 @@ files:
|
|
78
78
|
- bin/irgat_updater
|
79
79
|
- config/hoe.rb
|
80
80
|
- config/requirements.rb
|
81
|
+
- lang/help_cmd_en.rb
|
81
82
|
- lib/irgat.rb
|
82
83
|
- lib/irgat/console.rb
|
83
84
|
- lib/irgat/dependencies.rb
|
84
85
|
- lib/irgat/execs.rb
|
86
|
+
- lib/irgat/help.rb
|
85
87
|
- lib/irgat/log.rb
|
86
88
|
- lib/irgat/mail.rb
|
87
89
|
- lib/irgat/utils.rb
|