timenv 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +21 -0
- data/README.md +38 -0
- data/Rakefile +8 -0
- data/lib/timenv/version.rb +5 -0
- data/lib/timenv.rb +25 -0
- data/sig/timenv.rbs +4 -0
- metadata +55 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4e119556cc3118ef196bcdef54370297b77c33285cd1254f077d7992e840ad80
|
4
|
+
data.tar.gz: d33642cbb650aead6503e8d89c8df557f9f53a67a23af752d3d3d2cc84526291
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d582a8c0c2c70d23af5cb6d8b7ac49c8feaca61db6f60bb4f9911eac36f4d74b277811633aa699db10589d8c96b1eb9c9cbf31f8bdb7bb13013d2c13655e1dcd
|
7
|
+
data.tar.gz: 8e73c5e9613c932f9184b4e4b505c6dc1fe4c2aed37ce1d0824eba9dd39180c18f0aee6692ab46555a063bdc6f45ded7a2b07756b69fc9c95eaf2601eb44d7a3
|
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 TODO: Write your name
|
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,38 @@
|
|
1
|
+
# Timenv
|
2
|
+
|
3
|
+
Timenv is a gem that retrieves the current time. Additionally, it allows for easy modification of the current time through environment variables.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Install the gem and add to the application's Gemfile by executing:
|
8
|
+
|
9
|
+
$ bundle add timenv
|
10
|
+
|
11
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
12
|
+
|
13
|
+
$ gem install timenv
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
```
|
18
|
+
require 'timenv'
|
19
|
+
|
20
|
+
ENV['TIMENV'] = '2023/10/10 10:10:10"
|
21
|
+
|
22
|
+
puts "System time: #{Time.now}"
|
23
|
+
puts "Adjusted time using Timenv: #{Timenv.now}"
|
24
|
+
```
|
25
|
+
|
26
|
+
## Development
|
27
|
+
|
28
|
+
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.
|
29
|
+
|
30
|
+
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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
31
|
+
|
32
|
+
## Contributing
|
33
|
+
|
34
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/koheisg/timenv.
|
35
|
+
|
36
|
+
## License
|
37
|
+
|
38
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/lib/timenv.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "timenv/version"
|
4
|
+
|
5
|
+
require 'time'
|
6
|
+
|
7
|
+
module Timenv
|
8
|
+
class Error < StandardError; end
|
9
|
+
|
10
|
+
class Time
|
11
|
+
class << self
|
12
|
+
def now
|
13
|
+
::Time.parse(envtime)
|
14
|
+
rescue
|
15
|
+
::Time.now
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def envtime
|
21
|
+
ENV['TIMENV']
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/sig/timenv.rbs
ADDED
metadata
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: timenv
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- koheisg
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-08-18 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Timenv is a gem that retrieves the current time. Additionally, it allows
|
14
|
+
for easy modification of the current time through environment variables.
|
15
|
+
email:
|
16
|
+
- koheisg@hey.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- ".rspec"
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE.txt
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- lib/timenv.rb
|
27
|
+
- lib/timenv/version.rb
|
28
|
+
- sig/timenv.rbs
|
29
|
+
homepage: https://github.com/koheisg/timenv
|
30
|
+
licenses:
|
31
|
+
- MIT
|
32
|
+
metadata:
|
33
|
+
homepage_uri: https://github.com/koheisg/timenv
|
34
|
+
source_code_uri: https://github.com/koheisg/timenv
|
35
|
+
changelog_uri: https://github.com/koheisg/timenv/blob/main/CHANGELOG.md
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 3.2.0
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubygems_version: 3.4.13
|
52
|
+
signing_key:
|
53
|
+
specification_version: 4
|
54
|
+
summary: injection time gem
|
55
|
+
test_files: []
|