acts_as_footprintable 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +30 -0
- data/.github/workflows/test.yml +42 -0
- data/.gitignore +18 -22
- data/Gemfile +1 -1
- data/README.md +4 -6
- data/Rakefile +9 -3
- data/acts_as_footprintable.gemspec +1 -6
- data/gemfiles/rails_5.0.gemfile +2 -2
- data/gemfiles/rails_5.1.gemfile +2 -2
- data/gemfiles/rails_5.2.gemfile +2 -2
- data/gemfiles/rails_6.0.gemfile +2 -2
- data/gemfiles/rails_6.1.gemfile +2 -2
- data/gemfiles/rails_7.0.gemfile +6 -0
- data/lib/acts_as_footprintable/version.rb +1 -1
- data/{spec/footprintable_spec.rb → test/footprintable_test.rb} +28 -21
- data/{spec/footprinter_spec.rb → test/footprinter_test.rb} +17 -16
- data/{spec → test}/internal/app/models/footprintable.rb +0 -0
- data/{spec → test}/internal/app/models/not_footprintable.rb +0 -0
- data/{spec → test}/internal/app/models/not_user.rb +0 -0
- data/{spec → test}/internal/app/models/second_footprintable.rb +0 -0
- data/{spec → test}/internal/app/models/user.rb +0 -0
- data/{spec/internal/db/schema.rb → test/test_helper.rb} +23 -1
- metadata +25 -100
- data/.circleci/config.yml +0 -218
- data/.rspec +0 -3
- data/spec/internal/config/database.yml +0 -7
- data/spec/internal/log/.gitignore +0 -1
- data/spec/spec_helper.rb +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a242404e9828c149fcb0df3ca811377e6209e3486e15c2d38f7281ae56a78cd
|
4
|
+
data.tar.gz: 59b66fbd5006dea2eb60561f46faa50d70f013dfa779ebbb6df12ae7acc78ae7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d58d23cb349e23dba9370d87536a7f4d530e4358f2d1d5b5d61ebb1c00fc73eaf259a4990665a8bb9068da50e90b76298404f6da00d1824533a4d6a5b840cb2a
|
7
|
+
data.tar.gz: 6af3b769f4c2cb0fe47b4c11a3142a7c246b64ddff2933de3b5a04411eef1237d8339fc7a51516a9ef0b15b63d508fce202854574a8c1c940c8458656d2ddbeb
|
@@ -0,0 +1,30 @@
|
|
1
|
+
name: Ruby Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
name: Build + Publish
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
permissions:
|
11
|
+
contents: read
|
12
|
+
packages: write
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
- name: Set up Ruby 2.6
|
17
|
+
uses: actions/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: 2.6.x
|
20
|
+
|
21
|
+
- name: Publish to RubyGems
|
22
|
+
run: |
|
23
|
+
mkdir -p $HOME/.gem
|
24
|
+
touch $HOME/.gem/credentials
|
25
|
+
chmod 0600 $HOME/.gem/credentials
|
26
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
27
|
+
gem build *.gemspec
|
28
|
+
gem push *.gem
|
29
|
+
env:
|
30
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
@@ -0,0 +1,42 @@
|
|
1
|
+
name: Test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
ruby: ['2.6', '2.7', '3.0', '3.1']
|
15
|
+
gemfile: ['rails_5.0', 'rails_5.1', 'rails_5.2', 'rails_6.0', 'rails_6.1', 'rails_7.0']
|
16
|
+
exclude:
|
17
|
+
- ruby: '2.6'
|
18
|
+
gemfile: 'rails_7.0'
|
19
|
+
- ruby: '3.0'
|
20
|
+
gemfile: 'rails_5.0'
|
21
|
+
- ruby: '3.0'
|
22
|
+
gemfile: 'rails_5.1'
|
23
|
+
- ruby: '3.0'
|
24
|
+
gemfile: 'rails_5.2'
|
25
|
+
- ruby: '3.1'
|
26
|
+
gemfile: 'rails_5.0'
|
27
|
+
- ruby: '3.1'
|
28
|
+
gemfile: 'rails_5.1'
|
29
|
+
- ruby: '3.1'
|
30
|
+
gemfile: 'rails_5.2'
|
31
|
+
env:
|
32
|
+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
|
33
|
+
|
34
|
+
steps:
|
35
|
+
- uses: actions/checkout@v2
|
36
|
+
- name: Set up Ruby
|
37
|
+
uses: ruby/setup-ruby@v1
|
38
|
+
with:
|
39
|
+
ruby-version: ${{ matrix.ruby }}
|
40
|
+
bundler-cache: true
|
41
|
+
- name: Run tests
|
42
|
+
run: bundle exec rake
|
data/.gitignore
CHANGED
@@ -1,23 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
coverage
|
13
|
-
doc/
|
14
|
-
lib/bundler/man
|
15
|
-
pkg
|
16
|
-
rdoc
|
17
|
-
spec/reports
|
18
|
-
test/tmp
|
19
|
-
test/version_tmp
|
20
|
-
tmp
|
21
|
-
*.log
|
22
|
-
gemfiles/*.gemfile.lock
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/_yardoc/
|
4
|
+
/coverage/
|
5
|
+
/doc/
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/tmp/
|
9
|
+
/log/
|
10
|
+
|
11
|
+
# rspec failure tracking
|
23
12
|
.rspec_status
|
13
|
+
.ruby-version
|
14
|
+
Gemfile.lock
|
15
|
+
.circleci/config.processed.yml
|
16
|
+
|
17
|
+
/gemfiles/*.gemfile.lock
|
18
|
+
/gemfiles/.bundle
|
19
|
+
*.sqlite3
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# ActsAsFootprintable
|
2
|
-
|
2
|
+
|
3
|
+
[![Test](https://github.com/patorash/acts_as_footprintable/actions/workflows/test.yml/badge.svg)](https://github.com/patorash/acts_as_footprintable/actions/workflows/test.yml)
|
3
4
|
|
4
5
|
Acts As Footprintable is a Ruby Gem specifically written for Rails/ActiveRecord models.
|
5
6
|
The main goals of this gem are:
|
@@ -11,7 +12,7 @@ The main goals of this gem are:
|
|
11
12
|
|
12
13
|
## Installation
|
13
14
|
|
14
|
-
### Rails 5.x and
|
15
|
+
### Rails 5.x, 6.x and 7.0
|
15
16
|
|
16
17
|
Add this line to your application's Gemfile:
|
17
18
|
|
@@ -91,10 +92,7 @@ post_access_histories = @user.access_histories_for(Post, 10)
|
|
91
92
|
|
92
93
|
## Testing
|
93
94
|
|
94
|
-
|
95
|
-
They can be run with:
|
96
|
-
|
97
|
-
$ rake spec
|
95
|
+
$ bundle exec rake
|
98
96
|
|
99
97
|
## Contributing
|
100
98
|
|
data/Rakefile
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
-
require
|
2
|
+
require 'rake/testtask'
|
3
3
|
|
4
|
-
|
4
|
+
task :default => [:test]
|
5
5
|
|
6
|
-
|
6
|
+
Rake::TestTask.new do |test|
|
7
|
+
test.libs << 'lib'
|
8
|
+
test.libs << 'test'
|
9
|
+
test.test_files = Dir['test/**/*_test.rb']
|
10
|
+
test.warning = false
|
11
|
+
# test.verbose = true
|
12
|
+
end
|
@@ -18,12 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency '
|
22
|
-
spec.add_development_dependency 'rake', '>= 12.3.3'
|
21
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
23
22
|
spec.add_development_dependency 'timecop', '~> 0'
|
24
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
25
|
-
spec.add_development_dependency 'combustion', '~> 1.3'
|
26
|
-
spec.add_development_dependency 'pry', '~> 0'
|
27
23
|
spec.add_development_dependency 'database_cleaner', '~> 2.0'
|
28
|
-
spec.add_development_dependency 'rspec_junit_formatter', '~> 0.4.1'
|
29
24
|
end
|
data/gemfiles/rails_5.0.gemfile
CHANGED
data/gemfiles/rails_5.1.gemfile
CHANGED
data/gemfiles/rails_5.2.gemfile
CHANGED
data/gemfiles/rails_6.0.gemfile
CHANGED
data/gemfiles/rails_6.1.gemfile
CHANGED
@@ -1,11 +1,14 @@
|
|
1
|
-
|
1
|
+
require 'test_helper'
|
2
|
+
require 'acts_as_footprintable/footprintable'
|
3
|
+
|
4
|
+
describe ActsAsFootprintable::Footprintable do
|
2
5
|
|
3
6
|
it "should not be a footprintable" do
|
4
|
-
expect(NotFootprintable).
|
7
|
+
expect(NotFootprintable).wont_be :footprintable?
|
5
8
|
end
|
6
9
|
|
7
10
|
it "should be a footprintable" do
|
8
|
-
expect(Footprintable).
|
11
|
+
expect(Footprintable).must_be :footprintable?
|
9
12
|
end
|
10
13
|
|
11
14
|
describe 'leave footprints by footprinter' do
|
@@ -15,26 +18,26 @@ RSpec.describe ActsAsFootprintable::Footprintable, type: :model do
|
|
15
18
|
let(:footprintable2) { Footprintable.create!(:name => 'a 2nd footprinting model') }
|
16
19
|
|
17
20
|
it "should be leave footprints" do
|
18
|
-
expect(footprintable.leave_footprints(user)).
|
21
|
+
expect(footprintable.leave_footprints(user)).must_equal true
|
19
22
|
end
|
20
23
|
|
21
24
|
it "足跡の数が増えていること" do
|
22
|
-
expect
|
23
|
-
|
24
|
-
|
25
|
+
expect(footprintable.footprint_count).must_equal 0
|
26
|
+
footprintable.leave_footprints user
|
27
|
+
expect(footprintable.footprint_count).must_equal 1
|
25
28
|
end
|
26
29
|
|
27
30
|
it "10回アクセスしたら10になること" do
|
28
|
-
expect
|
29
|
-
|
30
|
-
|
31
|
+
expect(footprintable.footprint_count).must_equal 0
|
32
|
+
10.times { footprintable.leave_footprints user }
|
33
|
+
expect(footprintable.footprint_count).must_equal 10
|
31
34
|
end
|
32
35
|
|
33
36
|
it "複数人でアクセスしたら合計されること" do
|
34
|
-
expect
|
35
|
-
|
36
|
-
|
37
|
-
|
37
|
+
expect(footprintable.footprint_count).must_equal 0
|
38
|
+
5.times { footprintable.leave_footprints user }
|
39
|
+
5.times { footprintable.leave_footprints user2 }
|
40
|
+
expect(footprintable.footprint_count).must_equal 10
|
38
41
|
end
|
39
42
|
|
40
43
|
describe "期間指定をする" do
|
@@ -46,18 +49,18 @@ RSpec.describe ActsAsFootprintable::Footprintable, type: :model do
|
|
46
49
|
end
|
47
50
|
end
|
48
51
|
|
49
|
-
|
52
|
+
describe "1週間の場合" do
|
50
53
|
it "35の足跡があること" do
|
51
54
|
Timecop.travel(Time.parse("2013-09-30 10:00:00")) do
|
52
|
-
expect(footprintable.footprint_count_between(1.week.ago..Time.now)).
|
55
|
+
expect(footprintable.footprint_count_between(1.week.ago..Time.now)).must_equal 35
|
53
56
|
end
|
54
57
|
end
|
55
58
|
end
|
56
59
|
|
57
|
-
|
60
|
+
describe "1ヶ月の場合" do
|
58
61
|
it "150の足跡があること" do
|
59
62
|
Timecop.travel(Time.parse("2013-09-30 10:00:00")) do
|
60
|
-
expect(footprintable.footprint_count_between(1.month.ago..Time.now)).
|
63
|
+
expect(footprintable.footprint_count_between(1.month.ago..Time.now)).must_equal 150
|
61
64
|
end
|
62
65
|
end
|
63
66
|
end
|
@@ -67,7 +70,7 @@ RSpec.describe ActsAsFootprintable::Footprintable, type: :model do
|
|
67
70
|
describe "アクセスランキングを作成" do
|
68
71
|
let(:user) { User.create!(:name => 'i can footprint!') }
|
69
72
|
|
70
|
-
|
73
|
+
describe "件数と期間を制限" do
|
71
74
|
before do
|
72
75
|
(1..30).each do |index|
|
73
76
|
Timecop.travel(Time.parse("2013-09-#{index}")) do
|
@@ -80,9 +83,13 @@ RSpec.describe ActsAsFootprintable::Footprintable, type: :model do
|
|
80
83
|
month = Time.new(2013, 9, 1)
|
81
84
|
Footprintable.access_ranking(month.beginning_of_month...1.week.since(month), 5)
|
82
85
|
end
|
83
|
-
|
86
|
+
|
87
|
+
it 'アクセスランキングが取得できること' do
|
88
|
+
expect(subject).must_equal ({ 7 => 7, 6 => 6, 5 => 5, 4 => 4, 3 => 3 })
|
89
|
+
end
|
90
|
+
|
84
91
|
it '5件取得できること' do
|
85
|
-
expect(subject.count).
|
92
|
+
expect(subject.count).must_equal 5
|
86
93
|
end
|
87
94
|
end
|
88
95
|
end
|
@@ -1,17 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
1
2
|
require 'acts_as_footprintable/footprinter'
|
2
3
|
|
3
|
-
|
4
|
+
describe ActsAsFootprintable::Footprinter do
|
4
5
|
|
5
6
|
it "should not be a footprinter" do
|
6
|
-
expect(NotUser).
|
7
|
+
expect(NotUser).wont_be :footprinter?
|
7
8
|
end
|
8
9
|
|
9
10
|
it "should be a footprinter" do
|
10
|
-
expect(User).
|
11
|
+
expect(User).must_be :footprinter?
|
11
12
|
end
|
12
13
|
|
13
14
|
describe "ユーザーのアクセス履歴を" do
|
14
|
-
let
|
15
|
+
let(:user_1) { User.create!(name: "user_1") }
|
15
16
|
before do
|
16
17
|
(1..5).each do |index|
|
17
18
|
footprintable = Footprintable.create!(name: "footprintable#{index}")
|
@@ -23,38 +24,38 @@ RSpec.describe ActsAsFootprintable::Footprinter, type: :model do
|
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
26
|
-
|
27
|
+
describe "対象のモデル毎に" do
|
27
28
|
it "取得できること" do
|
28
|
-
expect(user_1.access_histories_for(Footprintable).count).
|
29
|
-
expect(user_1.access_histories_for(Footprintable).map { |footprint| footprint.footprintable.name }).
|
29
|
+
expect(user_1.access_histories_for(Footprintable).count).must_equal 5
|
30
|
+
expect(user_1.access_histories_for(Footprintable).map { |footprint| footprint.footprintable.name }).must_equal (1..5).to_a.reverse.map { |index| "footprintable#{index}" }
|
30
31
|
end
|
31
32
|
|
32
33
|
it "件数を絞り込めること" do
|
33
|
-
expect(user_1.access_histories_for(Footprintable, 3).count).
|
34
|
-
expect(user_1.access_histories_for(Footprintable, 3).map { |footprint| footprint.footprintable.name }).
|
34
|
+
expect(user_1.access_histories_for(Footprintable, 3).count).must_equal 3
|
35
|
+
expect(user_1.access_histories_for(Footprintable, 3).map { |footprint| footprint.footprintable.name }).must_equal (3..5).to_a.reverse.map { |index| "footprintable#{index}" }
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
38
|
-
|
39
|
+
describe "全てのモデルを通じて" do
|
39
40
|
it "取得できること" do
|
40
|
-
expect(user_1.access_histories.count).
|
41
|
+
expect(user_1.access_histories.count).must_equal 10
|
41
42
|
footprintable_names = (1..5).to_a.reverse.inject([]) do |results, index|
|
42
43
|
results.push "second_footprintable#{index}"
|
43
44
|
results.push "footprintable#{index}"
|
44
45
|
results
|
45
46
|
end
|
46
|
-
expect(user_1.access_histories.map { |footprint| footprint.footprintable.name }).
|
47
|
+
expect(user_1.access_histories.map { |footprint| footprint.footprintable.name }).must_equal footprintable_names
|
47
48
|
end
|
48
49
|
|
49
50
|
it "件数を絞り込める事" do
|
50
|
-
expect(user_1.access_histories(3).count).
|
51
|
+
expect(user_1.access_histories(3).count).must_equal 3
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
54
|
-
|
55
|
-
let
|
55
|
+
describe 'アクセス履歴のないユーザーの場合' do
|
56
|
+
let(:user_2) { User.create!(:name => "user_2") }
|
56
57
|
it '件数が0件であること' do
|
57
|
-
expect(user_2.access_histories_for(Footprintable).count).
|
58
|
+
expect(user_2.access_histories_for(Footprintable).count).must_equal 0
|
58
59
|
end
|
59
60
|
end
|
60
61
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,4 +1,13 @@
|
|
1
|
-
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'active_record'
|
3
|
+
|
4
|
+
require 'database_cleaner/active_record'
|
5
|
+
require "acts_as_footprintable"
|
6
|
+
require 'timecop'
|
7
|
+
|
8
|
+
Dir["#{Dir.pwd}/test/internal/app/models/*.rb"].each(&method(:require))
|
9
|
+
|
10
|
+
ActiveRecord::Base.establish_connection('adapter' => 'sqlite3', 'database' => ':memory:')
|
2
11
|
ActiveRecord::Schema.define do
|
3
12
|
create_table :footprints, :force => true do |t|
|
4
13
|
t.references :footprintable, :polymorphic => true
|
@@ -29,3 +38,16 @@ ActiveRecord::Schema.define do
|
|
29
38
|
t.string :name
|
30
39
|
end
|
31
40
|
end
|
41
|
+
|
42
|
+
DatabaseCleaner.strategy = :transaction
|
43
|
+
|
44
|
+
class Minitest::Spec
|
45
|
+
|
46
|
+
before :each do
|
47
|
+
DatabaseCleaner.start
|
48
|
+
end
|
49
|
+
|
50
|
+
after :each do
|
51
|
+
DatabaseCleaner.clean
|
52
|
+
end
|
53
|
+
end
|
metadata
CHANGED
@@ -1,87 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_footprintable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toyoaki Oko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '2.1'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '2.1'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 12.3.3
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 12.3.3
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: timecop
|
43
15
|
requirement: !ruby/object:Gem::Requirement
|
44
16
|
requirements:
|
45
17
|
- - "~>"
|
46
18
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
19
|
+
version: '13.0'
|
48
20
|
type: :development
|
49
21
|
prerelease: false
|
50
22
|
version_requirements: !ruby/object:Gem::Requirement
|
51
23
|
requirements:
|
52
24
|
- - "~>"
|
53
25
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
26
|
+
version: '13.0'
|
55
27
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '3.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '3.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: combustion
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '1.3'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '1.3'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: pry
|
28
|
+
name: timecop
|
85
29
|
requirement: !ruby/object:Gem::Requirement
|
86
30
|
requirements:
|
87
31
|
- - "~>"
|
@@ -108,29 +52,15 @@ dependencies:
|
|
108
52
|
- - "~>"
|
109
53
|
- !ruby/object:Gem::Version
|
110
54
|
version: '2.0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rspec_junit_formatter
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 0.4.1
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: 0.4.1
|
125
55
|
description: Rails gem to allowing records to leave footprints
|
126
56
|
email: chariderpato@gmail.com
|
127
57
|
executables: []
|
128
58
|
extensions: []
|
129
59
|
extra_rdoc_files: []
|
130
60
|
files:
|
131
|
-
- ".
|
61
|
+
- ".github/workflows/gem-push.yml"
|
62
|
+
- ".github/workflows/test.yml"
|
132
63
|
- ".gitignore"
|
133
|
-
- ".rspec"
|
134
64
|
- Gemfile
|
135
65
|
- LICENSE.txt
|
136
66
|
- README.md
|
@@ -142,6 +72,7 @@ files:
|
|
142
72
|
- gemfiles/rails_5.2.gemfile
|
143
73
|
- gemfiles/rails_6.0.gemfile
|
144
74
|
- gemfiles/rails_6.1.gemfile
|
75
|
+
- gemfiles/rails_7.0.gemfile
|
145
76
|
- lib/acts_as_footprintable.rb
|
146
77
|
- lib/acts_as_footprintable/extenders/footprintable.rb
|
147
78
|
- lib/acts_as_footprintable/extenders/footprinter.rb
|
@@ -151,17 +82,14 @@ files:
|
|
151
82
|
- lib/acts_as_footprintable/version.rb
|
152
83
|
- lib/generators/acts_as_footprintable/migration/migration_generator.rb
|
153
84
|
- lib/generators/acts_as_footprintable/migration/templates/active_record/migration.rb
|
154
|
-
-
|
155
|
-
-
|
156
|
-
-
|
157
|
-
-
|
158
|
-
-
|
159
|
-
-
|
160
|
-
-
|
161
|
-
-
|
162
|
-
- spec/internal/db/schema.rb
|
163
|
-
- spec/internal/log/.gitignore
|
164
|
-
- spec/spec_helper.rb
|
85
|
+
- test/footprintable_test.rb
|
86
|
+
- test/footprinter_test.rb
|
87
|
+
- test/internal/app/models/footprintable.rb
|
88
|
+
- test/internal/app/models/not_footprintable.rb
|
89
|
+
- test/internal/app/models/not_user.rb
|
90
|
+
- test/internal/app/models/second_footprintable.rb
|
91
|
+
- test/internal/app/models/user.rb
|
92
|
+
- test/test_helper.rb
|
165
93
|
homepage: https://github.com/patorash/acts_as_footprintable
|
166
94
|
licenses:
|
167
95
|
- MIT
|
@@ -181,19 +109,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
109
|
- !ruby/object:Gem::Version
|
182
110
|
version: '0'
|
183
111
|
requirements: []
|
184
|
-
rubygems_version: 3.1
|
112
|
+
rubygems_version: 3.0.3.1
|
185
113
|
signing_key:
|
186
114
|
specification_version: 4
|
187
115
|
summary: Rails gem to allowing records to leave footprints
|
188
116
|
test_files:
|
189
|
-
-
|
190
|
-
-
|
191
|
-
-
|
192
|
-
-
|
193
|
-
-
|
194
|
-
-
|
195
|
-
-
|
196
|
-
-
|
197
|
-
- spec/internal/db/schema.rb
|
198
|
-
- spec/internal/log/.gitignore
|
199
|
-
- spec/spec_helper.rb
|
117
|
+
- test/footprintable_test.rb
|
118
|
+
- test/footprinter_test.rb
|
119
|
+
- test/internal/app/models/footprintable.rb
|
120
|
+
- test/internal/app/models/not_footprintable.rb
|
121
|
+
- test/internal/app/models/not_user.rb
|
122
|
+
- test/internal/app/models/second_footprintable.rb
|
123
|
+
- test/internal/app/models/user.rb
|
124
|
+
- test/test_helper.rb
|
data/.circleci/config.yml
DELETED
@@ -1,218 +0,0 @@
|
|
1
|
-
version: 2.1
|
2
|
-
|
3
|
-
executors:
|
4
|
-
ruby:
|
5
|
-
parameters:
|
6
|
-
ruby_version:
|
7
|
-
default: '2.7.2'
|
8
|
-
type: enum
|
9
|
-
enum: ['2.5.8', '2.6.6', '2.7.2']
|
10
|
-
working_directory: ~/repo
|
11
|
-
docker:
|
12
|
-
- image: circleci/ruby:<< parameters.ruby_version >>-node-browsers
|
13
|
-
- image: circleci/postgres:11.2-alpine-postgis-ram
|
14
|
-
|
15
|
-
commands:
|
16
|
-
bundle_install:
|
17
|
-
parameters:
|
18
|
-
rails_version:
|
19
|
-
default: '6.1'
|
20
|
-
type: enum
|
21
|
-
enum: ['5.0', '5.1', '5.2', '6.0', '6.1']
|
22
|
-
steps:
|
23
|
-
- run: gem install bundler --version=2.1.4 -N
|
24
|
-
- run:
|
25
|
-
name: bundle install
|
26
|
-
command: |
|
27
|
-
export BUNDLE_GEMFILE=$PWD/gemfiles/rails_<< parameters.rails_version >>.gemfile
|
28
|
-
bundle check || bundle install --jobs=4 --retry=3
|
29
|
-
|
30
|
-
rspec:
|
31
|
-
parameters:
|
32
|
-
rails_version:
|
33
|
-
default: '6.1'
|
34
|
-
type: enum
|
35
|
-
enum: ['5.0', '5.1', '5.2', '6.0', '6.1']
|
36
|
-
steps:
|
37
|
-
- run:
|
38
|
-
name: run tests
|
39
|
-
command: |
|
40
|
-
export BUNDLE_GEMFILE=$PWD/gemfiles/rails_<< parameters.rails_version >>.gemfile
|
41
|
-
mkdir /tmp/test-results
|
42
|
-
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | \
|
43
|
-
circleci tests split --split-by=timings)"
|
44
|
-
|
45
|
-
bundle exec rspec \
|
46
|
-
--format progress \
|
47
|
-
--format RspecJunitFormatter \
|
48
|
-
--out /tmp/test-results/rspec.xml \
|
49
|
-
--format progress \
|
50
|
-
$TEST_FILES
|
51
|
-
|
52
|
-
run_test:
|
53
|
-
parameters:
|
54
|
-
rails_version:
|
55
|
-
default: '6.1'
|
56
|
-
type: enum
|
57
|
-
enum: ['5.0', '5.1', '5.2', '6.0', '6.1']
|
58
|
-
steps:
|
59
|
-
- checkout
|
60
|
-
- bundle_install:
|
61
|
-
rails_version: << parameters.rails_version >>
|
62
|
-
- rspec:
|
63
|
-
rails_version: << parameters.rails_version >>
|
64
|
-
# collect reports
|
65
|
-
- store_test_results:
|
66
|
-
path: /tmp/test-results
|
67
|
-
- store_artifacts:
|
68
|
-
path: /tmp/test-results
|
69
|
-
destination: test-results
|
70
|
-
|
71
|
-
jobs:
|
72
|
-
test:
|
73
|
-
parameters:
|
74
|
-
ruby_version:
|
75
|
-
type: enum
|
76
|
-
enum: ['2.5.8', '2.6.6', '2.7.2']
|
77
|
-
rails_version:
|
78
|
-
type: enum
|
79
|
-
enum: ['5.0', '5.1', '5.2', '6.0', '6.1']
|
80
|
-
executor:
|
81
|
-
name: ruby
|
82
|
-
ruby_version: << parameters.ruby_version >>
|
83
|
-
parallelism: 1
|
84
|
-
steps:
|
85
|
-
- run_test:
|
86
|
-
rails_version: << parameters.rails_version >>
|
87
|
-
|
88
|
-
release:
|
89
|
-
executor:
|
90
|
-
name: ruby
|
91
|
-
parallelism: 1
|
92
|
-
steps:
|
93
|
-
- checkout
|
94
|
-
- add_ssh_keys:
|
95
|
-
fingerprints:
|
96
|
-
- "ac:6c:e5:dc:f5:60:53:57:0c:60:d3:32:98:98:0e:30"
|
97
|
-
- run: gem install bundler --version=2.1.4 -N
|
98
|
-
- run:
|
99
|
-
name: bundle install
|
100
|
-
command: bundle check || bundle install --jobs=4 --retry=3
|
101
|
-
- run:
|
102
|
-
name: RubyGems.org | Set credential
|
103
|
-
command: |
|
104
|
-
mkdir -p ~/.gem
|
105
|
-
echo ":rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
|
106
|
-
chmod 0600 ~/.gem/credentials
|
107
|
-
- run:
|
108
|
-
name: Setup git
|
109
|
-
command: |
|
110
|
-
git config push.default current
|
111
|
-
git config user.email "chariderpato@gmail.com"
|
112
|
-
git config user.name "patorash"
|
113
|
-
- run:
|
114
|
-
name: rake release
|
115
|
-
command: |
|
116
|
-
set +e
|
117
|
-
filename=$(for n in *; do printf '%s\n' "$n"; done | grep gemspec)
|
118
|
-
gem_name=`ruby -e "require 'rubygems'; spec = Gem::Specification::load('${filename}'); puts spec.name"`
|
119
|
-
gem_version=`ruby -e "require 'rubygems'; spec = Gem::Specification::load('${filename}'); puts spec.version"`
|
120
|
-
gem list --prerelease --all --remote $gem_name \
|
121
|
-
| grep -E "^${gem_name}" \
|
122
|
-
| sed -e "s/^.*(\(.*\)).*\$/\1/" \
|
123
|
-
| grep -q -v $gem_version
|
124
|
-
result=$?
|
125
|
-
if [ $result = 0 ]; then
|
126
|
-
bundle exec rake build
|
127
|
-
bundle exec rake release
|
128
|
-
fi
|
129
|
-
- run:
|
130
|
-
name: Delete credentials
|
131
|
-
command: |
|
132
|
-
shred -u ~/.gem/credentials
|
133
|
-
|
134
|
-
workflows:
|
135
|
-
build:
|
136
|
-
jobs:
|
137
|
-
- test:
|
138
|
-
name: 'Ruby 2.5.8-Rails 5.0'
|
139
|
-
ruby_version: '2.5.8'
|
140
|
-
rails_version: '5.0'
|
141
|
-
- test:
|
142
|
-
name: 'Ruby 2.6.6-Rails 5.0'
|
143
|
-
ruby_version: '2.6.6'
|
144
|
-
rails_version: '5.0'
|
145
|
-
- test:
|
146
|
-
name: 'Ruby 2.7.2-Rails 5.0'
|
147
|
-
ruby_version: '2.7.2'
|
148
|
-
rails_version: '5.0'
|
149
|
-
- test:
|
150
|
-
name: 'Ruby 2.5.8-Rails 5.1'
|
151
|
-
ruby_version: '2.5.8'
|
152
|
-
rails_version: '5.1'
|
153
|
-
- test:
|
154
|
-
name: 'Ruby 2.6.6-Rails 5.1'
|
155
|
-
ruby_version: '2.6.6'
|
156
|
-
rails_version: '5.1'
|
157
|
-
- test:
|
158
|
-
name: 'Ruby 2.7.2-Rails 5.1'
|
159
|
-
ruby_version: '2.7.2'
|
160
|
-
rails_version: '5.1'
|
161
|
-
- test:
|
162
|
-
name: 'Ruby 2.5.8-Rails 5.2'
|
163
|
-
ruby_version: '2.5.8'
|
164
|
-
rails_version: '5.2'
|
165
|
-
- test:
|
166
|
-
name: 'Ruby 2.6.6-Rails 5.2'
|
167
|
-
ruby_version: '2.6.6'
|
168
|
-
rails_version: '5.2'
|
169
|
-
- test:
|
170
|
-
name: 'Ruby 2.7.2-Rails 5.2'
|
171
|
-
ruby_version: '2.7.2'
|
172
|
-
rails_version: '5.2'
|
173
|
-
- test:
|
174
|
-
name: 'Ruby 2.5.8-Rails 6.0'
|
175
|
-
ruby_version: '2.5.8'
|
176
|
-
rails_version: '6.0'
|
177
|
-
- test:
|
178
|
-
name: 'Ruby 2.6.6-Rails 6.0'
|
179
|
-
ruby_version: '2.6.6'
|
180
|
-
rails_version: '6.0'
|
181
|
-
- test:
|
182
|
-
name: 'Ruby 2.7.2-Rails 6.0'
|
183
|
-
ruby_version: '2.7.2'
|
184
|
-
rails_version: '6.1'
|
185
|
-
- test:
|
186
|
-
name: 'Ruby 2.5.8-Rails 6.1'
|
187
|
-
ruby_version: '2.5.8'
|
188
|
-
rails_version: '6.1'
|
189
|
-
- test:
|
190
|
-
name: 'Ruby 2.6.6-Rails 6.1'
|
191
|
-
ruby_version: '2.6.6'
|
192
|
-
rails_version: '6.1'
|
193
|
-
- test:
|
194
|
-
name: 'Ruby 2.7.2-Rails 6.1'
|
195
|
-
ruby_version: '2.7.2'
|
196
|
-
rails_version: '6.1'
|
197
|
-
- release:
|
198
|
-
context:
|
199
|
-
- rubygems.org
|
200
|
-
requires:
|
201
|
-
- 'Ruby 2.5.8-Rails 5.0'
|
202
|
-
- 'Ruby 2.6.6-Rails 5.0'
|
203
|
-
- 'Ruby 2.7.2-Rails 5.0'
|
204
|
-
- 'Ruby 2.5.8-Rails 5.1'
|
205
|
-
- 'Ruby 2.6.6-Rails 5.1'
|
206
|
-
- 'Ruby 2.7.2-Rails 5.1'
|
207
|
-
- 'Ruby 2.5.8-Rails 5.2'
|
208
|
-
- 'Ruby 2.6.6-Rails 5.2'
|
209
|
-
- 'Ruby 2.7.2-Rails 5.2'
|
210
|
-
- 'Ruby 2.5.8-Rails 6.0'
|
211
|
-
- 'Ruby 2.6.6-Rails 6.0'
|
212
|
-
- 'Ruby 2.7.2-Rails 6.0'
|
213
|
-
- 'Ruby 2.5.8-Rails 6.1'
|
214
|
-
- 'Ruby 2.6.6-Rails 6.1'
|
215
|
-
- 'Ruby 2.7.2-Rails 6.1'
|
216
|
-
filters:
|
217
|
-
branches:
|
218
|
-
only: master
|
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
*.log
|
data/spec/spec_helper.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
## coding: utf-8
|
2
|
-
require 'rubygems'
|
3
|
-
require 'bundler/setup'
|
4
|
-
require 'combustion'
|
5
|
-
require 'database_cleaner/active_record'
|
6
|
-
require 'timecop'
|
7
|
-
require 'pry'
|
8
|
-
|
9
|
-
Combustion.initialize! :active_record
|
10
|
-
|
11
|
-
RSpec.configure do |config|
|
12
|
-
# Enable flags like --only-failures and --next-failure
|
13
|
-
config.example_status_persistence_file_path = ".rspec_status"
|
14
|
-
|
15
|
-
# Disable RSpec exposing methods globally on `Module` and `main`
|
16
|
-
config.disable_monkey_patching!
|
17
|
-
|
18
|
-
config.expect_with :rspec do |c|
|
19
|
-
c.syntax = :expect
|
20
|
-
end
|
21
|
-
|
22
|
-
config.before(:suite) do
|
23
|
-
DatabaseCleaner.strategy = :truncation
|
24
|
-
end
|
25
|
-
|
26
|
-
config.before :each do
|
27
|
-
DatabaseCleaner.start
|
28
|
-
end
|
29
|
-
|
30
|
-
config.after :each do
|
31
|
-
DatabaseCleaner.clean
|
32
|
-
end
|
33
|
-
end
|