csb 0.4.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rspec.yml +21 -31
- data/.gitignore +1 -0
- data/CHANGELOG.md +13 -0
- data/README.md +18 -1
- data/csb.gemspec +3 -1
- data/gemfiles/rails60.gemfile +1 -1
- data/gemfiles/{rails52.gemfile → rails61.gemfile} +1 -1
- data/gemfiles/rails70.gemfile +5 -0
- data/lib/csb/testing.rb +4 -0
- data/lib/csb/version.rb +1 -1
- metadata +7 -7
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebfa286a10ca2da877e857c5776f926ea880459db3f1b8dffcb81f9a7d1f983d
|
4
|
+
data.tar.gz: 10b428315a27b32f201fec24ff3ae492280235ff812ee76686f8e713b7c6f269
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0badfeec8fb05c47872138b774b3cdaaaeb7ff34f22210224bb086664626b35a080630a0b1588083e4763b7a34ab02abf1ab0708da8ec3e7a3ecb746bcfdabc8
|
7
|
+
data.tar.gz: ab70fdda6260d8173e9adb97cc77db2de466afa971108635ed96b90afcda71c14169bb493c23191265b9584ec786ce6a49f9e0d1ca0a61b1a40c2768e463e64d
|
data/.github/workflows/rspec.yml
CHANGED
@@ -2,46 +2,36 @@ name: Build
|
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
5
|
-
branches: [
|
5
|
+
branches: [master]
|
6
6
|
pull_request:
|
7
7
|
|
8
8
|
jobs:
|
9
9
|
rspec:
|
10
|
-
|
11
10
|
runs-on: ubuntu-latest
|
12
11
|
env:
|
13
12
|
BUNDLE_JOBS: 4
|
14
13
|
BUNDLE_RETRY: 3
|
14
|
+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
|
15
15
|
strategy:
|
16
16
|
fail-fast: false
|
17
17
|
matrix:
|
18
|
-
ruby: [2.6, 2.7]
|
19
|
-
gemfile: [
|
20
|
-
|
21
|
-
"
|
22
|
-
|
18
|
+
ruby: ["2.6", "2.7", "3.0", "3.1"]
|
19
|
+
gemfile: ["rails60", "rails61", "rails70"]
|
20
|
+
exclude:
|
21
|
+
- ruby: "2.6"
|
22
|
+
gemfile: "rails70"
|
23
|
+
- ruby: "3.1"
|
24
|
+
gemfile: "rails60"
|
25
|
+
- ruby: "3.1"
|
26
|
+
gemfile: "rails61"
|
23
27
|
steps:
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
bundle-${{ matrix.ruby }}-${{ matrix.gemfile }}-
|
35
|
-
- name: Set up Ruby
|
36
|
-
uses: ruby/setup-ruby@v1
|
37
|
-
with:
|
38
|
-
ruby-version: ${{ matrix.ruby }}
|
39
|
-
- name: Install dependencies
|
40
|
-
run: |
|
41
|
-
bundle config path /home/runner/bundle
|
42
|
-
bundle config --global gemfile ${{ matrix.gemfile }}
|
43
|
-
bundle install
|
44
|
-
bundle update
|
45
|
-
bundle clean
|
46
|
-
- name: Run rspec
|
47
|
-
run: bundle exec rspec
|
28
|
+
- uses: actions/checkout@v2
|
29
|
+
|
30
|
+
- name: Set up Ruby
|
31
|
+
uses: ruby/setup-ruby@v1
|
32
|
+
with:
|
33
|
+
ruby-version: ${{ matrix.ruby }}
|
34
|
+
bundler-cache: true
|
35
|
+
|
36
|
+
- name: Run rspec
|
37
|
+
run: bundle exec rspec
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -5,6 +5,13 @@
|
|
5
5
|
|
6
6
|
A simple and streaming support CSV template engine for Ruby on Rails.
|
7
7
|
|
8
|
+
## Features
|
9
|
+
|
10
|
+
- Support for streaming downloads
|
11
|
+
- Output in UTF-8 with BOM
|
12
|
+
- Readable code
|
13
|
+
- High testability
|
14
|
+
|
8
15
|
## Usage
|
9
16
|
|
10
17
|
### Template handler
|
@@ -21,9 +28,13 @@ In app/views/reports/index.csv.csb:
|
|
21
28
|
|
22
29
|
```ruby
|
23
30
|
csv.items = @reports
|
31
|
+
|
24
32
|
# When there are many records
|
25
33
|
# csv.items = @reports.find_each
|
26
34
|
|
35
|
+
# When there are many records with decorator
|
36
|
+
# csv.items = @reports.find_each.lazy.map(&:decorate)
|
37
|
+
|
27
38
|
# csv.filename = "reports_#{Time.current.to_i}.csv"
|
28
39
|
# csv.streaming = false
|
29
40
|
|
@@ -68,7 +79,7 @@ csv.cols = Article.csb_cols
|
|
68
79
|
|
69
80
|
# Your Model
|
70
81
|
def self.csb_cols
|
71
|
-
Csb.
|
82
|
+
Csb::Cols.new do |cols|
|
72
83
|
cols.add('Update date') { |r| I18n.l(r.updated_at.to_date) }
|
73
84
|
cols.add('Categories') { |r| r.categories.pluck(:name).join(' ') }
|
74
85
|
cols.add('Title', :title)
|
@@ -83,6 +94,12 @@ expect(Article.csb_cols.col_pairs(article)).to eq [
|
|
83
94
|
['Categories', 'test rspec'],
|
84
95
|
['Title', 'Testing'],
|
85
96
|
]
|
97
|
+
|
98
|
+
expect(Article.csb_cols.as_table(articles)).to eq [
|
99
|
+
['Update date', 'Categories', 'Title'],
|
100
|
+
['2020-01-01', 'test rspec', 'Testing'],
|
101
|
+
['2020-02-01', 'rails gem', 'Rails 6.2'],
|
102
|
+
]
|
86
103
|
```
|
87
104
|
|
88
105
|
## Installation
|
data/csb.gemspec
CHANGED
@@ -22,7 +22,9 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
-
spec.
|
25
|
+
spec.required_ruby_version = '>= 2.7.0'
|
26
|
+
|
27
|
+
spec.add_dependency "rails", ">= 6.0.5"
|
26
28
|
spec.add_dependency "csv"
|
27
29
|
|
28
30
|
spec.add_development_dependency "bundler", "~> 2.0"
|
data/gemfiles/rails60.gemfile
CHANGED
data/lib/csb/testing.rb
CHANGED
data/lib/csb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aki77
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 6.0.5
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 6.0.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: csv
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -90,7 +90,6 @@ files:
|
|
90
90
|
- ".github/workflows/rspec.yml"
|
91
91
|
- ".gitignore"
|
92
92
|
- ".rspec"
|
93
|
-
- ".travis.yml"
|
94
93
|
- CHANGELOG.md
|
95
94
|
- CODE_OF_CONDUCT.md
|
96
95
|
- Gemfile
|
@@ -100,8 +99,9 @@ files:
|
|
100
99
|
- bin/console
|
101
100
|
- bin/setup
|
102
101
|
- csb.gemspec
|
103
|
-
- gemfiles/rails52.gemfile
|
104
102
|
- gemfiles/rails60.gemfile
|
103
|
+
- gemfiles/rails61.gemfile
|
104
|
+
- gemfiles/rails70.gemfile
|
105
105
|
- lib/csb.rb
|
106
106
|
- lib/csb/builder.rb
|
107
107
|
- lib/csb/col.rb
|
@@ -124,7 +124,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
124
124
|
requirements:
|
125
125
|
- - ">="
|
126
126
|
- !ruby/object:Gem::Version
|
127
|
-
version:
|
127
|
+
version: 2.7.0
|
128
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
130
|
- - ">="
|