tori 0.7.2 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8b321ceffe6fc92116cf48431777e628523ec762
4
- data.tar.gz: 6350f18ad8b0347843613f0697fbdef7b76359a0
2
+ SHA256:
3
+ metadata.gz: c3f5c0fb1cf2098cfb8ce401f8627fba1b88c25b1a95a14df1dfe00d38296a1e
4
+ data.tar.gz: d905f6ecfe1a49fd9c648e2aabd3423079af98bcd9e18efd1cabcd6f199b78f2
5
5
  SHA512:
6
- metadata.gz: 3bc25e66deeff246db55b2ee0922ca9d4d813dfa71b231f50d1dddd1481b60876f0d2a1a0c7ca92ba71b306d1de0240255e22e13895f176d456965d94e99c4f7
7
- data.tar.gz: 257800528887cea1d17bfe6630f0ed27a72441dd9c5f6251e15eae3a04360e88f5a368f17264afda466602551cb79f9175ffcb0a0a44c96382ed8eb82e83a37f
6
+ metadata.gz: 81fef0f07412e79e59a691b520de8dace5a50d1a1870a4a134fe4fa10f9ce6188544abf7e898eb206a7cfd106e2e3630bc97d15f13c86c3eabc65e06c2b75543
7
+ data.tar.gz: 6ae9bef76edb139011bb8214b6b047e1934799f37afc078e62a0cad146e9a9216371500612839e941779c5bf0f10a6de9c5e1d02454af4079b4bc70978421cdd
@@ -0,0 +1,33 @@
1
+ name: test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+
8
+ pull_request:
9
+ branches:
10
+ - "*"
11
+
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-latest
15
+ name: Ruby ${{ matrix.ruby }}
16
+ strategy:
17
+ matrix:
18
+ ruby:
19
+ - '3.1'
20
+ - '3.0'
21
+ - '2.7'
22
+ - '2.6'
23
+ - '2.5'
24
+ - '2.4'
25
+ - '2.3'
26
+
27
+ steps:
28
+ - uses: actions/checkout@v2
29
+ - uses: ruby/setup-ruby@v1
30
+ with:
31
+ ruby-version: ${{ matrix.ruby }}
32
+ bundler-cache: true
33
+ - run: bundle exec rake test
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  Tori
2
2
  ===
3
3
 
4
- [![Build Status](https://travis-ci.org/ksss/tori.svg?branch=master)](https://travis-ci.org/ksss/tori)
4
+ [![test](https://github.com/ksss/tori/actions/workflows/test.yml/badge.svg)](https://github.com/ksss/tori/actions/workflows/test.yml)
5
5
 
6
6
  "(\\( ⁰⊖⁰)/)"
7
7
 
8
8
  Tori is a very very simple file uploader.
9
9
 
10
- Tori dose nothing.
10
+ Tori does nothing.
11
11
 
12
12
  Only file upload to backend store.
13
13
 
@@ -1,3 +1,5 @@
1
+ require 'ruby2_keywords'
2
+
1
3
  module Tori
2
4
  module Backend
3
5
  class FileSystem
@@ -45,19 +47,31 @@ module Tori
45
47
  end
46
48
  alias exists? exist?
47
49
 
48
- def read(filename, *args)
49
- if args.last.kind_of?(Hash)
50
- opt = args.pop
51
- else
52
- opt = {}
50
+ if RUBY_VERSION < '2.7'
51
+ ruby2_keywords def read(filename, *args)
52
+ if args.last.kind_of?(Hash)
53
+ opt = args.pop
54
+ else
55
+ opt = {}
56
+ end
57
+ open(filename, {mode: 'rb'}.merge(opt)) do |f|
58
+ f.read(*args)
59
+ end
53
60
  end
54
- open(filename, {mode: 'rb'}.merge(opt)) do |f|
55
- f.read(*args)
61
+
62
+ ruby2_keywords def open(filename, *rest, &block)
63
+ ::File.open(path(filename), *rest, &block)
64
+ end
65
+ else
66
+ def read(filename, len=nil, **args)
67
+ open(filename, **{mode: 'rb'}.merge(args)) do |f|
68
+ f.read(len)
69
+ end
56
70
  end
57
- end
58
71
 
59
- def open(filename, *rest, &block)
60
- ::File.open(path(filename), *rest, &block)
72
+ def open(filename, **rest, &block)
73
+ ::File.open(path(filename), **rest, &block)
74
+ end
61
75
  end
62
76
 
63
77
  def copy_to(filename, tori_file, **opts)
@@ -148,12 +148,12 @@ module Tori
148
148
  tmpdir = opts.delete(:tmpdir)
149
149
 
150
150
  if block_given?
151
- Tempfile.create(names, tmpdir, opts) do |f|
151
+ Tempfile.create(names, tmpdir, **opts) do |f|
152
152
  get_object(key: filename, response_target: f.path)
153
153
  yield f
154
154
  end
155
155
  else
156
- f = Tempfile.open(names, tmpdir, opts)
156
+ f = Tempfile.open(names, tmpdir, **opts)
157
157
  get_object(key: filename, response_target: f.path)
158
158
  f
159
159
  end
data/lib/tori/file.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'ruby2_keywords'
2
+
1
3
  module Tori
2
4
  class File
3
5
  def initialize(model, title: nil, from: nil, to: nil, &block)
@@ -65,12 +67,24 @@ module Tori
65
67
  backend.respond_to?(sym, include_private)
66
68
  end
67
69
 
68
- def method_missing(sym, *args, &block)
69
- if respond_to_missing?(sym, false)
70
- backend.__send__ sym, name, *args, &block
71
- else
72
- raise NameError, "undefined method `#{sym}' for #{backend}"
70
+ if RUBY_VERSION < "2.7"
71
+ ruby2_keywords def method_missing(sym, *args, &block)
72
+ if respond_to_missing?(sym, false)
73
+ backend.__send__ sym, name, *args, &block
74
+ else
75
+ raise NameError, "undefined method `#{sym}' for #{backend}"
76
+ end
73
77
  end
78
+ else
79
+ eval <<~'RUBY'
80
+ def method_missing(sym, ...)
81
+ if respond_to_missing?(sym, false)
82
+ backend.__send__(sym, name, ...)
83
+ else
84
+ raise NameError, "undefined method `#{sym}' for #{backend}"
85
+ end
86
+ end
87
+ RUBY
74
88
  end
75
89
  end
76
90
  end
data/lib/tori/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tori
2
- VERSION = "0.7.2"
2
+ VERSION = "0.8.0"
3
3
  end
@@ -10,7 +10,7 @@ class TestToriFile < Test::Unit::TestCase
10
10
  end
11
11
 
12
12
  teardown do
13
- Tori.config.filename_callback &@orig
13
+ Tori.config.filename_callback(&@orig)
14
14
  FileUtils.rm_rf("test/tmp")
15
15
  end
16
16
 
@@ -98,12 +98,12 @@ class TestToriFile < Test::Unit::TestCase
98
98
  end
99
99
  assert { "test/" == Tori::File.new("test").name }
100
100
  assert { "test/tori" == Tori::File.new("test", title: "tori").name }
101
- Tori.config.filename_callback &before
101
+ Tori.config.filename_callback(&before)
102
102
  end
103
103
 
104
104
  test "#method_missing" do
105
105
  assert { true == Tori::File.new(nil).respond_to?(:read) }
106
106
  assert_raise(NameError) { Tori::File.new(nil).undefined }
107
- assert { [true, Encoding.find('utf-8'), 'test/tmp'] == Tori::File.new(nil).open('rb', external_encoding: 'utf-8'){ |f| [f.binmode?, f.external_encoding, f.path] } }
107
+ assert { [true, Encoding.find('utf-8'), 'test/tmp'] == Tori::File.new(nil).open(mode: 'rb', external_encoding: 'utf-8'){ |f| [f.binmode?, f.external_encoding, f.path] } }
108
108
  end
109
109
  end
data/tori.gemspec CHANGED
@@ -19,6 +19,8 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.add_runtime_dependency "aws-sdk-s3"
21
21
  spec.add_runtime_dependency "mime-types"
22
+ spec.add_runtime_dependency 'rexml'
23
+ spec.add_runtime_dependency 'ruby2_keywords'
22
24
  spec.add_development_dependency "bundler"
23
25
  spec.add_development_dependency "rake"
24
26
  spec.add_development_dependency "test-unit"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tori
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ksss
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-06 00:00:00.000000000 Z
11
+ date: 2022-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rexml
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: ruby2_keywords
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: bundler
43
71
  requirement: !ruby/object:Gem::Requirement
@@ -87,8 +115,8 @@ executables: []
87
115
  extensions: []
88
116
  extra_rdoc_files: []
89
117
  files:
118
+ - ".github/workflows/test.yml"
90
119
  - ".gitignore"
91
- - ".travis.yml"
92
120
  - Gemfile
93
121
  - LICENSE.txt
94
122
  - README.md
@@ -132,8 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
160
  - !ruby/object:Gem::Version
133
161
  version: '0'
134
162
  requirements: []
135
- rubyforge_project:
136
- rubygems_version: 2.6.13
163
+ rubygems_version: 3.3.3
137
164
  signing_key:
138
165
  specification_version: 4
139
166
  summary: Simple file uploader
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.4
4
- - 2.3.0
5
- - 2.4.1
6
- notifications:
7
- email: false