rails_ping 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 220a7f06e83abef1c414d7114ad8c8cd3e5f09f6af73099c9f5f893175927586
4
+ data.tar.gz: 2de0485caa5aab2033b8092d4adf57ee1adc711e7de534f8a2c01e2492f4341e
5
+ SHA512:
6
+ metadata.gz: 17cfdf390286bf5a83b4c8add7df313e77be017cbdfaf650ffb637d5874cb69d12ba452245f165f9c22ad852baab62ffa678607c777c8dc18eb3c045ec40ca37
7
+ data.tar.gz: 6dbabdaaf6cd73b28be27460025f7452e9856423c1bf4cff42c6db9d9aaec37c5009b6c235fcb869c0e6c72f82f4f8b507fd65d3d0e11f8d5b3399ee543654f9
@@ -0,0 +1,24 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ build:
11
+
12
+ runs-on: ubuntu-latest
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
+ - name: Build and test with Rake
21
+ run: |
22
+ gem install bundler
23
+ bundle install --jobs 4 --retry 3
24
+ bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,17 @@
1
+ Layout/LineLength:
2
+ Max: 120
3
+
4
+ Documentation:
5
+ Enabled: false
6
+
7
+ Style/HashEachMethods:
8
+ Enabled: true
9
+
10
+ Style/HashTransformKeys:
11
+ Enabled: true
12
+
13
+ Style/HashTransformValues:
14
+ Enabled: true
15
+
16
+ Style/ClassAndModuleChildren:
17
+ EnforcedStyle: compact
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.6.5
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.7.0
6
+ before_install: gem install bundler -v 2.1.2
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at benoit.lafontaine@doctolib.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in rails_ping.gemspec
6
+ gemspec
7
+
8
+ gem 'rails', '~> 5.2'
9
+ gem 'rake', '~> 12.0'
10
+ gem 'rspec', '~> 3.0'
11
+ gem 'rubocop'
data/Gemfile.lock ADDED
@@ -0,0 +1,160 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rails_ping (0.1.0)
5
+ rails
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actioncable (5.2.4.2)
11
+ actionpack (= 5.2.4.2)
12
+ nio4r (~> 2.0)
13
+ websocket-driver (>= 0.6.1)
14
+ actionmailer (5.2.4.2)
15
+ actionpack (= 5.2.4.2)
16
+ actionview (= 5.2.4.2)
17
+ activejob (= 5.2.4.2)
18
+ mail (~> 2.5, >= 2.5.4)
19
+ rails-dom-testing (~> 2.0)
20
+ actionpack (5.2.4.2)
21
+ actionview (= 5.2.4.2)
22
+ activesupport (= 5.2.4.2)
23
+ rack (~> 2.0, >= 2.0.8)
24
+ rack-test (>= 0.6.3)
25
+ rails-dom-testing (~> 2.0)
26
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
27
+ actionview (5.2.4.2)
28
+ activesupport (= 5.2.4.2)
29
+ builder (~> 3.1)
30
+ erubi (~> 1.4)
31
+ rails-dom-testing (~> 2.0)
32
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
33
+ activejob (5.2.4.2)
34
+ activesupport (= 5.2.4.2)
35
+ globalid (>= 0.3.6)
36
+ activemodel (5.2.4.2)
37
+ activesupport (= 5.2.4.2)
38
+ activerecord (5.2.4.2)
39
+ activemodel (= 5.2.4.2)
40
+ activesupport (= 5.2.4.2)
41
+ arel (>= 9.0)
42
+ activestorage (5.2.4.2)
43
+ actionpack (= 5.2.4.2)
44
+ activerecord (= 5.2.4.2)
45
+ marcel (~> 0.3.1)
46
+ activesupport (5.2.4.2)
47
+ concurrent-ruby (~> 1.0, >= 1.0.2)
48
+ i18n (>= 0.7, < 2)
49
+ minitest (~> 5.1)
50
+ tzinfo (~> 1.1)
51
+ arel (9.0.0)
52
+ ast (2.4.0)
53
+ builder (3.2.4)
54
+ concurrent-ruby (1.1.6)
55
+ crass (1.0.6)
56
+ diff-lcs (1.3)
57
+ erubi (1.9.0)
58
+ globalid (0.4.2)
59
+ activesupport (>= 4.2.0)
60
+ i18n (1.8.2)
61
+ concurrent-ruby (~> 1.0)
62
+ jaro_winkler (1.5.4)
63
+ loofah (2.4.0)
64
+ crass (~> 1.0.2)
65
+ nokogiri (>= 1.5.9)
66
+ mail (2.7.1)
67
+ mini_mime (>= 0.1.1)
68
+ marcel (0.3.3)
69
+ mimemagic (~> 0.3.2)
70
+ method_source (1.0.0)
71
+ mimemagic (0.3.4)
72
+ mini_mime (1.0.2)
73
+ mini_portile2 (2.4.0)
74
+ minitest (5.14.0)
75
+ nio4r (2.5.2)
76
+ nokogiri (1.10.9)
77
+ mini_portile2 (~> 2.4.0)
78
+ parallel (1.19.1)
79
+ parser (2.7.0.5)
80
+ ast (~> 2.4.0)
81
+ rack (2.2.2)
82
+ rack-test (1.1.0)
83
+ rack (>= 1.0, < 3)
84
+ rails (5.2.4.2)
85
+ actioncable (= 5.2.4.2)
86
+ actionmailer (= 5.2.4.2)
87
+ actionpack (= 5.2.4.2)
88
+ actionview (= 5.2.4.2)
89
+ activejob (= 5.2.4.2)
90
+ activemodel (= 5.2.4.2)
91
+ activerecord (= 5.2.4.2)
92
+ activestorage (= 5.2.4.2)
93
+ activesupport (= 5.2.4.2)
94
+ bundler (>= 1.3.0)
95
+ railties (= 5.2.4.2)
96
+ sprockets-rails (>= 2.0.0)
97
+ rails-dom-testing (2.0.3)
98
+ activesupport (>= 4.2.0)
99
+ nokogiri (>= 1.6)
100
+ rails-html-sanitizer (1.3.0)
101
+ loofah (~> 2.3)
102
+ railties (5.2.4.2)
103
+ actionpack (= 5.2.4.2)
104
+ activesupport (= 5.2.4.2)
105
+ method_source
106
+ rake (>= 0.8.7)
107
+ thor (>= 0.19.0, < 2.0)
108
+ rainbow (3.0.0)
109
+ rake (12.3.3)
110
+ rexml (3.2.4)
111
+ rspec (3.9.0)
112
+ rspec-core (~> 3.9.0)
113
+ rspec-expectations (~> 3.9.0)
114
+ rspec-mocks (~> 3.9.0)
115
+ rspec-core (3.9.1)
116
+ rspec-support (~> 3.9.1)
117
+ rspec-expectations (3.9.1)
118
+ diff-lcs (>= 1.2.0, < 2.0)
119
+ rspec-support (~> 3.9.0)
120
+ rspec-mocks (3.9.1)
121
+ diff-lcs (>= 1.2.0, < 2.0)
122
+ rspec-support (~> 3.9.0)
123
+ rspec-support (3.9.2)
124
+ rubocop (0.80.1)
125
+ jaro_winkler (~> 1.5.1)
126
+ parallel (~> 1.10)
127
+ parser (>= 2.7.0.1)
128
+ rainbow (>= 2.2.2, < 4.0)
129
+ rexml
130
+ ruby-progressbar (~> 1.7)
131
+ unicode-display_width (>= 1.4.0, < 1.7)
132
+ ruby-progressbar (1.10.1)
133
+ sprockets (4.0.0)
134
+ concurrent-ruby (~> 1.0)
135
+ rack (> 1, < 3)
136
+ sprockets-rails (3.2.1)
137
+ actionpack (>= 4.0)
138
+ activesupport (>= 4.0)
139
+ sprockets (>= 3.0.0)
140
+ thor (1.0.1)
141
+ thread_safe (0.3.6)
142
+ tzinfo (1.2.6)
143
+ thread_safe (~> 0.1)
144
+ unicode-display_width (1.6.1)
145
+ websocket-driver (0.7.1)
146
+ websocket-extensions (>= 0.1.0)
147
+ websocket-extensions (0.1.4)
148
+
149
+ PLATFORMS
150
+ ruby
151
+
152
+ DEPENDENCIES
153
+ rails (~> 5.2)
154
+ rails_ping!
155
+ rake (~> 12.0)
156
+ rspec (~> 3.0)
157
+ rubocop
158
+
159
+ BUNDLED WITH
160
+ 2.1.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Benoit Lafontaine
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # RailsPing
2
+
3
+ Simple ping enpoint displaying some information, for heroku appplications.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'rails_ping'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ ## enable runtime-dyno-metadata lab on your Heroku app
18
+
19
+
20
+ $ heroku labs:enable runtime-dyno-metadata
21
+
22
+
23
+ ## Usage
24
+
25
+ Once in your Gemfile, just go on `/ping` endpoint:
26
+
27
+ https://yourappurl/ping
28
+
29
+ or localy:
30
+ http://localhost:3000/ping
31
+
32
+
33
+
34
+
35
+ ## Development
36
+
37
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
38
+
39
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
40
+
41
+ ## Contributing
42
+
43
+ Bug reports and pull requests are welcome on GitHub at https://github.com/joel1di1/rails_ping. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/joel1di1/rails_ping/blob/master/CODE_OF_CONDUCT.md).
44
+
45
+
46
+ ## License
47
+
48
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
49
+
50
+ ## Code of Conduct
51
+
52
+ Everyone interacting in the RailsPing project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/rails_ping/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RailsPing::PingController < ActionController::Base
4
+ def ping
5
+ map = {
6
+ hostname: Socket.gethostname,
7
+ revision: ENV['HEROKU_SLUG_COMMIT'],
8
+ version: ENV['HEROKU_RELEASE_VERSION'],
9
+ created_at: ENV['HEROKU_RELEASE_CREATED_AT'],
10
+ application: ENV['HEROKU_APP_NAME'],
11
+ current_time: Time.current
12
+ }
13
+ render json: map
14
+ end
15
+ end
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'rails_ping'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/config/routes.rb ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.routes.draw do
4
+ scope module: 'rails_ping' do
5
+ get '/ping' => 'ping#ping'
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RailsPing::Engine < Rails::Engine; end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RailsPing
4
+ VERSION = '0.1.0'
5
+ end
data/lib/rails_ping.rb ADDED
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails'
4
+ require 'rails_ping/version'
5
+
6
+ module RailsPing
7
+ # Our host application root path
8
+ # We set this when the engine is initialized
9
+ mattr_accessor :app_root
10
+
11
+ # Yield self on setup for nice config blocks
12
+ def self.setup
13
+ yield self
14
+ end
15
+ end
16
+
17
+ # Require our engine
18
+ require 'rails_ping/engine'
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/rails_ping/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'rails_ping'
7
+ spec.version = RailsPing::VERSION
8
+ spec.authors = ['Benoit Lafontaine']
9
+ spec.email = ['joel1di1@gmail.com']
10
+
11
+ spec.summary = 'Generate a ping endpoint that response and display some informations'
12
+ spec.description = '----'
13
+ spec.homepage = 'https://github.com/joel1di1/rails_ping'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
16
+
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = 'https://github.com/joel1di1/rails_ping'
19
+
20
+ spec.add_dependency('rails', '~> 5.0')
21
+
22
+ # Specify which files should be added to the gem when it is released.
23
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ end
27
+ spec.bindir = 'exe'
28
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ['lib']
30
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_ping
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Benoit Lafontaine
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-03-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '5.0'
27
+ description: "----"
28
+ email:
29
+ - joel1di1@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".github/workflows/ruby.yml"
35
+ - ".gitignore"
36
+ - ".rspec"
37
+ - ".rubocop.yml"
38
+ - ".ruby-version"
39
+ - ".travis.yml"
40
+ - CODE_OF_CONDUCT.md
41
+ - Gemfile
42
+ - Gemfile.lock
43
+ - LICENSE.txt
44
+ - README.md
45
+ - Rakefile
46
+ - app/controllers/rails_ping/ping_controller.rb
47
+ - bin/console
48
+ - bin/setup
49
+ - config/routes.rb
50
+ - lib/rails_ping.rb
51
+ - lib/rails_ping/engine.rb
52
+ - lib/rails_ping/version.rb
53
+ - rails_ping.gemspec
54
+ homepage: https://github.com/joel1di1/rails_ping
55
+ licenses:
56
+ - MIT
57
+ metadata:
58
+ homepage_uri: https://github.com/joel1di1/rails_ping
59
+ source_code_uri: https://github.com/joel1di1/rails_ping
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 2.3.0
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubygems_version: 3.0.3
76
+ signing_key:
77
+ specification_version: 4
78
+ summary: Generate a ping endpoint that response and display some informations
79
+ test_files: []