Import Upstream version 1.0.5

parents
# et-orbi CHANGELOG.md
## et-orbi 1.0.5 released 2017-06-23
- Rework EtOrbi.make_time
- Let EtOrbi.make_time accept array or array of args
- Implement EoTime#localtime(zone=nil)
- Move Fugit#wday_in_month into EoTime
- Clarify #add, #subtract, #- and #+ contracts
- Ensure #add and #subtract return `self`
- Make #inc(seconds, direction) public
- Implement EoTime#utc?
## et-orbi 1.0.4 released 2017-05-10
- Survive older versions of TZInfo with poor `<=>` impl, gh-1
## et-orbi 1.0.3 released 2017-04-07
- Let not #render_nozone_time fail when local_tzone is nil
## et-orbi 1.0.2 released 2017-03-24
- Enhance no zone ArgumentError data
- Separate module methods from EoTime methods
## et-orbi 1.0.1 released 2017-03-22
- Detail Rails and Active Support info in nozone err
## et-orbi 1.0.0 released 2017-03-22
- First release for rufus-scheduler
## et-orbi 0.9.5 released 2017-03-17
- Empty, initial release, 圓さんの家で
# et-orbi credits
* Jeremy Strouse https://github.com/jstrouse help alleviate issue with older versions of TZInfo
## since rufus-scheduler
Many thanks to all the rufus-scheduler contributors and people who gave feedback.
https://github.com/jmettraux/rufus-scheduler/blob/master/CREDITS.txt
Copyright (c) 2017-2017, John Mettraux, jmettraux+flor@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## gem tasks ##
NAME = \
$(shell ruby -e "s = eval(File.read(Dir['*.gemspec'][0])); puts s.name")
VERSION = \
$(shell ruby -e "s = eval(File.read(Dir['*.gemspec'][0])); puts s.version")
count_lines:
find lib -name "*.rb" | xargs cat | ruby -e "p STDIN.readlines.count { |l| l = l.strip; l[0, 1] != '#' && l != '' }"
cl: count_lines
gemspec_validate:
@echo "---"
ruby -e "s = eval(File.read(Dir['*.gemspec'].first)); s.validate"
@echo "---"
name: gemspec_validate
@echo "$(NAME) $(VERSION)"
build: gemspec_validate
gem build $(NAME).gemspec
mkdir -p pkg
mv $(NAME)-$(VERSION).gem pkg/
push: build
gem push pkg/$(NAME)-$(VERSION).gem
.PHONY: build push
# et-orbi
[![Build Status](https://secure.travis-ci.org/floraison/et-orbi.svg)](http://travis-ci.org/floraison/et-orbi)
[![Gem Version](https://badge.fury.io/rb/et-orbi.svg)](http://badge.fury.io/rb/et-orbi)
Time zones for [fugit](https://github.com/floraison/fugit) and for [rufus-scheduler](https://github.com/jmettraux/rufus-scheduler). Urbi et Orbi.
`EtOrbi::EoTime` instances quack like Ruby `Time` instances, but their `#zone` returns a `TZInfo::TimeZone` instance.
Getting `EoTime` instances:
```ruby
require 'et-orbi'
EtOrbi.now
# => #<EtOrbi::EoTime:0x007f94d94 ...>
EtOrbi.parse('2017-12-13 13:00:00 America/Jamaica')
# => #<EtOrbi::EoTime:0x007f94d90 @zone=#<TZInfo::DataTimezone: America/Jamaica>...>
EtOrbi.make_time(Time.now)
# => #<EtOrbi::EoTime:0x007f94d91 ...>
EtOrbi.make_time(2017, 1, 31, 12, 'Europe/Moscow').to_debug_s
# => 'ot 2017-01-31 12:00:00 +03:00 dst:false'
EtOrbi::EoTime.new(0, 'UTC').to_s
# => "1970-01-01 00:00:00 +0000"
EtOrbi::EoTime.new(0, 'Europe/Moscow').to_s
# => "1970-01-01 03:00:00 +0300"
```
Helper methods:
```ruby
require 'et-orbi'
EtOrbi.get_tzone('Europe/Vilnius')
# => #<TZInfo::DataTimezone: Europe/Vilnius>
EtOrbi.local_tzone
# => #<TZInfo::TimezoneProxy: Asia/Tokyo>
EtOrbi.platform_info
# => "(etz:nil,tnz:\"JST\",tzid:nil,rv:\"2.2.6\",rp:\"x86_64-darwin14\",eov:\"1.0.1\",
# rorv:nil,astz:nil,debian:nil,centos:nil,osx:\"Asia/Tokyo\")"
#
# etz: ENV['TZ']
# tnz: Time.now.zone
# tzid: defined?(TZInfo::Data)
# rv: RUBY_VERSION
# rp: RUBY_PLATFORM
# eov: EtOrbi::VERSION
# rorv: Rails::VERSION::STRING
# astz: ActiveSupport provided Time.zone
```
### Rails?
If Rails is present, `Time.zone` is provided and EtOrbi will use it.
Rails sets its timezone under `config/application.rb`.
## Related projects
### Sister projects
* [rufus-scheduler](https://github.com/jmettraux/rufus-scheduler) - a cron/at/in/every/interval in-process scheduler, in fact, it's the father project to this fugit project
* [fugit](https://github.com/floraison/fugit) - Time tools for flor and the floraison project. Cron parsing and occurence computing. Timestamps and more.
## LICENSE
MIT, see [LICENSE.txt](LICENSE.txt)
Gem::Specification.new do |s|
s.name = 'et-orbi'
s.version = File.read(
File.expand_path('../lib/et-orbi.rb', __FILE__)
).match(/ VERSION *= *['"]([^'"]+)/)[1]
s.platform = Gem::Platform::RUBY
s.authors = [ 'John Mettraux' ]
s.email = [ 'jmettraux+flor@gmail.com' ]
s.homepage = 'http://github.com/floraison/et-orbi'
s.license = 'MIT'
s.summary = 'time with zones'
s.description = %{
Time zones for fugit and rufus-scheduler. Urbi et Orbi.
}.strip
#s.files = `git ls-files`.split("\n")
s.files = Dir[
'Makefile',
'lib/**/*.rb', #'spec/**/*.rb', 'test/**/*.rb',
'*.gemspec', '*.txt', '*.md'
]
s.add_runtime_dependency 'tzinfo'
#s.add_runtime_dependency 'raabro', '>= 1.1.3'
s.add_development_dependency 'rspec', '~> 3.4'
s.require_path = 'lib'
end
This diff is collapsed.
require 'et-orbi'
require 'et-orbi'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment