gat 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/History.txt +84 -0
  2. data/PostInstall.txt +22 -0
  3. data/README.txt +49 -0
  4. data/Rakefile +12 -0
  5. data/bin/gat +15 -0
  6. data/lib/gat.rb +323 -0
  7. data/lib/gat/action/base.rb +197 -0
  8. data/lib/gat/action/ruby_method.rb +35 -0
  9. data/lib/gat/action/shell_command.rb +185 -0
  10. data/lib/gat/boot.rb +63 -0
  11. data/lib/gat/checks.rb +136 -0
  12. data/lib/gat/debug.rb +29 -0
  13. data/lib/gat/dependence/argument.rb +62 -0
  14. data/lib/gat/dependence/base.rb +54 -0
  15. data/lib/gat/dependence/folder.rb +104 -0
  16. data/lib/gat/dependence/program.rb +36 -0
  17. data/lib/gat/email.rb +80 -0
  18. data/lib/gat/exceptions.rb +163 -0
  19. data/lib/gat/extends.rb +102 -0
  20. data/lib/gat/help.rb +79 -0
  21. data/lib/gat/interpreter.rb +93 -0
  22. data/lib/gat/launcher.rb +100 -0
  23. data/lib/gat/logger.rb +331 -0
  24. data/lib/gat/operation.rb +253 -0
  25. data/lib/gat/version.rb +20 -0
  26. data/lib/gatgets/dar_backup/dar_backup.rb +367 -0
  27. data/lib/gatgets/dar_backup/dar_backup.yml +387 -0
  28. data/lib/gatgets/dar_backup/launcher.rb +44 -0
  29. data/lib/gatgets/dar_backup/templates/list_backups.erb +31 -0
  30. data/lib/gatgets/dar_backup/templates/search.erb +33 -0
  31. data/lib/gatgets/gatgets_manager/gatgets_manager.rb +65 -0
  32. data/lib/gatgets/gatgets_manager/gatgets_manager.yml +71 -0
  33. data/lib/gatgets/gatgets_manager/templates/list.erb +9 -0
  34. data/lib/gatgets/synchronization/README +26 -0
  35. data/lib/gatgets/synchronization/launcher.rb +20 -0
  36. data/lib/gatgets/synchronization/launcher_cron.sh +69 -0
  37. data/lib/gatgets/synchronization/synchronization.rb +123 -0
  38. data/lib/gatgets/synchronization/synchronization.yml +144 -0
  39. data/test/test_gat.rb +36 -0
  40. data/test/test_helper.rb +3 -0
  41. metadata +131 -0
@@ -0,0 +1,144 @@
1
+ description: 'Gatget for synchronizing folders with RSYNC'
2
+
3
+ server_domain: your.domain
4
+
5
+ ### STATIC SECTION ###
6
+ # These values are accessed by helpers and ruby methods like this:
7
+ # get_dependence_value("static", "variable_name")
8
+
9
+ static:
10
+ all_hosts: ['my_host']
11
+ notify_email_started:
12
+ subject: Rsync started
13
+ body: You will receive an email when the rsync is ended
14
+ my_host_remote_folder: /home/backup/
15
+ my_host_remote_host: my_host
16
+ my_host_remote_user: backup
17
+
18
+ programs:
19
+ rsync:
20
+ description: rsync
21
+ ssh:
22
+ description: ssh
23
+
24
+
25
+ ### FOLDERS SECTIONS ###
26
+ # These folders are declared here and used by operations.
27
+ # Operations must declare them again in order to use them
28
+
29
+ folders:
30
+ source:
31
+ path: ""
32
+ dest:
33
+ path: ""
34
+ my_host_local:
35
+ path: "/home/backup/rsyncs/my_host"
36
+
37
+ ### CONDITIONS SECTION ###
38
+ ###
39
+ ### WARNING: This section is no longer used
40
+
41
+
42
+ conditions:
43
+ check_enough_space_for_sync:
44
+ type: check_enough_space
45
+ arguments:
46
+ where: folders_dest
47
+ space_needed: space_needed
48
+
49
+ ### PARAMETERS SECTION ###
50
+
51
+ parameters:
52
+ space_needed:
53
+ type: eval
54
+ value: "1000"
55
+ folders_dest:
56
+ type: dependence
57
+ value: folders/dest
58
+ folders_source:
59
+ type: dependence
60
+ value: folders/source
61
+ local_folder:
62
+ type: dependence
63
+ value: variable/local_folder
64
+ remote_folder:
65
+ type: dependence
66
+ value: variable/remote_folder
67
+ remote_user:
68
+ type: dependence
69
+ value: variable/remote_user
70
+ remote_host:
71
+ type: dependence
72
+ value: variable/remote_host
73
+
74
+
75
+ ### OPERATIONS SECTION ###
76
+ # The main script is run with one of these operations as argument
77
+
78
+ operations:
79
+ do_rsync:
80
+ description: 'Synchronize from source to dest'
81
+ users: [ root ]
82
+ programs: [ rsync ]
83
+ arguments: [ ]
84
+ folders: [ source, dest ]
85
+ helpers: [ ]
86
+ conditions: [ check_enough_space_for_sync ]
87
+ actions: [ notify_start, exec_local_rsync ]
88
+ outputs: [ email ]
89
+ onfail: [ ]
90
+ options:
91
+ verbose: 1
92
+ debug: true
93
+
94
+ sync_oyw:
95
+ description: 'Sincronización de datos de openyourweb'
96
+ users: [ root ]
97
+ programs: [ rsync, ssh ]
98
+ arguments: [ ]
99
+ helpers: [ exit_if_i_am_running ]
100
+ actions: [ exec_sync_oyw ]
101
+ outputs: [ email ]
102
+ onfail: [ ]
103
+ options:
104
+ verbose: 1
105
+ debug: true
106
+
107
+ sync_my_host:
108
+ description: 'Synchronize my_host'
109
+ users: [ root ]
110
+ programs: [ rsync ]
111
+ # These folders are checked and created if they don't exist
112
+ folders: [ my_host_local ]
113
+ arguments: [ ]
114
+ # Helpers are used mainly to set flags
115
+ helpers: [ set_parameters_for_my_host ]
116
+ # Actions
117
+ actions: [ check_host_defined, setflag_remote_backup_running, exec_remote_rsync ]
118
+ outputs: [ ]
119
+ onfail: [ ]
120
+ options:
121
+ verbose: 1
122
+ debug: true
123
+
124
+
125
+ actions:
126
+ notify_start:
127
+ type: ruby_method
128
+ exec_local_rsync:
129
+ type: shell_command
130
+ syntax: "rsync -az --delete {{folders_source}} {{folders_dest}}"
131
+ check_host_defined:
132
+ type: ruby_method
133
+ check_remote_backup_status:
134
+ type: shell_command
135
+ syntax: "ssh {{remote_user}}@{{remote_host}} /usr/local/sbin/status_dar_backup.sh"
136
+ setflag_remote_backup_running:
137
+ type: ruby_method
138
+ exec_remote_rsync:
139
+ type: shell_command
140
+ syntax: "rsync -az --delete {{remote_user}}@{{remote_host}}:{{remote_folder}} {{local_folder}}"
141
+ flags: [ "!flag_remote_backup_running" ]
142
+ exec_sync_oyw:
143
+ type: ruby_method
144
+
data/test/test_gat.rb ADDED
@@ -0,0 +1,36 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+
4
+ # define Test Class
5
+ GATGET_TESTER_ROOT = File.expand_path(File.dirname(__FILE__))
6
+ class GatgetTester < Gat::Base
7
+
8
+ def test_ruby_method
9
+ 'tested'
10
+ end
11
+ end
12
+
13
+
14
+ class TesterLauncher < GatgetTester
15
+ end
16
+
17
+ class TestGat < Test::Unit::TestCase
18
+
19
+ def setup
20
+ end
21
+
22
+ def test_gat
23
+
24
+ # Testing is done with a testing yml File
25
+ # so, process it!!!
26
+ test_options = { 'config_file_name' => "#{ GATGET_TESTER_ROOT }/test.yml" }
27
+ TesterLauncher.launch(test_options, ['test'])
28
+
29
+
30
+
31
+ assert true
32
+ end
33
+
34
+ def test_de
35
+ end
36
+ end
@@ -0,0 +1,3 @@
1
+ require 'stringio'
2
+ require 'test/unit'
3
+ require File.dirname(__FILE__) + '/../lib/gat'
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.8
5
+ platform: ruby
6
+ authors:
7
+ - gnoxys
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-02-17 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rubyforge
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.0.3
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: gemcutter
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.0
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: hoe
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 2.5.0
44
+ version:
45
+ description: |-
46
+ GAT is a Ruby gem that tries to provide a script fast development framework.
47
+
48
+ Based on a YML structure, GAT allows you to write basic and advanced scripts with a whole set of tools that scripting need.
49
+
50
+ More info can be found at http://gat.rubyforge.org
51
+ email:
52
+ - soporte@gnoxys.net
53
+ executables:
54
+ - gat
55
+ extensions: []
56
+
57
+ extra_rdoc_files:
58
+ - History.txt
59
+ - PostInstall.txt
60
+ - README.txt
61
+ files:
62
+ - History.txt
63
+ - PostInstall.txt
64
+ - README.txt
65
+ - Rakefile
66
+ - bin/gat
67
+ - lib/gat.rb
68
+ - lib/gat/action/base.rb
69
+ - lib/gat/action/shell_command.rb
70
+ - lib/gat/action/ruby_method.rb
71
+ - lib/gat/boot.rb
72
+ - lib/gat/checks.rb
73
+ - lib/gat/debug.rb
74
+ - lib/gat/dependence/argument.rb
75
+ - lib/gat/dependence/base.rb
76
+ - lib/gat/dependence/folder.rb
77
+ - lib/gat/dependence/program.rb
78
+ - lib/gat/email.rb
79
+ - lib/gat/exceptions.rb
80
+ - lib/gat/extends.rb
81
+ - lib/gat/help.rb
82
+ - lib/gat/interpreter.rb
83
+ - lib/gat/launcher.rb
84
+ - lib/gat/logger.rb
85
+ - lib/gat/operation.rb
86
+ - lib/gat/version.rb
87
+ - lib/gatgets/dar_backup/dar_backup.rb
88
+ - lib/gatgets/dar_backup/dar_backup.yml
89
+ - lib/gatgets/dar_backup/launcher.rb
90
+ - lib/gatgets/dar_backup/templates/list_backups.erb
91
+ - lib/gatgets/dar_backup/templates/search.erb
92
+ - lib/gatgets/gatgets_manager/gatgets_manager.rb
93
+ - lib/gatgets/gatgets_manager/gatgets_manager.yml
94
+ - lib/gatgets/gatgets_manager/templates/list.erb
95
+ - lib/gatgets/synchronization/synchronization.rb
96
+ - lib/gatgets/synchronization/synchronization.yml
97
+ - lib/gatgets/synchronization/launcher_cron.sh
98
+ - lib/gatgets/synchronization/launcher.rb
99
+ - lib/gatgets/synchronization/README
100
+ has_rdoc: true
101
+ homepage:
102
+ licenses: []
103
+
104
+ post_install_message:
105
+ rdoc_options:
106
+ - --main
107
+ - README.txt
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: "0"
115
+ version:
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: "0"
121
+ version:
122
+ requirements: []
123
+
124
+ rubyforge_project: gat
125
+ rubygems_version: 1.3.5
126
+ signing_key:
127
+ specification_version: 3
128
+ summary: GAT is a Ruby gem that tries to provide a script fast development framework
129
+ test_files:
130
+ - test/test_gat.rb
131
+ - test/test_helper.rb