active_report 2.3.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -1
- data/.gitignore +1 -1
- data/.rspec +1 -1
- data/.travis.yml +1 -1
- data/Gemfile +3 -3
- data/LICENSE.txt +1 -1
- data/README.md +32 -5
- data/Rakefile +1 -1
- data/active_report.gemspec +15 -15
- data/bin/console +1 -1
- data/bin/rake +6 -6
- data/bin/setup +1 -1
- data/lib/active_report/array.rb +16 -10
- data/lib/active_report/base.rb +93 -0
- data/lib/active_report/configuration.rb +10 -0
- data/lib/active_report/hash.rb +22 -31
- data/lib/active_report/record.rb +20 -32
- data/lib/active_report/version.rb +2 -2
- data/lib/active_report.rb +30 -6
- data/lib/generators/active_report/install_generator.rb +12 -0
- data/lib/generators/active_report/templates/install.rb +4 -0
- metadata +16 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 845701856d05d78aead835a3450a3b383c3f56ff
|
4
|
+
data.tar.gz: 877307c33e0d935f83d8f9f48432bdec40f54602
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1c40b631709dec74fcd328736008e27ac2cba979d19ff868fe9381647ca636b06ee36dce81b4adf9b924049df52f103e6533cc94bebc41904a22c9b06a99ea6
|
7
|
+
data.tar.gz: 5f956e8f055abed5d1666c7a062fd87e43e96805e373d693b99d02a69b945a662adfae786263b8fcf983edf5998b151789910373560ef85655c24fe33a6be67a
|
data/.coveralls.yml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
service_name: travis-ci
|
1
|
+
service_name: travis-ci
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
|
-
# Specify your gem
|
4
|
-
gemspec
|
3
|
+
# Specify your gem"s dependencies in active_report.gemspec
|
4
|
+
gemspec
|
data/LICENSE.txt
CHANGED
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/active_report.svg)](http://badge.fury.io/rb/active_report)
|
4
4
|
[![Build Status](https://travis-ci.org/drexed/active_report.svg?branch=master)](https://travis-ci.org/drexed/active_report)
|
5
|
-
[![Coverage Status](https://coveralls.io/repos/drexed/active_report/badge.
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/github/drexed/active_report/badge.svg?branch=master)](https://coveralls.io/github/drexed/active_report?branch=master)
|
6
6
|
|
7
7
|
ActiveReport is a library to export CSV's out of arrays, hashes, and records and vice versa.
|
8
8
|
|
@@ -11,7 +11,7 @@ ActiveReport is a library to export CSV's out of arrays, hashes, and records and
|
|
11
11
|
Add this line to your application's Gemfile:
|
12
12
|
|
13
13
|
```ruby
|
14
|
-
gem
|
14
|
+
gem "active_report"
|
15
15
|
```
|
16
16
|
|
17
17
|
And then execute:
|
@@ -24,9 +24,26 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
## Table of Contents
|
26
26
|
|
27
|
+
* [Configuration](#configuration)
|
27
28
|
* [Array](#array)
|
28
29
|
* [Hash](#hash)
|
29
30
|
* [Record](#record)
|
31
|
+
* [Evaluate](#evaluate)
|
32
|
+
|
33
|
+
## Configuration
|
34
|
+
|
35
|
+
`rails g active_report:install` will generate the following `active_report.rb` file:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
# config/initalizers/active_report.rb
|
39
|
+
|
40
|
+
ActiveReport.configure do |config|
|
41
|
+
# option = default
|
42
|
+
|
43
|
+
config.force_encoding = true
|
44
|
+
config.options = { encoding: "UTF-8" }
|
45
|
+
end
|
46
|
+
```
|
30
47
|
|
31
48
|
## Array
|
32
49
|
|
@@ -127,10 +144,20 @@ ActiveReport::Record.import("sample.csv", model: User)
|
|
127
144
|
ActiveReport::Record.import("sample.csv", model: User, except: :completed, headers: ["ID", "Task"], options: { col_sep: ";" })
|
128
145
|
```
|
129
146
|
|
147
|
+
## Evaluate
|
148
|
+
|
149
|
+
**Array/Hash:** Convert the import of a array or hash to proper ruby objects.
|
150
|
+
|
151
|
+
```ruby
|
152
|
+
ActiveReport::Hash.evaluate.import("sample.csv")
|
153
|
+
```
|
154
|
+
|
130
155
|
## Contributing
|
131
156
|
|
132
|
-
|
157
|
+
Your contribution is welcome.
|
158
|
+
|
159
|
+
1. Fork it
|
133
160
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
134
|
-
3. Commit your changes (`git commit -am '
|
161
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
135
162
|
4. Push to the branch (`git push origin my-new-feature`)
|
136
|
-
5. Create
|
163
|
+
5. Create new Pull Request
|
data/Rakefile
CHANGED
data/active_report.gemspec
CHANGED
@@ -1,27 +1,26 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require "active_report/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name
|
8
|
-
spec.version
|
9
|
-
spec.authors
|
10
|
-
spec.email
|
7
|
+
spec.name = "active_report"
|
8
|
+
spec.version = ActiveReport::VERSION
|
9
|
+
spec.authors = ["Juan Gomez"]
|
10
|
+
spec.email = ["j.gomez@drexed.com"]
|
11
11
|
|
12
|
-
spec.summary
|
13
|
-
spec.description
|
14
|
-
spec.homepage
|
15
|
-
spec.license
|
12
|
+
spec.summary = %q{Gem for exporting/importing ruby objects to flat files vice versa.}
|
13
|
+
spec.description = %q{Export or import data from multiple input formats such as arrays, hashes, and active record or vice versa.}
|
14
|
+
spec.homepage = "http://drexed.github.io/active_report"
|
15
|
+
spec.license = "MIT"
|
16
16
|
|
17
|
-
spec.files
|
18
|
-
spec.bindir
|
19
|
-
spec.executables
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
22
|
spec.add_runtime_dependency "activerecord"
|
23
23
|
spec.add_runtime_dependency "activesupport"
|
24
|
-
spec.add_runtime_dependency "active_object"
|
25
24
|
|
26
25
|
spec.add_development_dependency "bundler"
|
27
26
|
spec.add_development_dependency "coveralls"
|
@@ -29,4 +28,5 @@ Gem::Specification.new do |spec|
|
|
29
28
|
spec.add_development_dependency "rspec"
|
30
29
|
spec.add_development_dependency "sqlite3"
|
31
30
|
spec.add_development_dependency "database_cleaner"
|
32
|
-
|
31
|
+
spec.add_development_dependency "generator_spec"
|
32
|
+
end
|
data/bin/console
CHANGED
data/bin/rake
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
#
|
3
3
|
# This file was generated by Bundler.
|
4
4
|
#
|
5
|
-
# The application
|
5
|
+
# The application "rake" is installed as part of a gem, and
|
6
6
|
# this file is here to facilitate running it.
|
7
7
|
#
|
8
8
|
|
9
|
-
require
|
10
|
-
ENV[
|
9
|
+
require "pathname"
|
10
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
11
11
|
Pathname.new(__FILE__).realpath)
|
12
12
|
|
13
|
-
require
|
14
|
-
require
|
13
|
+
require "rubygems"
|
14
|
+
require "bundler/setup"
|
15
15
|
|
16
|
-
load Gem.bin_path(
|
16
|
+
load Gem.bin_path("rake", "rake")
|
data/bin/setup
CHANGED
data/lib/active_report/array.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
|
-
class ActiveReport::Array
|
1
|
+
class ActiveReport::Array < ActiveReport::Base
|
2
2
|
|
3
3
|
attr_accessor :datum, :headers, :options
|
4
4
|
|
5
5
|
def initialize(datum, headers: nil, options: {})
|
6
|
-
@datum
|
7
|
-
@
|
8
|
-
@options = options
|
6
|
+
@datum, @headers = datum, headers
|
7
|
+
@options = duplicate_options.merge!(options)
|
9
8
|
end
|
10
9
|
|
11
10
|
def self.export(datum, headers: nil, options: {})
|
@@ -17,18 +16,25 @@ class ActiveReport::Array
|
|
17
16
|
end
|
18
17
|
|
19
18
|
def export
|
20
|
-
@datum =
|
19
|
+
@datum = munge_first(@datum)
|
21
20
|
|
22
21
|
CSV.generate(@options) do |csv|
|
23
22
|
csv << @headers unless @headers.nil?
|
24
|
-
@datum.lazy.each { |
|
23
|
+
@datum.lazy.each { |cell| csv << cell }
|
25
24
|
end
|
26
25
|
end
|
27
26
|
|
28
27
|
def import
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
datum = merge(@headers)
|
29
|
+
|
30
|
+
CSV.foreach(@datum, @options) do |data|
|
31
|
+
data = encode_to_utf8(data) if force_encoding?
|
32
|
+
datum.push(data)
|
33
|
+
end
|
34
|
+
|
35
|
+
datum = datum.flatten if datum.size < 2
|
36
|
+
datum = metatransform(datum)
|
37
|
+
datum
|
32
38
|
end
|
33
39
|
|
34
|
-
end
|
40
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
class ActiveReport::Base
|
2
|
+
|
3
|
+
@@evaluate = false
|
4
|
+
|
5
|
+
def self.evaluate(value=true)
|
6
|
+
@@evaluate = value
|
7
|
+
self
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def duplicate_options
|
13
|
+
ActiveReport.configuration.options.dup
|
14
|
+
end
|
15
|
+
|
16
|
+
def encode_to_utf8(line)
|
17
|
+
line.map do |l|
|
18
|
+
next if l.nil?
|
19
|
+
l.gsub!(/"/, "")
|
20
|
+
l.encode!("UTF-8", "binary", invalid: :replace, undef: :replace, replace: "")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def evaluate?
|
25
|
+
value = @@evaluate
|
26
|
+
@@evaluate = false
|
27
|
+
value
|
28
|
+
end
|
29
|
+
|
30
|
+
def filter(object)
|
31
|
+
if @only.empty?
|
32
|
+
object.delete_if { |key, value| @except.include?(key) } unless @except.empty?
|
33
|
+
else
|
34
|
+
object.keep_if { |key, value| @only.include?(key) }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def filter_first(object)
|
39
|
+
if @only.empty?
|
40
|
+
object.first.delete_if { |key, value| @except.include?(key) } unless @except.empty?
|
41
|
+
else
|
42
|
+
object.first.keep_if { |key, value| @only.include?(key) }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def force_encoding?
|
47
|
+
ActiveReport.configuration.force_encoding
|
48
|
+
end
|
49
|
+
|
50
|
+
def humanize(object)
|
51
|
+
object.to_s.gsub("_", " ").capitalize
|
52
|
+
end
|
53
|
+
|
54
|
+
def merge(object)
|
55
|
+
[].push(object).compact
|
56
|
+
end
|
57
|
+
|
58
|
+
def metaform(value)
|
59
|
+
value.nil? ? value : eval(value)
|
60
|
+
rescue Exception => e
|
61
|
+
value
|
62
|
+
end
|
63
|
+
|
64
|
+
def metamorph(datum)
|
65
|
+
datum = case datum.class.name
|
66
|
+
when "Array"
|
67
|
+
if datum.first.is_a?(Array)
|
68
|
+
datum.map { |array| array.map { |value| metaform(value) } }
|
69
|
+
elsif datum.first.is_a?(Hash)
|
70
|
+
datum.map { |hash| hash.each { |key, value| hash.store(key, metaform(value)) } }
|
71
|
+
else
|
72
|
+
datum.map { |value| metaform(value) }
|
73
|
+
end
|
74
|
+
when "Hash"
|
75
|
+
datum.each { |key, value| datum.store(key, metaform(value)) }
|
76
|
+
else
|
77
|
+
metaform(datum)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def metatransform(datum)
|
82
|
+
datum.empty? ? nil : (evaluate? ? metamorph(datum) : datum)
|
83
|
+
end
|
84
|
+
|
85
|
+
def munge(object)
|
86
|
+
object.is_a?(Array) ? object : merge(object)
|
87
|
+
end
|
88
|
+
|
89
|
+
def munge_first(object)
|
90
|
+
object.first.is_a?(Array) ? object : merge(object)
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
data/lib/active_report/hash.rb
CHANGED
@@ -1,13 +1,10 @@
|
|
1
|
-
class ActiveReport::Hash
|
1
|
+
class ActiveReport::Hash < ActiveReport::Base
|
2
2
|
|
3
3
|
attr_accessor :datum, :only, :except, :headers, :options
|
4
4
|
|
5
5
|
def initialize(datum, only: nil, except: nil, headers: nil, options: {})
|
6
|
-
@datum
|
7
|
-
@
|
8
|
-
@except = except
|
9
|
-
@headers = headers
|
10
|
-
@options = options
|
6
|
+
@datum, @except, @headers, @only = datum, except, headers, only
|
7
|
+
@options = duplicate_options.merge!(options)
|
11
8
|
end
|
12
9
|
|
13
10
|
def self.export(datum, only: nil, except: nil, headers: nil, options: {})
|
@@ -19,42 +16,36 @@ class ActiveReport::Hash
|
|
19
16
|
end
|
20
17
|
|
21
18
|
def export
|
22
|
-
@datum
|
23
|
-
@only = [].push(@only).compact unless @only.is_a?(Array)
|
24
|
-
@except = [].push(@except).compact unless @except.is_a?(Array)
|
19
|
+
@datum, @only, @except = munge(@datum), munge(@only), munge(@except)
|
25
20
|
|
26
21
|
CSV.generate(@options) do |csv|
|
27
|
-
|
28
|
-
|
29
|
-
csv << (@headers || (header || @datum.first).keys.map { |k| k.to_s.gsub('_'.freeze, ' '.freeze).capitalize })
|
30
|
-
|
31
|
-
@datum.lazy.each do |data|
|
32
|
-
cell = data.only(@only) unless @only.empty?
|
33
|
-
cell = data.except(@except) unless @except.empty?
|
34
|
-
csv << (cell || data).values
|
35
|
-
end
|
22
|
+
csv << (@headers || (filter_first(@datum) || @datum.first).keys.map { |header| humanize(header) })
|
23
|
+
@datum.lazy.each { |data| csv << (filter(data) || data).values }
|
36
24
|
end
|
37
25
|
end
|
38
26
|
|
39
27
|
def import
|
40
|
-
@only
|
41
|
-
|
28
|
+
@only, @except = munge(@only), munge(@except)
|
29
|
+
|
30
|
+
datum = []
|
31
|
+
CSV.foreach(@datum, @options).with_index do |data, line|
|
32
|
+
data = encode_to_utf8(data) if force_encoding?
|
42
33
|
|
43
|
-
processed_datum = []
|
44
|
-
CSV.foreach(@datum, @options).lazy.each_with_index do |data, line|
|
45
34
|
if @headers.nil? && line.zero?
|
46
35
|
@headers = data
|
47
36
|
else
|
48
|
-
|
49
|
-
@headers.lazy.each_with_index
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
processed_datum.push(processed_data)
|
37
|
+
subdata = {}
|
38
|
+
@headers.lazy.each_with_index do |header, i|
|
39
|
+
subdata.store(header.to_s, data.fetch(i, nil))
|
40
|
+
end
|
41
|
+
filter(subdata)
|
42
|
+
datum.push(subdata)
|
55
43
|
end
|
56
44
|
end
|
57
|
-
|
45
|
+
|
46
|
+
datum = datum.first if datum.size == 1
|
47
|
+
datum = metatransform(datum)
|
48
|
+
datum
|
58
49
|
end
|
59
50
|
|
60
|
-
end
|
51
|
+
end
|
data/lib/active_report/record.rb
CHANGED
@@ -1,15 +1,11 @@
|
|
1
|
-
require
|
2
|
-
class ActiveReport::Record
|
1
|
+
require "json"
|
2
|
+
class ActiveReport::Record < ActiveReport::Base
|
3
3
|
|
4
4
|
attr_accessor :datum, :model, :only, :except, :headers, :options
|
5
5
|
|
6
6
|
def initialize(datum, model: nil, only: nil, except: nil, headers: nil, options: {})
|
7
|
-
@datum
|
8
|
-
@
|
9
|
-
@only = only
|
10
|
-
@except = except
|
11
|
-
@headers = headers
|
12
|
-
@options = options
|
7
|
+
@datum, @except, @headers, @model, @only = datum, except, headers, model, only
|
8
|
+
@options = duplicate_options.merge!(options)
|
13
9
|
end
|
14
10
|
|
15
11
|
def self.export(datum, only: nil, except: nil, headers: nil, options: {})
|
@@ -21,42 +17,34 @@ class ActiveReport::Record
|
|
21
17
|
end
|
22
18
|
|
23
19
|
def export
|
24
|
-
@datum
|
25
|
-
@only
|
26
|
-
@except = (@except.is_a?(Array) ? @except : [].push(@except).compact).map(&:to_s)
|
20
|
+
@datum = @datum.is_a?(ActiveRecord::Relation) ? JSON.parse(@datum.to_json).flatten : merge(@datum.attributes)
|
21
|
+
@only, @except = munge(@only).map(&:to_s), munge(@except).map(&:to_s)
|
27
22
|
|
28
23
|
CSV.generate(@options) do |csv|
|
29
|
-
|
30
|
-
|
31
|
-
csv << (@headers || (header || @datum.first).keys.map { |k| k.to_s.gsub('_'.freeze, ' '.freeze).capitalize })
|
32
|
-
|
33
|
-
@datum.lazy.each do |data|
|
34
|
-
cell = data.only(@only) unless @only.empty?
|
35
|
-
cell = data.except(@except) unless @except.empty?
|
36
|
-
csv << (cell || data).values
|
37
|
-
end
|
24
|
+
csv << (@headers || (filter_first(@datum) || @datum.first).keys.map { |header| humanize(header) })
|
25
|
+
@datum.lazy.each { |data| csv << (filter(data) || data).values }
|
38
26
|
end
|
39
27
|
end
|
40
28
|
|
41
29
|
def import
|
42
30
|
if @model.nil? || (@model.superclass != ActiveRecord::Base)
|
43
|
-
raise ArgumentError,
|
44
|
-
"Model must be an ActiveRecord::Base object.".freeze
|
31
|
+
raise ArgumentError, "Model must be an ActiveRecord::Base object."
|
45
32
|
end
|
46
33
|
|
47
|
-
@only = [].push(@only).compact unless @only.is_a?(Array)
|
48
|
-
@except = [].push(@except).compact unless @except.is_a?(Array)
|
49
|
-
|
50
34
|
@datum = ActiveReport::Hash.import(@datum, headers: @headers, options: @options)
|
51
|
-
@datum
|
52
|
-
data.transform_keys! { |k| k.to_s.downcase.gsub(' '.freeze, '_'.freeze).to_sym }
|
35
|
+
@datum, @only, @except = munge(@datum), munge(@only), munge(@except)
|
53
36
|
|
54
|
-
|
55
|
-
|
56
|
-
data.
|
37
|
+
@datum.lazy.each do |data|
|
38
|
+
params = {}
|
39
|
+
data.each do |key, value|
|
40
|
+
key = key.to_s.downcase.gsub(" ", "_").gsub("-", "_").to_sym
|
41
|
+
params.store(key, value)
|
42
|
+
end
|
57
43
|
|
58
|
-
|
44
|
+
filter(params)
|
45
|
+
params.delete(:id)
|
46
|
+
@model.create(params)
|
59
47
|
end
|
60
48
|
end
|
61
49
|
|
62
|
-
end
|
50
|
+
end
|
@@ -1,3 +1,3 @@
|
|
1
1
|
module ActiveReport
|
2
|
-
VERSION = "
|
3
|
-
end
|
2
|
+
VERSION = "3.0.0"
|
3
|
+
end
|
data/lib/active_report.rb
CHANGED
@@ -1,6 +1,30 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
require "csv"
|
2
|
+
require "active_report/version"
|
3
|
+
require "active_report/configuration"
|
4
|
+
|
5
|
+
module ActiveReport
|
6
|
+
|
7
|
+
class << self
|
8
|
+
attr_accessor :configuration
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.configuration
|
12
|
+
@configuration ||= Configuration.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.configuration=(config)
|
16
|
+
@configuration = config
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.configure
|
20
|
+
yield(configuration)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
require "active_report/base"
|
26
|
+
require "active_report/array"
|
27
|
+
require "active_report/hash"
|
28
|
+
require "active_report/record"
|
29
|
+
|
30
|
+
require "generators/active_report/install_generator"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "rails/generators"
|
2
|
+
|
3
|
+
module ActiveReport
|
4
|
+
class InstallGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path("../templates", __FILE__)
|
6
|
+
|
7
|
+
def copy_initializer_file
|
8
|
+
copy_file("install.rb", "config/initializers/active_report.rb")
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_report
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -39,13 +39,13 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
|
-
type: :
|
48
|
+
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: coveralls
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: sqlite3
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: database_cleaner
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
@@ -123,7 +123,7 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: generator_spec
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
@@ -158,10 +158,14 @@ files:
|
|
158
158
|
- bin/setup
|
159
159
|
- lib/active_report.rb
|
160
160
|
- lib/active_report/array.rb
|
161
|
+
- lib/active_report/base.rb
|
162
|
+
- lib/active_report/configuration.rb
|
161
163
|
- lib/active_report/hash.rb
|
162
164
|
- lib/active_report/record.rb
|
163
165
|
- lib/active_report/version.rb
|
164
|
-
|
166
|
+
- lib/generators/active_report/install_generator.rb
|
167
|
+
- lib/generators/active_report/templates/install.rb
|
168
|
+
homepage: http://drexed.github.io/active_report
|
165
169
|
licenses:
|
166
170
|
- MIT
|
167
171
|
metadata: {}
|
@@ -181,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
185
|
version: '0'
|
182
186
|
requirements: []
|
183
187
|
rubyforge_project:
|
184
|
-
rubygems_version: 2.4
|
188
|
+
rubygems_version: 2.6.4
|
185
189
|
signing_key:
|
186
190
|
specification_version: 4
|
187
191
|
summary: Gem for exporting/importing ruby objects to flat files vice versa.
|