collection2csv 0.1.5 → 1.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2a03592303be2e3e37bc565307258beff0c0676d
4
- data.tar.gz: 4f9aa3248e6ae78e160d63c02a6e8037ed1f23f5
2
+ SHA256:
3
+ metadata.gz: aba616840f6db9d424f9925ff60f8b6aa3b4f2dee4d9aeac23d6f8e6e47a50f6
4
+ data.tar.gz: 5af63fcfa375958eb6a19b9fe7176bac136281024093e7bc40086a7344f0d45c
5
5
  SHA512:
6
- metadata.gz: 1294c69e6506a36223dc725ab176737fed4169d78aabfa7ccd773660321c9ca7122949f051377629142e776535682f04488afc38f394f4bb36666032853085c9
7
- data.tar.gz: 9e3dcbee2cb5512aec40caeb3b85a26081c292c6888a887a572bbee523ab3c42933d9659513c47f63b9f31e6791c649e3b8ee252034a5682a9c212cb2bf60c33
6
+ metadata.gz: 0cffcd5b59cc9a0ea4cf50be3cdc1097201c297fe80ea739982ac2770a212593ed8cbac588f745ac48ac9a3e65ddbb8c0bb3d4a1d3925097d716a69b6ffa7f16
7
+ data.tar.gz: 8713793bd6cb33dc4d10491c30b246545dbc35774115299498f186f3aa1b0bfa8cf38d7f84d099d3447ac7b176694bc6e10b891a7092d2c1b5c0d4026edf73a1
@@ -0,0 +1,54 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, master, modernize ]
6
+ pull_request:
7
+ branches: [ main, master, modernize ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ ruby: ['3.0', '3.1', '3.2', '3.3']
16
+ rails: ['6.0', '6.1', '7.0', '7.1', '7.2', '8.0']
17
+ exclude:
18
+ - ruby: '3.0'
19
+ rails: '7.2'
20
+ - ruby: '3.0'
21
+ rails: '8.0'
22
+
23
+ env:
24
+ RAILS_VERSION: ${{ matrix.rails }}
25
+
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+
29
+ - name: Set up Ruby
30
+ uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: ${{ matrix.ruby }}
33
+ bundler-cache: true
34
+
35
+ - name: Run tests
36
+ run: bundle exec rake
37
+
38
+ - name: Run RuboCop
39
+ run: bundle exec rubocop
40
+
41
+ security:
42
+ runs-on: ubuntu-latest
43
+
44
+ steps:
45
+ - uses: actions/checkout@v4
46
+
47
+ - name: Set up Ruby
48
+ uses: ruby/setup-ruby@v1
49
+ with:
50
+ ruby-version: '3.3'
51
+ bundler-cache: true
52
+
53
+ - name: Security audit
54
+ run: bundle exec bundle-audit --update
data/.gitignore CHANGED
@@ -1,10 +1,41 @@
1
+ ## Ruby/Bundler
1
2
  /.bundle/
2
- /.yardoc
3
+ /vendor/bundle/
3
4
  /Gemfile.lock
5
+
6
+ ## Documentation
7
+ /.yardoc/
4
8
  /_yardoc/
5
- /coverage/
6
9
  /doc/
7
- /pkg/
10
+ /rdoc/
11
+
12
+ ## Testing
13
+ /coverage/
8
14
  /spec/reports/
15
+ /test/tmp/
16
+ /test/version_tmp/
17
+ /spec/dummy_app/log/
18
+ /spec/dummy_app/tmp/
19
+ /spec/dummy_app/db/*.sqlite3
20
+
21
+ ## Build artifacts
22
+ /pkg/
9
23
  /tmp/
10
- /gemfiles/*.lock
24
+ *.gem
25
+
26
+ ## IDE and OS files
27
+ .DS_Store
28
+ .idea/
29
+ .vscode/
30
+ *.swp
31
+ *.swo
32
+ *~
33
+ .ruby-version
34
+ .ruby-gemset
35
+
36
+ ## Environment
37
+ .env
38
+ .env.local
39
+
40
+ ## Logs
41
+ npm-debug.log
data/.rspec CHANGED
@@ -1,2 +1 @@
1
- --format documentation
2
- --color
1
+ --require rails_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,40 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.0
3
+ NewCops: enable
4
+ SuggestExtensions: false
5
+ Exclude:
6
+ - 'vendor/**/*'
7
+ - 'bin/**/*'
8
+ - 'spec/dummy_app/**/*'
9
+
10
+ Style/Documentation:
11
+ Enabled: false
12
+
13
+ Style/StringLiterals:
14
+ Enabled: true
15
+ EnforcedStyle: double_quotes
16
+
17
+ Style/FrozenStringLiteralComment:
18
+ Enabled: true
19
+ EnforcedStyle: always
20
+
21
+ Layout/LineLength:
22
+ Max: 120
23
+ Exclude:
24
+ - '*.gemspec'
25
+ - 'spec/**/*'
26
+
27
+ Metrics/BlockLength:
28
+ Exclude:
29
+ - 'spec/**/*'
30
+ - '*.gemspec'
31
+
32
+ Gemspec/DevelopmentDependencies:
33
+ Enabled: false
34
+
35
+ Gemspec/AddRuntimeDependency:
36
+ Enabled: false
37
+
38
+ Naming/AccessorMethodName:
39
+ Exclude:
40
+ - 'lib/collection2csv/convertor.rb'
data/CHANGELOG.md ADDED
@@ -0,0 +1,38 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [1.0.0] - 2026-05-30
6
+
7
+ ### Breaking Changes
8
+
9
+ - Minimum Ruby version increased to 3.0
10
+ - Minimum Rails version increased to 6.0
11
+
12
+ ### Added
13
+
14
+ - Explicit `railties` runtime dependency (>= 6.0, < 9.0)
15
+ - GitHub Actions CI with Ruby and Rails matrix
16
+ - RuboCop configuration and linting in CI
17
+ - bundler-audit security scanning in CI
18
+ - CHANGELOG and UPGRADE_GUIDE
19
+
20
+ ### Changed
21
+
22
+ - Modernized gemspec and development dependencies
23
+ - Replaced Appraisal/Travis CI with GitHub Actions matrix
24
+ - Updated dummy app and specs for Rails 6+
25
+ - Updated README with Requirements section
26
+
27
+ ### Removed
28
+
29
+ - Appraisal gemfiles for Rails 4.x and 5.0
30
+ - Travis CI configuration
31
+
32
+ ## [0.1.5] - Previous Release
33
+
34
+ - ActiveRecord collection CSV export helper and controller
35
+
36
+ ---
37
+
38
+ For upgrade instructions, see [UPGRADE_GUIDE.md](UPGRADE_GUIDE.md)
data/Gemfile CHANGED
@@ -1,4 +1,11 @@
1
- source 'https://rubygems.org'
1
+ # frozen_string_literal: true
2
2
 
3
- # Specify your gem's dependencies in collection2csv.gemspec
4
- gemspec
3
+ source "https://rubygems.org"
4
+
5
+ gemspec
6
+
7
+ if (rails_version = ENV.fetch("RAILS_VERSION", nil))
8
+ gem "rails", "~> #{rails_version}.0"
9
+ else
10
+ gem "rails", "~> 7.1.0"
11
+ end
data/README.md CHANGED
@@ -1,10 +1,14 @@
1
1
  # Collection2csv
2
2
 
3
- [![Build Status](https://travis-ci.org/ethirajsrinivasan/collection2csv.svg?branch=master)](https://travis-ci.org/ethirajsrinivasan/collection2csv)
4
- [![Code Climate](https://codeclimate.com/github/ethirajsrinivasan/collection2csv/badges/gpa.svg)](https://codeclimate.com/github/ethirajsrinivasan/collection2csv)
5
- [![security](https://hakiri.io/github/ethirajsrinivasan/collection2csv/master.svg)](https://hakiri.io/github/ethirajsrinivasan/collection2csv/master)
3
+ [![CI](https://github.com/ethirajsrinivasan/collection2csv/actions/workflows/ci.yml/badge.svg)](https://github.com/ethirajsrinivasan/collection2csv/actions/workflows/ci.yml)
4
+ [![Gem Version](https://badge.fury.io/rb/collection2csv.svg)](https://badge.fury.io/rb/collection2csv)
6
5
 
7
- Collection2csv gem allows you to export a ActiveRecord collection of model objects to csv
6
+ Export ActiveRecord collections to CSV via a Rails helper and download endpoint.
7
+
8
+ ## Requirements
9
+
10
+ - Ruby >= 3.0
11
+ - Rails >= 6.0
8
12
 
9
13
  ## Installation
10
14
 
@@ -16,43 +20,50 @@ gem 'collection2csv'
16
20
 
17
21
  And then execute:
18
22
 
19
- $ bundle install
23
+ ```bash
24
+ bundle install
25
+ ```
20
26
 
21
27
  Or install it yourself as:
22
28
 
23
- $ gem install collection2csv
29
+ ```bash
30
+ gem install collection2csv
31
+ ```
24
32
 
25
33
  ## Usage
26
34
 
27
- Use the collection_download helper like any other regular tag helper :
28
-
29
- <%= collection_download(@activerecord_collection) %>
30
-
31
- eg: <%= collection_download(@users) %>
35
+ Use the `collection_download` helper:
32
36
 
33
- In order to select a particular columns use column names as follows
37
+ ```erb
38
+ <%= collection_download(@users) %>
39
+ ```
34
40
 
35
- <%= collection_download(@activerecord_collection, {columns: ['id','name']}) %>
41
+ Select specific columns:
36
42
 
37
- eg: <%= collection_download(@users, {columns: ['id','name']}) %>
43
+ ```erb
44
+ <%= collection_download(@users, columns: ['id', 'name']) %>
45
+ ```
38
46
 
39
- Download link text can be provided as follows
47
+ Custom link text:
40
48
 
41
- <%= collection_download(@activerecord_collection, {link_text: 'export'}) %>
49
+ ```erb
50
+ <%= collection_download(@users, link_text: 'Download CSV') %>
51
+ ```
42
52
 
43
- eg: <%= collection_download(@users, {link_text: 'export'}) %>
53
+ Include associations:
44
54
 
45
- Supports Associations
55
+ ```erb
56
+ <%= collection_download(@users, associations: { book: ['id', 'name'] }) %>
57
+ ```
46
58
 
47
- <%= collection_download(@activerecord_collection, {columns: ['id','name'], associations: {association_name: ['id','name']}}) %>
59
+ ## Upgrading from 0.x to 1.0
48
60
 
49
- eg: <%= collection_download(@users, {columns: ['id','name'], associations: {book: ['name', 'author']}}) %>
61
+ Version 1.0.0 requires Ruby 3.0+ and Rails 6.0+. See [UPGRADE_GUIDE.md](UPGRADE_GUIDE.md).
50
62
 
51
63
  ## Contributing
52
64
 
53
- Bug reports and pull requests are welcome on GitHub at https://github.com/ethirajsrinivasan/collection2csv.
54
-
65
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ethirajsrinivasan/collection2csv. Contributors are expected to adhere to the [Contributor Covenant](CODE_OF_CONDUCT.md) code of conduct.
55
66
 
56
67
  ## License
57
68
 
58
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
69
+ The gem is available as open source under the terms of the [MIT License](LICENSE.txt).
data/Rakefile CHANGED
@@ -1,19 +1,8 @@
1
- require "rubygems"
2
- require "bundler/setup"
1
+ # frozen_string_literal: true
2
+
3
3
  require "bundler/gem_tasks"
4
4
  require "rspec/core/rake_task"
5
- require "appraisal"
6
5
 
7
6
  RSpec::Core::RakeTask.new(:spec)
8
7
 
9
- if !ENV["APPRAISAL_INITIALIZED"] && !ENV["TRAVIS"]
10
- task :default do
11
- system('bundle exec rake appraisal spec')
12
- end
13
- task :test do
14
- system('bundle exec rake appraisal spec')
15
- end
16
- else
17
- task :default => :spec
18
- task :test => :spec
19
- end
8
+ task default: :spec
data/UPGRADE_GUIDE.md ADDED
@@ -0,0 +1,24 @@
1
+ # Upgrade Guide: Collection2csv 0.x to 1.0
2
+
3
+ ## Overview
4
+
5
+ Collection2csv 1.0 modernizes the gem for current Ruby and Rails versions.
6
+
7
+ ## What Changed
8
+
9
+ | Component | Old Version | New Version |
10
+ |-----------|-------------|-------------|
11
+ | Ruby | >= 2.0.0 | >= 3.0 |
12
+ | Rails | >= 4.0 (via Appraisal) | >= 6.0 |
13
+
14
+ ## Upgrade Steps
15
+
16
+ 1. Ensure your application runs Ruby 3.0+ and Rails 6.0+
17
+ 2. Update your Gemfile: `gem 'collection2csv', '~> 1.0'`
18
+ 3. Run `bundle update collection2csv`
19
+ 4. Verify CSV export links and downloads still work
20
+
21
+ ## Getting Help
22
+
23
+ - [GitHub Issues](https://github.com/ethirajsrinivasan/collection2csv/issues)
24
+ - [CHANGELOG.md](CHANGELOG.md)
@@ -1,9 +1,11 @@
1
- require 'csv'
2
- require 'collection2csv/convertor'
3
- class Collection2csvController < ApplicationController
1
+ # frozen_string_literal: true
2
+
3
+ require "csv"
4
+ require "collection2csv/convertor"
4
5
 
6
+ class Collection2csvController < ApplicationController
5
7
  def convert
6
- send_data Collection2csv::Convertor.new(params).perform, filename: "#{params[:klass]}_#{DateTime.now.to_formatted_s(:db)}.csv"
8
+ send_data Collection2csv::Convertor.new(params).perform,
9
+ filename: "#{params[:klass]}_#{DateTime.now.to_formatted_s(:db)}.csv"
7
10
  end
8
-
9
- end
11
+ end
@@ -1,11 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module CollectionToCsvHelper
2
- def collection_download(collection,options={})
4
+ def collection_download(collection, options = {})
3
5
  column_names = options[:columns].presence
4
6
  associations = options[:associations].presence
5
- link_text = options[:link_text].presence || 'Download'
6
- klass = collection.try(:first).class
7
- raise(RuntimeError, "#{collection} is not a ActiveRecord collection") unless klass.ancestors.include?(ActiveRecord::Base)
7
+ link_text = options[:link_text].presence || "Download"
8
+ klass = collection.try(:first).class
9
+ raise("#{collection} is not a ActiveRecord collection") unless klass.ancestors.include?(ActiveRecord::Base)
10
+
8
11
  collection_ids = collection.map(&:id)
9
- link_to link_text , collection2csv_path(ids: collection_ids,klass: klass,format: "csv",column_names: column_names,associations: associations)
12
+ link_to link_text,
13
+ collection2csv_path(ids: collection_ids, klass: klass, format: "csv",
14
+ column_names: column_names, associations: associations)
10
15
  end
11
16
  end
@@ -1,36 +1,46 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'collection2csv/version'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/collection2csv/version"
5
4
 
6
5
  Gem::Specification.new do |spec|
7
6
  spec.name = "collection2csv"
8
7
  spec.version = Collection2csv::VERSION
9
- spec.authors = ["ethiraj"]
8
+ spec.authors = ["ethi"]
10
9
  spec.email = ["ethirajsrinivasan@gmail.com"]
11
10
 
12
- spec.summary = "Download ActiveRecord collection as csv"
13
- spec.description = "Download ActiveRecord collection as csv"
11
+ spec.summary = "Download ActiveRecord collection as CSV"
12
+ spec.description = "A Rails engine gem for exporting ActiveRecord collections to CSV via a helper and controller endpoint"
14
13
  spec.homepage = "https://github.com/ethirajsrinivasan/collection2csv"
15
14
  spec.license = "MIT"
16
15
 
17
- # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
- # delete this section to allow pushing this gem to any host.
19
- if spec.respond_to?(:metadata)
20
- spec.metadata['allowed_push_host'] = "https://rubygems.org"
21
- else
22
- raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
16
+ spec.metadata = {
17
+ "allowed_push_host" => "https://rubygems.org",
18
+ "homepage_uri" => spec.homepage,
19
+ "source_code_uri" => "https://github.com/ethirajsrinivasan/collection2csv",
20
+ "bug_tracker_uri" => "https://github.com/ethirajsrinivasan/collection2csv/issues",
21
+ "changelog_uri" => "https://github.com/ethirajsrinivasan/collection2csv/blob/master/CHANGELOG.md",
22
+ "documentation_uri" => "https://github.com/ethirajsrinivasan/collection2csv/blob/master/README.md",
23
+ "rubygems_mfa_required" => "true"
24
+ }
25
+
26
+ spec.files = Dir.chdir(__dir__) do
27
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
28
  end
24
29
 
25
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
- spec.test_files = `git ls-files -- Appraisals {spec,gemfiles}/*`.split("\n")
27
30
  spec.bindir = "exe"
28
31
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
32
  spec.require_paths = ["lib"]
30
- spec.required_ruby_version = '>= 2.0.0'
31
- spec.add_development_dependency "bundler", "~> 1.10"
32
- spec.add_development_dependency "rake", "~> 10.0"
33
- spec.add_development_dependency "rspec-rails"
34
- spec.add_development_dependency "appraisal"
35
33
 
34
+ spec.required_ruby_version = ">= 3.0"
35
+
36
+ spec.add_runtime_dependency "csv"
37
+ spec.add_runtime_dependency "railties", ">= 6.0", "< 9.0"
38
+
39
+ spec.add_development_dependency "bundler", "~> 2.4"
40
+ spec.add_development_dependency "bundler-audit", "~> 0.9"
41
+ spec.add_development_dependency "database_cleaner-active_record"
42
+ spec.add_development_dependency "rake", "~> 13.0"
43
+ spec.add_development_dependency "rspec-rails", "~> 6.1"
44
+ spec.add_development_dependency "rubocop", "~> 1.50"
45
+ spec.add_development_dependency "sqlite3", ">= 1.4"
36
46
  end
data/config/routes.rb CHANGED
@@ -1,4 +1,5 @@
1
- # ENGINE/config/routes.rb
1
+ # frozen_string_literal: true
2
+
2
3
  Rails.application.routes.draw do
3
- get "/collection2csv" => "collection2csv#convert"
4
+ get "/collection2csv(.:format)" => "collection2csv#convert", as: :collection2csv, defaults: { format: "csv" }
4
5
  end
@@ -1,12 +1,15 @@
1
- require 'csv'
1
+ # frozen_string_literal: true
2
+
3
+ require "csv"
4
+
2
5
  module Collection2csv
3
6
  class Convertor
4
7
  def initialize(params)
5
- @klass = params[:klass].constantize
8
+ @klass = params[:klass].constantize
6
9
  @column_names_from_params = params[:column_names].presence
7
10
  @associations_from_params = params[:associations].presence
8
- @column_names = @column_names_from_params || @klass.column_names
9
- @associations = @associations_from_params || {}
11
+ @column_names = @column_names_from_params || @klass.column_names
12
+ @associations = @associations_from_params || {}
10
13
  @association_class_names = {}
11
14
  @association_column_names = []
12
15
  @primary_ids = params[:ids]
@@ -26,46 +29,42 @@ module Collection2csv
26
29
 
27
30
  def download
28
31
  @collections = @klass.includes(@associations.try(:keys)).find(@primary_ids)
29
- to_csv(@collections,@column_names,@associations)
32
+ to_csv(@collections, @column_names, @associations)
30
33
  end
31
34
 
32
35
  def validate_columns
33
36
  false_columns = @column_names - @klass.column_names
34
- raise_error(false_columns,'column',@klass.name) unless false_columns.empty?
37
+ raise_error(false_columns, "column", @klass.name) unless false_columns.empty?
35
38
  end
36
39
 
37
40
  def raise_error(false_entities, pluralizer, source = nil)
38
41
  msg = construct_error_msg(false_entities, pluralizer)
39
- msg << ' in ' if source.present?
42
+ msg << " in " if source.present?
40
43
  raise msg + source
41
44
  end
42
45
 
43
- def construct_error_msg(false_entities,pluralizer)
44
- false_entities.join(', ') + ' ' + pluralizer.pluralize(false_entities.count) + ' not found'
46
+ def construct_error_msg(false_entities, pluralizer)
47
+ "#{false_entities.join(', ')} #{pluralizer.pluralize(false_entities.count)} not found"
45
48
  end
46
49
 
47
50
  def validate_associations
48
- unless @associations.empty?
49
- get_association_class_names
50
- validate_association_column_names
51
- end
52
- end
51
+ return if @associations.empty?
53
52
 
54
- def validate_association_keys
55
- non_associative_keys = @associations.keys - @klass.reflections.keys
56
- raise_error(non_associative_keys,'association') unless non_associative_keys.empty?
53
+ get_association_class_names
54
+ validate_association_column_names
57
55
  end
58
56
 
59
57
  def get_association_class_names
60
- @klass.reflect_on_all_associations.each do |association|
61
- @association_class_names["#{association.name}"] = association.options[:class_name].presence || association.name.to_s.camelize
58
+ @klass.reflect_on_all_associations.each do |association|
59
+ @association_class_names[association.name.to_s] =
60
+ association.options[:class_name].presence || association.name.to_s.camelize
62
61
  end
63
62
  end
64
63
 
65
64
  def validate_association_column_names
66
- @associations.each do |association_key , association_value|
65
+ @associations.each do |association_key, association_value|
67
66
  false_columns = association_value - @association_class_names[association_key.to_s].constantize.column_names
68
- raise_error(false_columns,'column',association_key) unless false_columns.empty?
67
+ raise_error(false_columns, "column", association_key) unless false_columns.empty?
69
68
  end
70
69
  end
71
70
 
@@ -75,7 +74,7 @@ module Collection2csv
75
74
  end
76
75
 
77
76
  def association_column_names
78
- @associations.each do | association_key, association_value |
77
+ @associations.each do |association_key, association_value|
79
78
  association_value.each { |column_name| @association_column_names << "#{association_key}_#{column_name}" }
80
79
  end
81
80
  @association_column_names.map(&:camelize)
@@ -83,18 +82,18 @@ module Collection2csv
83
82
 
84
83
  def generate_column_data(collection)
85
84
  data = collection.attributes.values_at(*@column_names)
86
- data = @associations.empty? ? data : generate_column_data_for_association(collection, data)
85
+ @associations.empty? ? data : generate_column_data_for_association(collection, data)
87
86
  end
88
87
 
89
88
  def generate_column_data_for_association(collection, data)
90
- @associations.each do |association_key , association_value |
89
+ @associations.each do |association_key, association_value|
91
90
  obj = collection.public_send(association_key)
92
- data += obj.present? ? obj.attributes.values_at(*association_value) : Array.new(association_value.count,"")
91
+ data += obj.present? ? obj.attributes.values_at(*association_value) : Array.new(association_value.count, "")
93
92
  end
94
93
  data
95
94
  end
96
95
 
97
- def to_csv(collections,column_names,associations)
96
+ def to_csv(_collections, _column_names, _associations)
98
97
  CSV.generate do |csv|
99
98
  csv << generate_header
100
99
  @collections.each { |collection| csv << generate_column_data(collection) }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Collection2csv
2
- VERSION = "0.1.5"
4
+ VERSION = "1.0.0"
3
5
  end
@@ -1,12 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "collection2csv/version"
2
4
  require "collection2csv/convertor"
3
5
 
4
6
  module Collection2csv
5
7
  class Engine < Rails::Engine
6
- initializer "Collection2csv.load_app_instance_data" do |app|
8
+ initializer "collection2csv.load_app_instance_data" do |app|
7
9
  config.app_root = app.root
8
10
  end
9
11
  end
10
12
  end
11
-
12
-
metadata CHANGED
@@ -1,45 +1,78 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: collection2csv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - ethiraj
8
- autorequire:
7
+ - ethi
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2016-09-24 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: csv
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: railties
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '6.0'
33
+ - - "<"
34
+ - !ruby/object:Gem::Version
35
+ version: '9.0'
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '6.0'
43
+ - - "<"
44
+ - !ruby/object:Gem::Version
45
+ version: '9.0'
13
46
  - !ruby/object:Gem::Dependency
14
47
  name: bundler
15
48
  requirement: !ruby/object:Gem::Requirement
16
49
  requirements:
17
50
  - - "~>"
18
51
  - !ruby/object:Gem::Version
19
- version: '1.10'
52
+ version: '2.4'
20
53
  type: :development
21
54
  prerelease: false
22
55
  version_requirements: !ruby/object:Gem::Requirement
23
56
  requirements:
24
57
  - - "~>"
25
58
  - !ruby/object:Gem::Version
26
- version: '1.10'
59
+ version: '2.4'
27
60
  - !ruby/object:Gem::Dependency
28
- name: rake
61
+ name: bundler-audit
29
62
  requirement: !ruby/object:Gem::Requirement
30
63
  requirements:
31
64
  - - "~>"
32
65
  - !ruby/object:Gem::Version
33
- version: '10.0'
66
+ version: '0.9'
34
67
  type: :development
35
68
  prerelease: false
36
69
  version_requirements: !ruby/object:Gem::Requirement
37
70
  requirements:
38
71
  - - "~>"
39
72
  - !ruby/object:Gem::Version
40
- version: '10.0'
73
+ version: '0.9'
41
74
  - !ruby/object:Gem::Dependency
42
- name: rspec-rails
75
+ name: database_cleaner-active_record
43
76
  requirement: !ruby/object:Gem::Requirement
44
77
  requirements:
45
78
  - - ">="
@@ -53,45 +86,86 @@ dependencies:
53
86
  - !ruby/object:Gem::Version
54
87
  version: '0'
55
88
  - !ruby/object:Gem::Dependency
56
- name: appraisal
89
+ name: rake
90
+ requirement: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: '13.0'
95
+ type: :development
96
+ prerelease: false
97
+ version_requirements: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '13.0'
102
+ - !ruby/object:Gem::Dependency
103
+ name: rspec-rails
104
+ requirement: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - "~>"
107
+ - !ruby/object:Gem::Version
108
+ version: '6.1'
109
+ type: :development
110
+ prerelease: false
111
+ version_requirements: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - "~>"
114
+ - !ruby/object:Gem::Version
115
+ version: '6.1'
116
+ - !ruby/object:Gem::Dependency
117
+ name: rubocop
118
+ requirement: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - "~>"
121
+ - !ruby/object:Gem::Version
122
+ version: '1.50'
123
+ type: :development
124
+ prerelease: false
125
+ version_requirements: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: '1.50'
130
+ - !ruby/object:Gem::Dependency
131
+ name: sqlite3
57
132
  requirement: !ruby/object:Gem::Requirement
58
133
  requirements:
59
134
  - - ">="
60
135
  - !ruby/object:Gem::Version
61
- version: '0'
136
+ version: '1.4'
62
137
  type: :development
63
138
  prerelease: false
64
139
  version_requirements: !ruby/object:Gem::Requirement
65
140
  requirements:
66
141
  - - ">="
67
142
  - !ruby/object:Gem::Version
68
- version: '0'
69
- description: Download ActiveRecord collection as csv
143
+ version: '1.4'
144
+ description: A Rails engine gem for exporting ActiveRecord collections to CSV via
145
+ a helper and controller endpoint
70
146
  email:
71
147
  - ethirajsrinivasan@gmail.com
72
148
  executables: []
73
149
  extensions: []
74
150
  extra_rdoc_files: []
75
151
  files:
152
+ - ".github/workflows/ci.yml"
76
153
  - ".gitignore"
77
154
  - ".rspec"
78
- - ".travis.yml"
79
- - Appraisals
155
+ - ".rubocop.yml"
156
+ - CHANGELOG.md
80
157
  - CODE_OF_CONDUCT.md
81
158
  - Gemfile
82
159
  - LICENSE.txt
83
160
  - README.md
84
161
  - Rakefile
162
+ - UPGRADE_GUIDE.md
85
163
  - app/controllers/collection2csv_controller.rb
86
164
  - app/helpers/collection_to_csv_helper.rb
87
165
  - bin/console
88
166
  - bin/setup
89
167
  - collection2csv.gemspec
90
168
  - config/routes.rb
91
- - gemfiles/rails_4.0.gemfile
92
- - gemfiles/rails_4.1.gemfile
93
- - gemfiles/rails_4.2.gemfile
94
- - gemfiles/rails_5.0.gemfile
95
169
  - lib/collection2csv.rb
96
170
  - lib/collection2csv/convertor.rb
97
171
  - lib/collection2csv/version.rb
@@ -100,7 +174,12 @@ licenses:
100
174
  - MIT
101
175
  metadata:
102
176
  allowed_push_host: https://rubygems.org
103
- post_install_message:
177
+ homepage_uri: https://github.com/ethirajsrinivasan/collection2csv
178
+ source_code_uri: https://github.com/ethirajsrinivasan/collection2csv
179
+ bug_tracker_uri: https://github.com/ethirajsrinivasan/collection2csv/issues
180
+ changelog_uri: https://github.com/ethirajsrinivasan/collection2csv/blob/master/CHANGELOG.md
181
+ documentation_uri: https://github.com/ethirajsrinivasan/collection2csv/blob/master/README.md
182
+ rubygems_mfa_required: 'true'
104
183
  rdoc_options: []
105
184
  require_paths:
106
185
  - lib
@@ -108,17 +187,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
187
  requirements:
109
188
  - - ">="
110
189
  - !ruby/object:Gem::Version
111
- version: 2.0.0
190
+ version: '3.0'
112
191
  required_rubygems_version: !ruby/object:Gem::Requirement
113
192
  requirements:
114
193
  - - ">="
115
194
  - !ruby/object:Gem::Version
116
195
  version: '0'
117
196
  requirements: []
118
- rubyforge_project:
119
- rubygems_version: 2.5.1
120
- signing_key:
197
+ rubygems_version: 3.6.7
121
198
  specification_version: 4
122
- summary: Download ActiveRecord collection as csv
123
- test_files:
124
- - Appraisals
199
+ summary: Download ActiveRecord collection as CSV
200
+ test_files: []
data/.travis.yml DELETED
@@ -1,26 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.5
4
- - 2.3.1
5
- - ruby-head
6
-
7
- before_install: gem install bundler
8
-
9
- before_script:
10
- - cd spec/dummy_app
11
- - bundle exec rake db:create db:migrate
12
- - cd ../../
13
-
14
-
15
- cache: bundler
16
-
17
-
18
- gemfile:
19
- - gemfiles/rails_4.0.gemfile
20
- - gemfiles/rails_4.1.gemfile
21
- - gemfiles/rails_4.2.gemfile
22
- - gemfiles/rails_5.0.gemfile
23
-
24
- matrix:
25
- allow_failures:
26
- - rvm: ruby-head
data/Appraisals DELETED
@@ -1,23 +0,0 @@
1
- appraise "rails-4.0" do
2
- gem "rails", "4.0"
3
- gem "sqlite3"
4
- gem "database_cleaner"
5
- end
6
-
7
- appraise "rails-4.1" do
8
- gem "rails", "4.1"
9
- gem "sqlite3"
10
- gem "database_cleaner"
11
- end
12
-
13
- appraise "rails-4.2" do
14
- gem "rails", "4.2"
15
- gem "sqlite3"
16
- gem "database_cleaner"
17
- end
18
-
19
- appraise "rails-5.0" do
20
- gem "rails", "5.0"
21
- gem "sqlite3"
22
- gem "database_cleaner"
23
- end
@@ -1,9 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "4.0"
6
- gem "sqlite3"
7
- gem "database_cleaner"
8
-
9
- gemspec :path => "../"
@@ -1,9 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "4.1"
6
- gem "sqlite3"
7
- gem "database_cleaner"
8
-
9
- gemspec :path => "../"
@@ -1,9 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "4.2"
6
- gem "sqlite3"
7
- gem "database_cleaner"
8
-
9
- gemspec :path => "../"
@@ -1,9 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "5.0"
6
- gem "sqlite3"
7
- gem "database_cleaner"
8
-
9
- gemspec :path => "../"