optimacms_backups 0.0.7 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0dca7af7af28b257339d7b1775848a22f238b52d
4
- data.tar.gz: 5f391cb39b0e1fdb2f5096ed2bbddf1bd0dcd7ac
3
+ metadata.gz: 07aef140d507091d5322b8336d3b77a84ce1c59a
4
+ data.tar.gz: b72efb9b4b21dbd234ea75806a316b2a7652e745
5
5
  SHA512:
6
- metadata.gz: 0691680ede606353c7c2f15e6bcf6d2bd84861a3c370d18f317cac84ed09b9d9ae92d36e5279e8a01c81110cac2a2e6d4dbd2d1aa34fa1ca6d2c24484eaa7ff7
7
- data.tar.gz: 73690830181787aee0e2efd5a2861d6f5565108770b3988c18a0def4bf575cab897833a58dbe1b5bd01f302874f9b94e2b854d8cd9d302d0e9474b1838fbb055
6
+ metadata.gz: 083bff282515c0b41e69e0dd0e49d1d8ec64614d6543e977fdb1d26e07fed7f0b595cf6f7bc274ff5461835c364f6c63a52bebf266c8fc56521dba96627189ca
7
+ data.tar.gz: f51f651e622d467edcd59ec42f7f017a4f35e392abf2dfd93283b0c7116117d2425d7013c129e1ebb59893f261fdc12241ae218334e00010b3ad94a986928377
@@ -94,7 +94,7 @@ class OptimacmsBackups::Admin::BackupsController < Optimacms::Admin::AdminBaseC
94
94
  end
95
95
 
96
96
  def perform_backup(t)
97
- cmd = %Q(app_env=#{Rails.env} backup perform -t #{t}_backup --root-path backup 2>&1)
97
+ cmd = %Q(app_env=#{Rails.env} RAILS_ENV=#{Rails.env} bundle exec backup perform -t #{t}_backup --root-path backup 2>&1)
98
98
 
99
99
  output = ''
100
100
 
@@ -140,6 +140,24 @@ require_relative 'init'
140
140
  # mail.encryption = :starttls
141
141
  end
142
142
 
143
+
144
+ Notifier::Slack.defaults do |p|
145
+ if $backup_config['notify'] && $backup_config['notify']['slack']
146
+ c = $backup_config['notify']['slack']
147
+
148
+ p.on_success = c['success'].nil? ? true : c['success']
149
+ p.on_warning = c['warning'].nil? ? true : c['warning']
150
+ p.on_failure = c['failure'].nil? ? true : c['failure']
151
+
152
+ # The integration token
153
+ p.webhook_url = c['webhook_url']
154
+ p.channel = c['channel'] if c['channel']
155
+ p.username = c['username'] if c['username']
156
+ end
157
+
158
+ end
159
+
160
+
143
161
  ##
144
162
  # Preconfigured Models
145
163
  #
@@ -7,7 +7,6 @@ root = File.absolute_path(File.dirname(__FILE__))
7
7
  current_dir = File.dirname(__FILE__)
8
8
 
9
9
  #
10
- #$backup_config = YAML.load_file(File.join(current_dir, 'config', "#{$app_env}.yml"))
11
10
  #$backup_config = YAML.load_file(File.join(Rails.root, 'config', 'backup', "#{$app_env}.yml"))
12
11
  $backup_config = YAML.load_file(File.join(current_dir, '../config/backup', "#{$app_env}.yml"))
13
12
  #$backup_config = OptimacmsBackups.backups_config
@@ -29,8 +28,6 @@ app_rails_secrets = YAML.load_file("#{$app_config[:path]}config/secrets.yml")[$r
29
28
  # db
30
29
  $db_config = app_rails_secrets
31
30
 
32
- #puts "db: #{$db_config}"
33
-
34
31
 
35
32
  # smtp
36
33
  $smtp_config = app_rails_secrets['smtp']
@@ -15,13 +15,9 @@ Model.new(:app_files_backup, 'App files') do
15
15
  dir_app = $app_config[:path]
16
16
 
17
17
 
18
- #archive.add "/path/to/a/file.rb"
19
- archive.add "#{dir_app}"
18
+ #archive.add "#{dir_app}"
20
19
 
21
20
  in_dirs = ($backup_config['backup']['app_files']['include'] rescue []) || []
22
-
23
- ignore_dirs = %w[.idea .git .vagrant .ansible .chef backup]
24
- ex_dirs_base = %w[tmp log public/assets public/images public/uploads ]
25
21
  ex_dirs = ($backup_config['backup']['app_files']['exclude'] rescue []) || []
26
22
 
27
23
  (in_dirs).each do |d|
@@ -29,7 +25,7 @@ Model.new(:app_files_backup, 'App files') do
29
25
  archive.add dpath
30
26
  end
31
27
 
32
- (ex_dirs_base+ignore_dirs+ex_dirs).each do |d|
28
+ (ex_dirs).each do |d|
33
29
  dpath = (d=~ /^\//) ? d : "#{dir_app}#{d}"
34
30
  archive.exclude dpath
35
31
  end
@@ -80,10 +76,19 @@ Model.new(:app_files_backup, 'App files') do
80
76
 
81
77
  ### notify
82
78
 
83
- notify_by Mail do |mail|
84
- c = $smtp_config
79
+ if $backup_config['notify']['mail']
85
80
 
81
+ notify_by Mail do |mail|
82
+ c = $smtp_config
86
83
 
84
+ end
87
85
  end
88
86
 
87
+ if $backup_config['notify']['slack']
88
+ notify_by Slack do |slack|
89
+
90
+ end
91
+ end
92
+
93
+
89
94
  end
@@ -53,10 +53,19 @@ Model.new(:db_backup, 'Backup DB of Rails app') do
53
53
 
54
54
  ### notify
55
55
 
56
- notify_by Mail do |mail|
57
- c = $smtp_config
56
+ if $backup_config['notify']['mail']
58
57
 
58
+ notify_by Mail do |mail|
59
+ c = $smtp_config
59
60
 
61
+ end
62
+ end
63
+
64
+ if $backup_config['notify']['slack']
65
+ notify_by Slack do |slack|
66
+
67
+ end
60
68
  end
61
69
 
70
+
62
71
  end
@@ -18,9 +18,6 @@ Model.new(:user_files_backup, 'App files') do
18
18
  #archive.add "#{dir_app}"
19
19
 
20
20
  in_dirs = ($backup_config['backup']['user_files']['include'] rescue []) || []
21
-
22
- ignore_dirs = %w[.idea .git .vagrant .ansible .chef]
23
- ex_dirs_base = %w[tmp log ]
24
21
  ex_dirs = ($backup_config['backup']['user_files']['exclude'] rescue []) || []
25
22
 
26
23
  (in_dirs).each do |d|
@@ -28,7 +25,7 @@ Model.new(:user_files_backup, 'App files') do
28
25
  archive.add dpath
29
26
  end
30
27
 
31
- (ignore_dirs+ex_dirs_base+ex_dirs).each do |d|
28
+ (ex_dirs).each do |d|
32
29
  dpath = (d=~ /^\//) ? d : "#{dir_app}#{d}"
33
30
  archive.exclude dpath
34
31
  end
@@ -79,10 +76,19 @@ Model.new(:user_files_backup, 'App files') do
79
76
 
80
77
  ### notify
81
78
 
82
- notify_by Mail do |mail|
83
- c = $smtp_config
79
+ if $backup_config['notify']['mail']
84
80
 
81
+ notify_by Mail do |mail|
82
+ c = $smtp_config
85
83
 
84
+ end
86
85
  end
87
86
 
87
+ if $backup_config['notify']['slack']
88
+ notify_by Slack do |slack|
89
+
90
+ end
91
+ end
92
+
93
+
88
94
  end
@@ -1,3 +1,3 @@
1
1
  module OptimacmsBackups
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.12"
3
3
  end
@@ -0,0 +1,22 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rails secret` to generate a secure secret key.
9
+
10
+ # Make sure the secrets in this file are kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ development:
14
+ secret_key_base: 37efe814db723ddec55249545b2df3f1c807bb40bcbf1509c5a5320facd49487d6744c0a83a6459a7aaa0a949cf06708ead096516724bc91dd5a9b1c8eb1785c
15
+ devise_secret_key: 102c31806a8bd1acdebf5444d1f8f3cbf411bc1acfb6c40c92f72420d67281fc627f6b0a997a40d9ccaa0fe4a07d5dea723b90e5a2bdb4d89255121f0525c98d
16
+
17
+ db_host: 51.1.0.11
18
+ db_name: my_cms_backups
19
+ db_user: root
20
+ db_password: FriendlyDdata0
21
+
22
+
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optimacms_backups
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Ivak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-08 00:00:00.000000000 Z
11
+ date: 2017-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: backup
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: backup-remote
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
41
69
  description: Backups manager module for Optima CMS.
42
70
  email:
43
71
  - max.ivak@gmail.com
@@ -106,7 +134,9 @@ files:
106
134
  - spec/dummy/config/locales/en.yml
107
135
  - spec/dummy/config/routes.rb
108
136
  - spec/dummy/config/schedule.rb
137
+ - spec/dummy/config/secrets.yml
109
138
  - spec/dummy/lib/optimacms/admin_menu/admin_menu.rb
139
+ - spec/dummy/log/development.log
110
140
  - spec/dummy/public/404.html
111
141
  - spec/dummy/public/422.html
112
142
  - spec/dummy/public/500.html
@@ -131,51 +161,53 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
161
  version: '0'
132
162
  requirements: []
133
163
  rubyforge_project:
134
- rubygems_version: 2.4.8
164
+ rubygems_version: 2.6.12
135
165
  signing_key:
136
166
  specification_version: 4
137
167
  summary: Backups for OptimaCMS.
138
168
  test_files:
139
- - spec/dummy/bin/rake
140
169
  - spec/dummy/bin/setup
141
- - spec/dummy/bin/rails
170
+ - spec/dummy/bin/rake
142
171
  - spec/dummy/bin/bundle
143
- - spec/dummy/public/favicon.ico
144
- - spec/dummy/public/422.html
172
+ - spec/dummy/bin/rails
173
+ - spec/dummy/log/development.log
145
174
  - spec/dummy/public/500.html
175
+ - spec/dummy/public/favicon.ico
146
176
  - spec/dummy/public/404.html
147
- - spec/dummy/Rakefile
148
- - spec/dummy/app/controllers/application_controller.rb
149
- - spec/dummy/app/controllers/debug_controller.rb
150
- - spec/dummy/app/assets/javascripts/application.js
151
- - spec/dummy/app/assets/stylesheets/application.css
152
- - spec/dummy/app/helpers/application_helper.rb
153
- - spec/dummy/app/views/layouts/application.html.erb
154
- - spec/dummy/config.ru
155
- - spec/dummy/lib/optimacms/admin_menu/admin_menu.rb
156
- - spec/dummy/config/locales/en.yml
157
- - spec/dummy/config/locales/devise.en.yml
158
- - spec/dummy/config/environment.rb
159
- - spec/dummy/config/routes.rb
177
+ - spec/dummy/public/422.html
160
178
  - spec/dummy/config/schedule.rb
161
- - spec/dummy/config/environments/test.rb
162
- - spec/dummy/config/environments/production.rb
163
- - spec/dummy/config/environments/development.rb
164
- - spec/dummy/config/boot.rb
165
- - spec/dummy/config/application.rb
166
- - spec/dummy/config/database.yml
167
- - spec/dummy/config/backup/development.yml
168
- - spec/dummy/config/initializers/assets.rb
169
- - spec/dummy/config/initializers/simple_form.rb
170
- - spec/dummy/config/initializers/mime_types.rb
171
- - spec/dummy/config/initializers/optimacms.rb
172
- - spec/dummy/config/initializers/backtrace_silencers.rb
179
+ - spec/dummy/config/environment.rb
180
+ - spec/dummy/config/secrets.yml
173
181
  - spec/dummy/config/initializers/wrap_parameters.rb
174
182
  - spec/dummy/config/initializers/devise.rb
183
+ - spec/dummy/config/initializers/redis.rb
175
184
  - spec/dummy/config/initializers/cookies_serializer.rb
185
+ - spec/dummy/config/initializers/mime_types.rb
176
186
  - spec/dummy/config/initializers/kaminari_config.rb
177
- - spec/dummy/config/initializers/session_store.rb
187
+ - spec/dummy/config/initializers/simple_form.rb
178
188
  - spec/dummy/config/initializers/filter_parameter_logging.rb
179
189
  - spec/dummy/config/initializers/inflections.rb
190
+ - spec/dummy/config/initializers/session_store.rb
191
+ - spec/dummy/config/initializers/optimacms.rb
192
+ - spec/dummy/config/initializers/assets.rb
180
193
  - spec/dummy/config/initializers/simple_form_bootstrap.rb
181
- - spec/dummy/config/initializers/redis.rb
194
+ - spec/dummy/config/initializers/backtrace_silencers.rb
195
+ - spec/dummy/config/routes.rb
196
+ - spec/dummy/config/environments/development.rb
197
+ - spec/dummy/config/environments/test.rb
198
+ - spec/dummy/config/environments/production.rb
199
+ - spec/dummy/config/backup/development.yml
200
+ - spec/dummy/config/locales/devise.en.yml
201
+ - spec/dummy/config/locales/en.yml
202
+ - spec/dummy/config/boot.rb
203
+ - spec/dummy/config/application.rb
204
+ - spec/dummy/config/database.yml
205
+ - spec/dummy/lib/optimacms/admin_menu/admin_menu.rb
206
+ - spec/dummy/config.ru
207
+ - spec/dummy/Rakefile
208
+ - spec/dummy/app/controllers/debug_controller.rb
209
+ - spec/dummy/app/controllers/application_controller.rb
210
+ - spec/dummy/app/helpers/application_helper.rb
211
+ - spec/dummy/app/assets/stylesheets/application.css
212
+ - spec/dummy/app/assets/javascripts/application.js
213
+ - spec/dummy/app/views/layouts/application.html.erb