resque-reports 0.0.2 → 0.3.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/spec/spec_helper.rb CHANGED
@@ -1,75 +1,10 @@
1
- # -*- encoding : utf-8 -*-
2
- # - Sort through your spec_helper file. Place as much environment loading
3
- # code that you don't normally modify during development in the
4
- # Spork.prefork block.
5
- # - Place the rest under Spork.each_run block
6
- # - Any code that is left outside of the blocks will be ran during preforking
7
- # and during each_run!
8
- # - These instructions should self-destruct in 10 seconds. If they don't,
9
- # feel free to delete them.
10
- require 'spork'
1
+ # coding: utf-8
2
+ require 'simplecov'
3
+ SimpleCov.start
11
4
 
12
- Spork.prefork do
13
- require 'active_support'
14
- # Loading more in this block will cause your tests to run faster. However,
15
- # if you change any configuration or code from libraries loaded here, you'll
16
- # need to restart spork for it take effect.
17
- # This file is copied to spec/ when you run 'rails generate rspec:install'
18
- ENV['RAILS_ENV'] ||= 'test'
5
+ require 'rubygems'
6
+ require 'bundler/setup'
7
+ require 'rspec'
8
+ require 'rspec/given'
19
9
 
20
- FileUtils.cp(File.expand_path('../../../../../config/sphinx.yml', __FILE__), File.expand_path('../dummy/config/sphinx.yml', __FILE__))
21
-
22
- require File.expand_path('../dummy/config/application', __FILE__)
23
- require "#{Rails.application.paths.vendor.plugins.first}/core_domains/lib/core/domains/testing/test_helper"
24
- require File.expand_path('../dummy/config/environment', __FILE__)
25
- require 'rspec/rails'
26
- require 'rspec/autorun'
27
- require 'factory_girl'
28
- require 'shoulda-matchers'
29
- require 'capybara/rails'
30
- require 'capybara/rspec'
31
-
32
- # Requires supporting ruby files with custom matchers and macros, etc,
33
- # in spec/support/ and its subdirectories.
34
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
35
- Dir["#{Rails.application.paths.vendor.plugins.first}/core/spec/support/**/*.rb"].each { |f| require f }
36
- Dir["#{File.dirname(__FILE__)}/factories/**/*.rb"].each { |f| require f }
37
-
38
- use_plugin_support
39
- use_plugin_factories
40
-
41
- RSpec.configure do |config|
42
- # ## Mock Framework
43
- #
44
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
45
- #
46
- # config.mock_with :mocha
47
- # config.mock_with :flexmock
48
- # config.mock_with :rr
49
-
50
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
51
- config.fixture_path = "#{File.dirname(__FILE__)}/fixtures"
52
-
53
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
54
- # examples within a transaction, remove the following line or assign false
55
- # instead of true.
56
- config.use_transactional_fixtures = true
57
-
58
- # If true, the base class of anonymous controllers will be inferred
59
- # automatically. This will be the default behavior in future versions of
60
- # rspec-rails.
61
- config.infer_base_class_for_anonymous_controllers = false
62
-
63
- if ENV['CI'].present?
64
- config.color_enabled = true
65
- config.tty = true
66
- config.formatter = :documentation
67
- end
68
-
69
- config.backtrace_clean_patterns = []
70
- end
71
- end
72
-
73
- Spork.each_run do
74
- # This code will be run each time you run your specs.
75
- end
10
+ require 'resque-reports'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-reports
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,14 +9,14 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-26 00:00:00.000000000 Z
12
+ date: 2014-03-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: resque-integration
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ~>
19
+ - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
21
  version: 0.2.9
22
22
  type: :runtime
@@ -24,17 +24,17 @@ dependencies:
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ~>
27
+ - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: 0.2.9
30
30
  - !ruby/object:Gem::Dependency
31
- name: facets
31
+ name: activesupport
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
35
  - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
- version: 2.9.3
37
+ version: '0'
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
- version: 2.9.3
45
+ version: '0'
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: bundler
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -77,6 +77,38 @@ dependencies:
77
77
  version: '0'
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: rspec
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: 2.14.0
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: 2.14.0
94
+ - !ruby/object:Gem::Dependency
95
+ name: rspec-given
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: '3.0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '3.0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: simplecov
80
112
  requirement: !ruby/object:Gem::Requirement
81
113
  none: false
82
114
  requirements:
@@ -91,7 +123,8 @@ dependencies:
91
123
  - - ! '>='
92
124
  - !ruby/object:Gem::Version
93
125
  version: '0'
94
- description: Make your custom reports to CSV with resque by simple DSL
126
+ description: Make your custom reports to CSV in background using Resque with simple
127
+ DSL
95
128
  email:
96
129
  - sclinede@gmail.com
97
130
  executables: []
@@ -99,21 +132,30 @@ extensions: []
99
132
  extra_rdoc_files: []
100
133
  files:
101
134
  - .gitignore
135
+ - .rspec
136
+ - .rubocop.yml
102
137
  - Gemfile
103
138
  - MIT-LICENSE
104
139
  - README
105
140
  - Rakefile
106
141
  - app/jobs/resque/reports/report_job.rb
107
- - init.rb
108
142
  - lib/resque-reports.rb
109
143
  - lib/resque/reports.rb
110
144
  - lib/resque/reports/base_report.rb
111
145
  - lib/resque/reports/cache_file.rb
112
- - lib/resque/reports/callbacks.rb
113
146
  - lib/resque/reports/csv_report.rb
114
- - lib/resque/reports/encodings.rb
147
+ - lib/resque/reports/extensions.rb
148
+ - lib/resque/reports/extensions/const.rb
149
+ - lib/resque/reports/extensions/encodings.rb
150
+ - lib/resque/reports/extensions/event_callbacks.rb
151
+ - lib/resque/reports/extensions/event_templates.rb
152
+ - lib/resque/reports/extensions/filename_gen.rb
153
+ - lib/resque/reports/extensions/table_building.rb
115
154
  - lib/resque/reports/version.rb
116
155
  - resque-reports.gemspec
156
+ - spec/resque/reports/base_report_spec.rb
157
+ - spec/resque/reports/csv_report_spec.rb
158
+ - spec/resque/reports/report_job_spec.rb
117
159
  - spec/spec_helper.rb
118
160
  homepage: https://github.com/sclinede/resque-reports
119
161
  licenses:
@@ -128,18 +170,26 @@ required_ruby_version: !ruby/object:Gem::Requirement
128
170
  - - ! '>='
129
171
  - !ruby/object:Gem::Version
130
172
  version: '0'
173
+ segments:
174
+ - 0
175
+ hash: 375761733447731005
131
176
  required_rubygems_version: !ruby/object:Gem::Requirement
132
177
  none: false
133
178
  requirements:
134
179
  - - ! '>='
135
180
  - !ruby/object:Gem::Version
136
181
  version: '0'
182
+ segments:
183
+ - 0
184
+ hash: 375761733447731005
137
185
  requirements: []
138
186
  rubyforge_project:
139
187
  rubygems_version: 1.8.24
140
188
  signing_key:
141
189
  specification_version: 3
142
- summary: resque-reports 0.0.1
190
+ summary: resque-reports
143
191
  test_files:
192
+ - spec/resque/reports/base_report_spec.rb
193
+ - spec/resque/reports/csv_report_spec.rb
194
+ - spec/resque/reports/report_job_spec.rb
144
195
  - spec/spec_helper.rb
145
- has_rdoc:
data/init.rb DELETED
@@ -1,4 +0,0 @@
1
- # coding: utf-8
2
- Core.init_plugin do
3
- ActiveSupport::Dependencies.autoload_paths << "#{File.dirname(__FILE__)}/app/jobs"
4
- end
@@ -1,50 +0,0 @@
1
- # coding: utf-8
2
- module Resque
3
- module Reports
4
- module Callbacks
5
-
6
- # TODO: сделать гибкой логику колбеков и хендлеров
7
- module ClassMethods
8
- protected
9
-
10
- PROGRESS_INTERVAL = 10
11
-
12
- # Callbacks
13
-
14
- # rubocop:disable TrivialAccessors
15
-
16
- # Set callback for watching progress of export
17
- # @yield [progress] block to be executed on progress
18
- # @yieldparam progress [Integer] current progress
19
- # @yieldparam total [Integer] data length
20
- def on_progress(&block)
21
- @progress_callback = block
22
- end
23
-
24
- # Set callback on error
25
- # @yield [error] block to be executed when error occurred
26
- # @yieldparam [Exception] error
27
- def on_error(&block)
28
- @error_callback = block
29
- end
30
-
31
- # rubocop:enable TrivialAccessors
32
-
33
- # Handlers
34
- def handle_progress(progress, force = false)
35
- if @progress_callback && (force || progress % self.class::PROGRESS_INTERVAL == 0)
36
- @progress_callback.call progress, @data.size
37
- end
38
- end
39
-
40
- def handle_error
41
- @error_callback ? @error_callback.call($ERROR_INFO) : raise
42
- end
43
- end
44
- end
45
-
46
- def self.included(base)
47
- base.extend ClassMethods
48
- end
49
- end
50
- end
@@ -1,13 +0,0 @@
1
- # coding: utf-8
2
- module Resque
3
- module Reports
4
- module Encodings
5
- def self.included(base)
6
- base.class_eval do
7
- CP1251 = 'w:windows1251'
8
- UTF8 = 'utf-8'
9
- end
10
- end
11
- end
12
- end
13
- end