zone 0.1.0 → 0.1.1

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +114 -14
  3. data/exe/zone +14 -2
  4. data/lib/zone/version.rb +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec4bf54c71190831471974566598f5f99d1398588eb781d6bf05d5b09e8d208b
4
- data.tar.gz: b2984b02b1e3b384bfc2593e3f24e9fb79507eec7bd7b4fa33981023b2daeda7
3
+ metadata.gz: 48ffc5f23c1380e609e45c5f5a934b73663f697ca2a42326db020abafe1b73d4
4
+ data.tar.gz: d0c55e0563de05b15b01ca129476f59fe2c61129c997dc3c505bf7f9c40d8b5c
5
5
  SHA512:
6
- metadata.gz: 1ab5600b1439b2ff8692eaa08baf9c8687978f5c8c9e3639d1031c509fb45db59379f77359d76274c8030ca02bb7589c57ebf3692867a55188567a3c39b8c6a6
7
- data.tar.gz: 2223d049e9c21f2805c0ab411c9623a11fd5da50a05d742e48d9dfc0edff90a2fe8481db551d3f46a19f09103a35156a0b91d89419fc553ac18b1d18ddb824e9
6
+ metadata.gz: a9dd64f6fe00be2fd8999e6dbc20310c266ef2089ce81e367c34cc7f39e38fc9cf1d70471eff3f70f18d2ad0e37d4b68d3fc57019cd1ee289135bb7751864a10
7
+ data.tar.gz: 6c99b5f7ca51350827e6bea1c7dee0b0226069679f79c1f16685517ad0b7565b1cea9ecc89a7c556ae0121ec20998ff71126328c905e13357aa6f14832050156
data/README.md CHANGED
@@ -1,39 +1,139 @@
1
1
  # Zone
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
3
+ Timezone conversion and datetime formatting for the command line
4
4
 
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/zone`. To experiment with that code, run `bin/console` for an interactive prompt.
5
+ ```bash
6
+ # Fuzzy timezone matching
7
+ zone --zone tokyo 2025-11-05T02:40:32+00:00
8
+ # => 2025-11-05T11:40:32+09:00
9
+
10
+ # Process CSV timestamps
11
+ cat data.csv | zone --index 3 --zone pacific --pretty
12
+ # => customer,purchase_date,amount
13
+ # => alice,42.00,Nov 04 - 06:40 PM PST
14
+
15
+ # Make logs readable
16
+ tail -f app.log | zone --pretty --zone local
17
+ # => Nov 04 - 09:15 PM EST [ERROR] Database connection timeout
18
+ ```
6
19
 
7
20
  ## Installation
8
21
 
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
22
+ ```bash
23
+ gem install zone
24
+ ```
25
+
26
+ Or with Bundler:
27
+
28
+ ```bash
29
+ bundle add zone
30
+ ```
31
+
32
+ ## Usage
10
33
 
11
- Install the gem and add to the application's Gemfile by executing:
34
+ Convert timezones:
12
35
 
13
36
  ```bash
14
- bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
37
+ zone --zone 'New York' '2025-11-05T02:40:32+00:00'
38
+ # => 2025-11-04T21:40:32-05:00
15
39
  ```
16
40
 
17
- If bundler is not being used to manage dependencies, install the gem by executing:
41
+ Change formats:
18
42
 
19
43
  ```bash
20
- gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
44
+ zone --unix 'Nov 04 - 06:42 PM PST'
45
+ # => 1730775720
46
+
47
+ zone --strftime '%Y-%m-%d %H:%M' '2025-11-05T02:40:32+00:00'
48
+ # => 2025-11-05 02:40
21
49
  ```
22
50
 
23
- ## Usage
51
+ Process structured data:
52
+
53
+ ```bash
54
+ # Convert column 2, auto-detect delimiter
55
+ cat events.csv | zone --index 2 --zone UTC
56
+
57
+ # Skip header row
58
+ zone --headers --delimiter '\t' < data.tsv
59
+ ```
60
+
61
+ Multiple timestamps:
62
+
63
+ ```bash
64
+ zone 1730772120 1730858520 1730944920 --zone tokyo --pretty
65
+ # => Nov 05 - 11:42 AM JST
66
+ # => Nov 06 - 11:42 AM JST
67
+ # => Nov 07 - 11:42 AM JST
68
+ ```
69
+
70
+ ## Options
71
+
72
+ **Output Formats**
73
+
74
+ - `--iso8601` - ISO 8601 format (default)
75
+ - `--unix` - Unix timestamp
76
+ - `--pretty` - Human-readable (e.g., "Nov 04 - 06:40 PM PST")
77
+ - `--strftime FORMAT` - Custom format
24
78
 
25
- TODO: Write usage instructions here
79
+ **Timezones**
26
80
 
27
- ## Development
81
+ - `--zone TZ` - Convert to timezone (fuzzy matching)
82
+ - `--utc` - Convert to UTC
83
+ - `--local` - Convert to local time
28
84
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
85
+ **Data Processing**
86
+
87
+ - `--index N` - Column to convert (default: 1)
88
+ - `--delimiter PATTERN` - Field separator (auto-detected)
89
+ - `--headers` - Skip first line
90
+
91
+ **Other**
92
+
93
+ - `--verbose` - Show debug output
94
+ - `--help` - Show help
95
+
96
+ ## Examples
97
+
98
+ Analyze logs across timezones:
99
+
100
+ ```bash
101
+ grep "ERROR" app.log | zone --zone local --pretty
102
+ ```
103
+
104
+ Convert trading data:
105
+
106
+ ```bash
107
+ zone --zone 'New York' --strftime '%H:%M:%S' < trades.csv
108
+ ```
109
+
110
+ Quick conversions:
111
+
112
+ ```bash
113
+ zone --zone berlin "3pm PST"
114
+ # => 2025-11-05T00:00:00+01:00
115
+
116
+ zone --zone pacific now
117
+ # => 2025-11-04T16:42:15-08:00
118
+ ```
119
+
120
+ ## Timezone Matching
121
+
122
+ Zone uses fuzzy matching for timezone names:
123
+
124
+ ```bash
125
+ zone --zone pacific # => US/Pacific
126
+ zone --zone tokyo # => Asia/Tokyo
127
+ zone --zone europe # => Europe/London (first match)
128
+ zone --zone 'US/Eastern' # => US/Eastern (exact match)
129
+ ```
30
130
 
31
- 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).
131
+ Use `--verbose` to see which timezone was matched.
32
132
 
33
133
  ## Contributing
34
134
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/gillisd/zone.
135
+ Bug reports and pull requests are welcome on [GitHub](https://github.com/gillisd/zone).
36
136
 
37
137
  ## License
38
138
 
39
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
139
+ [MIT License](https://opensource.org/licenses/MIT)
data/exe/zone CHANGED
@@ -11,16 +11,28 @@ require 'date'
11
11
 
12
12
  options = { delimiter: nil, strftime: nil, iso8601: false, pretty: false, headers: false, unix: false, index: 1, zone: nil, utc: false, local: false }
13
13
  parser = OptionParser.new do |parser|
14
- parser.on '--index N', '-i N', Integer, 'Index of the field to convert (default: 1)'
15
- parser.on '--delimiter PATTERN', '-d', 'Field delimiter (default: space)'
14
+ parser.banner = "Usage: zone [options] [timestamps...]"
15
+ parser.separator ""
16
+ parser.separator "Output Formats:"
16
17
  parser.on '--iso8601', 'Output in ISO 8601 (default: true)'
17
18
  parser.on '--strftime FORMAT', '-f', 'Output format using strftime (default: none)'
18
19
  parser.on '--pretty', 'Output in pretty format (e.g., "Jan 02 - 03:04 PM")'
19
20
  parser.on '--unix', 'Output as Unix timestamp (default: false)'
21
+
22
+ parser.separator ""
23
+ parser.separator "Timezones:"
20
24
  parser.on '--zone TZ', 'Convert to time zone (default: local time zone)'
21
25
  parser.on '--local', 'Convert to local time zone (alias for --zone local)'
22
26
  parser.on '--utc', 'Convert to UTC time zone (alias for --zone UTC)'
27
+
28
+ parser.separator ""
29
+ parser.separator "Data Processing:"
30
+ parser.on '--index N', '-i N', Integer, 'Index of the field to convert (default: 1)'
31
+ parser.on '--delimiter PATTERN', '-d', 'Field delimiter (default: space)'
23
32
  parser.on '--headers', 'Skip the first line as headers'
33
+
34
+ parser.separator ""
35
+ parser.separator "Other:"
24
36
  parser.on '--verbose', '-v', 'Enable verbose/debug output'
25
37
  parser.on '--help', '-h', 'Show this help message' do
26
38
  puts parser
data/lib/zone/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zone
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Gillis