revision_plate 0.1.3 → 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
2
  SHA256:
3
- metadata.gz: 6bc128e2a63da131bdb0d0bf5ed9c99963b9c2c4a1d7da62ff898874852e5b09
4
- data.tar.gz: e604795fa2182370168f14f591c9a29e0b3dc618b06510738bc9addc03ab7434
3
+ metadata.gz: 4dc87741daa75c8fcd3bf00353862feb3c9ca6a9e05fc3622910db4db3493ceb
4
+ data.tar.gz: dc0e3322de61280af397fe60264ce81d849a8c2d165a87449ac5810da5186cc5
5
5
  SHA512:
6
- metadata.gz: c05bc4338ed61758f69d391cbd10f224629ed80a136fb12b888782219925124db81a37c1ade7ae78e5d0da556f4fd4f56e6a0d5df5a11297f09c24597b78706b
7
- data.tar.gz: 354c13119651d1c8c127d0680f46c46aa03c0cbbf599f9414aad08dcd02b1edabbd0c21825ebff4023d64f347491db0446bcb5897b86333057785c127bd5da12
6
+ metadata.gz: 0d414f95ad1c051069ee53a4d9f553e44b1ec1df5a110f5b8fff52387a021d61879a95ae4d9fc4c7e48bd5fcc33a3a89b4538116b3449b90694dab9cc33b3fe3
7
+ data.tar.gz: 104241447fb88c61daa6f85985c34c81b8ec32e11b33abc1b23c0dec38fb09a186320603d21c5a402431feb2fda7ec51bc180e8047bdb98ed9cb0502176bc961
@@ -1,3 +1,3 @@
1
1
  module RevisionPlate
2
- VERSION = "0.1.3"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: revision_plate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - Shota Fukumori (sora_h)
8
- bindir: bin
7
+ - Sorah Fukumori
8
+ bindir: exe
9
9
  cert_chain: []
10
- date: 2025-02-27 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: bundler
@@ -81,14 +81,11 @@ dependencies:
81
81
  version: '0'
82
82
  description: ''
83
83
  email:
84
- - sorah@cookpad.com
84
+ - her@sorah.jp
85
85
  executables: []
86
86
  extensions: []
87
87
  extra_rdoc_files: []
88
88
  files:
89
- - ".gitignore"
90
- - ".travis.yml"
91
- - Gemfile
92
89
  - LICENSE.txt
93
90
  - README.md
94
91
  - Rakefile
@@ -97,10 +94,6 @@ files:
97
94
  - lib/revision_plate/middleware.rb
98
95
  - lib/revision_plate/rails.rb
99
96
  - lib/revision_plate/version.rb
100
- - revision_plate.gemspec
101
- - test/app_test.rb
102
- - test/middleware_test.rb
103
- - test/test_helper.rb
104
97
  homepage: https://github.com/sorah/revision_plate
105
98
  licenses:
106
99
  - MIT
@@ -119,10 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
112
  - !ruby/object:Gem::Version
120
113
  version: '0'
121
114
  requirements: []
122
- rubygems_version: 3.6.2
115
+ rubygems_version: 3.6.9
123
116
  specification_version: 4
124
117
  summary: Rack middleware and application to show deployed application's revision (commit)
125
- test_files:
126
- - test/app_test.rb
127
- - test/middleware_test.rb
128
- - test/test_helper.rb
118
+ test_files: []
data/.gitignore DELETED
@@ -1,14 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
data/.travis.yml DELETED
@@ -1,21 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- sudo: false
4
-
5
- rvm:
6
- - 2.0.0
7
- - 2.1
8
- - 2.2
9
- - ruby-head
10
-
11
- matrix:
12
- fast_finish: true
13
- allow_failures:
14
- - rvm: "ruby-head"
15
-
16
- before_install:
17
- - gem i bundler -v 1.8.4
18
-
19
- script:
20
- - bundle exec rake
21
-
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in revision_plate.gemspec
4
- gemspec
@@ -1,27 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'revision_plate/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "revision_plate"
8
- spec.version = RevisionPlate::VERSION
9
- spec.authors = ["Shota Fukumori (sora_h)"]
10
- spec.email = ["sorah@cookpad.com"]
11
- spec.summary = %q{Rack middleware and application to show deployed application's revision (commit)}
12
- spec.description = nil
13
- spec.homepage = "https://github.com/sorah/revision_plate"
14
- spec.license = "MIT"
15
-
16
- spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
-
21
- spec.add_development_dependency "bundler", ">= 2.6"
22
- spec.add_development_dependency "rake", "~> 13.0"
23
- spec.add_development_dependency "minitest", "~> 5.5"
24
- spec.add_development_dependency "rack-test", "~> 2.2"
25
-
26
- spec.add_dependency "rack"
27
- end
data/test/app_test.rb DELETED
@@ -1,170 +0,0 @@
1
- require_relative './test_helper'
2
- require 'tmpdir'
3
-
4
- require 'revision_plate/app'
5
-
6
- class AppTest < Minitest::Spec
7
- include Rack::Test::Methods
8
- alias_method :response, :last_response
9
-
10
- describe 'app' do
11
- let(:app) { RevisionPlate::App.new(file) }
12
- let(:tmpdir) { Dir.mktmpdir('revision_plate_app_test') }
13
- let(:file) { Pathname.new(tmpdir).join('REVISION') }
14
-
15
- before do
16
- File.write file.to_s, "a"
17
- end
18
-
19
- describe 'with default' do
20
- let(:app) { RevisionPlate::App.new }
21
-
22
- describe 'with Rails' do
23
- before do
24
- RevisionPlate.const_set :Rails, Class.new {
25
- def self.root
26
- @root
27
- end
28
- def self.root=(o)
29
- @root = Pathname.new(o)
30
- end
31
- }.tap { |klass|
32
- klass.root = tmpdir
33
- }
34
- end
35
-
36
- after do
37
- RevisionPlate.send :remove_const, :Rails
38
- end
39
-
40
- it 'returns RAILS_ROOT/REVISION' do
41
- get '/'
42
- assert_equal 200, response.status
43
- assert_equal "a\n", response.body
44
- end
45
-
46
- describe 'HEAD request' do
47
- it 'returns 200' do
48
- head '/'
49
- assert_equal 200, response.status
50
- assert_equal '', response.body
51
- end
52
- end
53
- end
54
-
55
- describe 'without Rails' do
56
- it "raises error" do
57
- assert_raises(ArgumentError) { app }
58
- end
59
- end
60
- end
61
-
62
- describe 'with path' do
63
- let(:app) { RevisionPlate::App.new(file, path: '/site/sha') }
64
-
65
- it "won't respond to request to invalid path" do
66
- get '/site/sha'
67
- assert_equal 200, response.status
68
- assert_equal "a\n", response.body
69
-
70
- head '/site/sha'
71
- assert_equal 200, response.status
72
- assert_equal "", response.body
73
-
74
- post '/site/sha'
75
- assert_equal 404, response.status
76
-
77
- get '/site/sha/a'
78
- assert_equal 404, response.status
79
-
80
- head '/site/sha/a'
81
- assert_equal 404, response.status
82
-
83
- get '/'
84
- assert_equal 404, response.status
85
- end
86
- end
87
-
88
- it 'returns specified file' do
89
- get '/'
90
- assert_equal 200, response.status
91
- assert_equal "a\n", response.body
92
- end
93
-
94
- it 'returns same revision even if updated' do
95
- app # ensure to instantiate
96
- File.write file.to_s, "b\n"
97
-
98
- get '/'
99
- assert_equal 200, response.status
100
- assert_equal "a\n", response.body
101
- end
102
-
103
- it 'returns 404 for POST request' do
104
- post '/'
105
- assert_equal 404, response.status
106
- end
107
-
108
- it 'returns 200 for HEAD request' do
109
- head '/'
110
- assert_equal 200, response.status
111
- assert_equal '', response.body
112
- end
113
-
114
- it 'returns 404 if removed' do
115
- app # ensure to instantiate
116
- file.unlink
117
-
118
- get '/'
119
- assert_equal 404, response.status
120
- assert_equal "REVISION_FILE_REMOVED\n", response.body
121
- end
122
-
123
- it 'returns 404 for HEAD request if removed' do
124
- app # ensure to instantiate
125
- file.unlink
126
-
127
- head '/'
128
- assert_equal 404, response.status
129
- assert_equal '', response.body
130
- end
131
-
132
- it 'returns 404 if not exists' do
133
- file.unlink
134
- app # instantiate
135
-
136
- get '/'
137
- assert_equal 404, response.status
138
- assert_equal "REVISION_FILE_NOT_FOUND\n", response.body
139
- end
140
-
141
- it 'returns 404 for HEAD request if not exists' do
142
- file.unlink
143
- app # instantiate
144
-
145
- head '/'
146
- assert_equal 404, response.status
147
- assert_equal '', response.body
148
- end
149
-
150
- it 'returns 404 if created but it was not existed' do
151
- file.unlink
152
- app # instantiate
153
- File.write file.to_s, "b\n"
154
-
155
- get '/'
156
- assert_equal 404, response.status
157
- assert_equal "REVISION_FILE_NOT_FOUND\n", response.body
158
- end
159
-
160
- it 'returns 404 for HEAD request if created but it was not existed' do
161
- file.unlink
162
- app # instantiate
163
- File.write file.to_s, "b\n"
164
-
165
- head '/'
166
- assert_equal 404, response.status
167
- assert_equal '', response.body
168
- end
169
- end
170
- end
@@ -1,81 +0,0 @@
1
- require_relative './test_helper'
2
- require 'tempfile'
3
-
4
- require 'revision_plate/middleware'
5
-
6
- module RevisionPlate
7
- AppOriginal = App
8
- end
9
-
10
- class AppTest < Minitest::Spec
11
- include Rack::Test::Methods
12
- alias_method :response, :last_response
13
-
14
- describe 'middleware' do
15
- let(:tempfile) { Tempfile.new('revision_plate-middielware-test') }
16
-
17
- let(:nextapp) { -> (env) { [200, {'content-type' => 'text/plain'}, ['hi']] } }
18
- let(:mockapp) do
19
- Class.new do
20
- def self.instances
21
- @instances ||= []
22
- end
23
-
24
- def initialize(file, **options)
25
- @file = file
26
- @options = options
27
- self.class.instances << self
28
- end
29
-
30
- attr_reader :file, :options
31
-
32
- def call(env)
33
- [200, {'content-type' => 'text/plain'}, "deadbeef"]
34
- end
35
-
36
- const_set(:ACCEPT_METHODS, %w[GET HEAD].freeze)
37
- end
38
- end
39
-
40
- let(:app) { RevisionPlate::Middleware.new(nextapp, '/site/sha', tempfile.path, opt: :option) }
41
-
42
- before do
43
- RevisionPlate.send(:remove_const, :App)
44
- RevisionPlate.const_set(:App, mockapp)
45
- end
46
-
47
- after do
48
- RevisionPlate.send(:remove_const, :App)
49
- RevisionPlate.const_set(:App, RevisionPlate::AppOriginal)
50
- end
51
-
52
- it 'instantiates App with proper argument' do
53
- app
54
-
55
- assert_equal 1, mockapp.instances.size
56
- assert_equal({opt: :option}, mockapp.instances.first.options)
57
- assert_equal tempfile.path, mockapp.instances.first.file
58
- end
59
-
60
- it 'pass-through requests to nextapp' do
61
- get '/'
62
- assert_equal 'hi', response.body
63
- post '/'
64
- assert_equal 'hi', response.body
65
- get '/site'
66
- assert_equal 'hi', response.body
67
- post '/site/sha'
68
- assert_equal 'hi', response.body
69
- end
70
-
71
- it 'pass requests to RevisionPlate::App on specific path' do
72
- get '/site/sha'
73
- assert_equal 'deadbeef', response.body
74
-
75
- head '/site/sha'
76
- assert_equal 200, response.status
77
- assert_equal 'deadbeef', response.body
78
- end
79
- end
80
- end
81
-
data/test/test_helper.rb DELETED
@@ -1,4 +0,0 @@
1
- require 'minitest'
2
- require 'minitest/spec'
3
- require 'rack/test'
4
- require "minitest/autorun"