trmnl_preview 0.5.1 → 0.5.2

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: 9cee09b6deb0fc063e5358d6d636536513dc31cba86f0fe4e71ee4d2e1d3a7a5
4
- data.tar.gz: 7b421d7ae1ace73b2e7370191e853946a857278f4f17332ace859bcf9581822a
3
+ metadata.gz: ff4e3150ccec1606d5368198055556d8650b129a682ae398fa7ff29e30e42009
4
+ data.tar.gz: d65492ec3e770e5203bbfd736651e56b052aa726dd1ead38bff93eccb2cbf023
5
5
  SHA512:
6
- metadata.gz: 5d97a1e0f9c461796aa141b88d7c4c2826e2693764c5cdba9013260162b9dad16220b47bd49b36b2f8cbbaeb2c985d1851f3780b33326bd9f518f1d9604774eb
7
- data.tar.gz: 16a38e4c92c20db294e80e6c729a3e7f12cdf5667785d80baabeb4ab93720a56b02a3346cb6efdae01d5d715b1919eab1d7fb4f34f40ffee2c7e96ce80158a69
6
+ metadata.gz: b7157fc2656c9228482b11b4806280a29b9ce6ae3017af3f57a79e70b3f8f00ee125671476542808fc8411a8381e0569a4cfd19e6057ed4c7fd6a21a8ebee016
7
+ data.tar.gz: c03598652d732f5922fbe7ea9b5b24c5d09e22ac2b1f793c511d59ca0739648fced9ee6c8579794298541669ffb42c5f6a37338ba523ad8b1dd193aac721a5ba
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.2
4
+
5
+ - Added `time_zone` project config option, which is injected into `trmnl.user` variables
6
+ - Fixed time zone to always be UTC, matching usetrmnl.com servers (#38)
7
+
3
8
  ## 0.5.1
4
9
 
5
10
  - Fixed `trmnl init`
data/README.md CHANGED
@@ -94,6 +94,9 @@ watch:
94
94
  custom_fields:
95
95
  station: "{{ env.ICAO }}" # interpolate $IACO environment variable
96
96
 
97
+ # Time zone IANA identifier to inject into trmnl.user; see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
98
+ time_zone: America/New_York
99
+
97
100
  # override variables
98
101
  variables:
99
102
  trmnl:
data/bin/trmnlp CHANGED
@@ -1,9 +1,12 @@
1
1
  #! /usr/bin/env ruby
2
2
 
3
- require "thor"
3
+ require 'thor'
4
4
 
5
5
  require_relative '../lib/trmnlp/cli'
6
6
 
7
+ # Force UTC to match usetrmnl.com server time zone
8
+ ENV['TZ'] = 'UTC'
9
+
7
10
  begin
8
11
  TRMNLP::CLI.start
9
12
  rescue TRMNLP::Error => e
@@ -36,6 +36,8 @@ module TRMNLP
36
36
  Liquid::Template.parse(value).render(custom_fields_with_env)
37
37
  end
38
38
 
39
+ def time_zone = @config['time_zone'] || 'UTC'
40
+
39
41
  private
40
42
 
41
43
  # for interpolating ENV vars into custom_fields
@@ -1,3 +1,4 @@
1
+ require 'active_support/time'
1
2
  require 'erb'
2
3
  require 'faraday'
3
4
  require 'filewatcher'
@@ -159,6 +160,11 @@ module TRMNLP
159
160
  end
160
161
 
161
162
  def base_trmnl_data
163
+ tz = ActiveSupport::TimeZone.find_tzinfo(config.project.time_zone)
164
+ time_zone_iana = tz.name
165
+ time_zone_name = ActiveSupport::TimeZone::MAPPING.invert[time_zone_iana] || time_zone_iana
166
+ utc_offset = tz.utc_offset
167
+
162
168
  {
163
169
  'trmnl' => {
164
170
  'user' => {
@@ -166,9 +172,9 @@ module TRMNLP
166
172
  'first_name' => 'first_name',
167
173
  'last_name' => 'last_name',
168
174
  'locale' => 'en',
169
- 'time_zone' => 'Eastern Time (US & Canada)',
170
- 'time_zone_iana' => 'America/New_York',
171
- 'utc_offset' => -14400
175
+ 'time_zone' => time_zone_name,
176
+ 'time_zone_iana' => time_zone_iana,
177
+ 'utc_offset' => utc_offset,
172
178
  },
173
179
  'device' => {
174
180
  'friendly_id' => 'ABC123',
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TRMNLP
4
- VERSION = "0.5.1".freeze
4
+ VERSION = "0.5.2".freeze
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trmnl_preview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rockwell Schrock
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-17 00:00:00.000000000 Z
10
+ date: 2025-05-09 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: sinatra