jcangas-datagateway 1.4.4 → 1.5.0

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.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 4
2
+ :patch: 0
3
3
  :major: 1
4
- :minor: 4
4
+ :minor: 5
@@ -54,11 +54,12 @@ module DataGateway
54
54
  import_file(filename)
55
55
  FileUtils.mv(filename, DataGateway::donebox)
56
56
  DataGateway.logger.info "Import done for #{filename}"
57
- end
57
+ end
58
58
  DataGateway.last_time['import'] = new_last_time
59
+ clean_donebox
59
60
  end
60
61
 
61
- def donebox
62
+ def clean_donebox
62
63
  Dir.glob(File.join(DataGateway::donebox, '*.zip')).each do |filename|
63
64
  FileUtils.rm(filename) if File.mtime(filename) < 7.days.ago
64
65
  end
@@ -220,4 +221,4 @@ module DataGateway
220
221
  end
221
222
  end
222
223
  end
223
- end
224
+ end
@@ -3,8 +3,8 @@ db_connection AppConfig.connections[:shopindb]
3
3
 
4
4
  export 'shopin_export' do
5
5
  exporting :user,
6
- :select => "login as userid, email, ' 1' as codcli",
7
- :conditions => 'activated_at is not null'
6
+ :select => "login as userid, email, '9999' as codcli",
7
+ :conditions => "(activated_at is not null) and (updated_at > '#{last_time(:export)}')"
8
8
 
9
9
  exporting :order,
10
10
  :select => 'number, reference, special_instructions, login as userid',
@@ -26,6 +26,7 @@ import 'shopin_import' do
26
26
  end
27
27
 
28
28
  importing :User do
29
+ force_downcase
29
30
  identity_by :login
30
31
  end
31
32
 
data/lib/datagateway.rb CHANGED
@@ -157,13 +157,13 @@ class AppConfig
157
157
  def command_generate
158
158
  target = File.expand_path(@options.project)
159
159
  FileUtils.mkdir target
160
- puts "generating #{target}"
160
+ echo "generating #{target}"
161
161
  FileUtils.cp_r(File.join(AppConfig::GEMROOT, '..', 'template-prj', "#{@options.template}/."), target, :verbose => !@options.quiet)
162
162
  end
163
163
 
164
164
  def command_job
165
165
  echo version_msg
166
- AppConfig.logger.info echo("Data Gateway started")
166
+ AppConfig.logger.info echo("#{Application::VERSION::PRODUCT} started")
167
167
  #AppConfig.logger.debug echo("configuración: #{AppConfig.config.inspect}")
168
168
 
169
169
  require 'activerecord'
@@ -176,19 +176,20 @@ class AppConfig
176
176
  DataGateway.outbox = AppConfig.path(AppConfig.data['outbox'])
177
177
  DataGateway.donebox = AppConfig.path(AppConfig.data['donebox'])
178
178
  DataGateway.use_resources = AppConfig.data['use_resources']
179
-
179
+
180
180
  DataGateway.last_time = AppConfig.last_time
181
181
  DataGateway.resource_path(AppConfig.path(AppConfig.data['resource_path']))
182
182
  DataGateway.logger.info "using resources #{DataGateway.use_resources} | #{DataGateway.resource_path}"
183
183
 
184
184
  file = @options.file
185
185
  require file
186
- ## Porque no va:?
186
+ ## Porque no va?:
187
187
  ##eval(File.read(File.expand_path(file)))
188
188
 
189
189
  AppConfig.last_time = DataGateway.last_time
190
- save
191
- AppConfig.logger.info echo("Data Gateway finished ok")
190
+ save
191
+ clean_log
192
+ AppConfig.logger.info echo("#{Application::VERSION::PRODUCT} finished ok")
192
193
 
193
194
  rescue Exception => e
194
195
  puts "Error:\n#{e}\n."
@@ -215,7 +216,13 @@ class AppConfig
215
216
 
216
217
  def log_path
217
218
  path('log/application.log')
218
- end
219
+ end
220
+
221
+ def clean_log
222
+ Dir.glob(File.join(path('log'), '*.*')).each do |filename|
223
+ FileUtils.rm(filename) if File.mtime(filename) < 7.days.ago
224
+ end
225
+ end
219
226
 
220
227
  def settings(name)
221
228
  path("config/#{name}.yml")
@@ -309,4 +316,3 @@ class AppConfig
309
316
  end
310
317
  end
311
318
  end
312
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jcangas-datagateway
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge L. Cangas
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-12 00:00:00 -08:00
12
+ date: 2009-02-13 00:00:00 -08:00
13
13
  default_executable: datagw
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency