vagrant-timezone 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fabe1cb7c62e60b6864470c887ff40b229afc716
4
- data.tar.gz: 10543277db6591d66099adb5a56dcda7d02ae4dc
3
+ metadata.gz: 4f5e50694d3d8b0660f8948191821fbe71f9467d
4
+ data.tar.gz: 3cf304ddc2e8acef5a127dac46ebd91f70ca1654
5
5
  SHA512:
6
- metadata.gz: f171a78592aed04ce0e530d9bd84f05fb810266849990a94f1ee71eb312a8490e57ac4413506b8c4df6ab6b7bd0c7880143f6a3c0a5d86be7a4ae63bef0613f5
7
- data.tar.gz: 256d470f0a5752aef5b85c507d5b3b101feea1f858b9dc3f40a2faaaf85455143f7e996d23b4c9d1941aa436572718e2d6bb6c9f7ae3e311dbe416e88370f111
6
+ metadata.gz: 19d1dc0c714ae91508fa2019ff37675365978d5eea4a9f84ef026529f2ff8e7e62cbb16b929fc54b7c4b98ce1962c75d2bff3b44d2b1d079dcca3c900225fd96
7
+ data.tar.gz: 825960e499203d008277a5c1ec1fa5622c8691d833577c97fb156a4a1b0b07b9ff9d618563ee701559c118238430252a069c1f180e9d4f81c809286ac54e4f26
data/.travis.yml CHANGED
@@ -8,7 +8,7 @@ before_install:
8
8
  bundler_args: --without=development
9
9
 
10
10
  rvm: 2.0.0
11
- env: VAGRANT_VERSION=v1.6.5
11
+ env: VAGRANT_VERSION=v1.7.4
12
12
  matrix:
13
13
  include:
14
14
  - env: VAGRANT_VERSION=v1.2.7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 1.1.0 / 2015-10-01
2
+
3
+ Features:
4
+
5
+ - Add option (`config.timezone.value = :host`) to synchronize the guest timezone with the host ([GH-2][])
6
+
7
+ [GH-2]: https://github.com/tmatilai/vagrant-proxyconf/issues/2 "Issue 2"
8
+
1
9
  # 1.0.0 / 2014-10-27
2
10
 
3
11
  Features:
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'vagrant',
4
4
  git: 'https://github.com/mitchellh/vagrant.git',
5
- ref: ENV.fetch('VAGRANT_VERSION', 'v1.6.5')
5
+ ref: ENV.fetch('VAGRANT_VERSION', 'v1.7.4')
6
6
 
7
7
  gem 'rake'
8
8
  gem 'rspec', '~> 3.1'
data/README.md CHANGED
@@ -31,6 +31,10 @@ end
31
31
 
32
32
  The value can be anything that the [tz database supports](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones) (the "TZ" column). For example "UTC" or "Europe/Helsinki".
33
33
 
34
+ ### Matching the Host Timezone
35
+
36
+ If the special symbol `:host` is passed at the parameter (`config.timezone.value = :host`), the plugin will attempt to set the guest timezone offset to match the current offset of the host. Because of limitations in Ruby's ability to get the named timezone from the host, it will instead convert the host's timezone offset to a calculated offset from UTC. So for example, on the west coast of the USA the calculated timezone might be `Etc/GMT+8`. After a change in the host's timezone (including a change due to Daylight Savings Time taking effect), the next time the Vagrantfile is run the guest clock will be updated to match. Note that this functionality has only been tested with an OS X host and Linux guest.
37
+
34
38
  ## Compatibility
35
39
 
36
40
  This plugin requires Vagrant 1.2 or newer ([downloads](https://www.vagrantup.com/downloads)).
@@ -1,4 +1,5 @@
1
1
  require 'vagrant'
2
+ require 'time'
2
3
 
3
4
  module VagrantPlugins
4
5
  module TimeZone
@@ -6,7 +7,7 @@ module VagrantPlugins
6
7
  #
7
8
  # @!parse class Config < Vagrant::Plugin::V2::Config; end
8
9
  class Config < Vagrant.plugin('2', :config)
9
- attr_accessor :value
10
+ attr_reader :value
10
11
 
11
12
  def initialize
12
13
  super
@@ -14,6 +15,20 @@ module VagrantPlugins
14
15
  @value = UNSET_VALUE
15
16
  end
16
17
 
18
+ def value= value
19
+ if value == :host
20
+ # Get the offset of the current timezone of the host. Ruby doesn't reliably
21
+ # detect the named timezone, so we have to use the hour offset. Note that when
22
+ # DST changes, etc, this offset will change.
23
+
24
+ # We set timezone offset negative to match POSIX standards
25
+ # https://github.com/eggert/tz/blob/master/etcetera
26
+ @value = sprintf("Etc/GMT%+d", -((Time.zone_offset(Time.now.zone)/60)/60))
27
+ else
28
+ @value = value
29
+ end
30
+ end
31
+
17
32
  def finalize!
18
33
  super
19
34
 
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module TimeZone
3
- VERSION = '1.0.0'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-timezone
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Teemu Matilainen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-27 00:00:00.000000000 Z
11
+ date: 2015-10-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Vagrant plugin that configures the time zone of a virtual machine
14
14
  email:
@@ -59,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  version: '0'
60
60
  requirements: []
61
61
  rubyforge_project:
62
- rubygems_version: 2.2.2
62
+ rubygems_version: 2.4.5.1
63
63
  signing_key:
64
64
  specification_version: 4
65
65
  summary: A Vagrant plugin that configures the time zone of a virtual machine