smt 0.1.2 → 0.2.0

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: 524d8bcd8769fa265493ad7563b715577bb5abc8091bfc81e86da405ef196d2a
4
- data.tar.gz: cabb8b09f93228c049e195abec578f1afaa59a40c0bffa92d0aaf45b1641df64
3
+ metadata.gz: ecf7aa29986f62a7cd6aa32b27cbe12c9b20b5017fe6180172a9d67696baf3bd
4
+ data.tar.gz: ba0ae7b542f03f3f6f8a976c45a917bda22c5c376c7fba17a563efb46ab7d0a9
5
5
  SHA512:
6
- metadata.gz: fc05b3883d1a98ea5fb40501548664466328a267aea14ca239d3d8d0eaf16e96cc7b23a27049ded2aded22d90acf175b496bbffc341fc691ccf4f0b94c6f64f9
7
- data.tar.gz: 5a7627d7f97328630723fb589b1600496adfde8c4d325c80ce21e89125f7ceb9f4ed1a66ea74137bcdf3bf85da429da9d5377b168e654a9fdef948387b2f821a
6
+ metadata.gz: d6d539fb81d2dff4826d739291249aea6ef8f7277853e8162014d589fb2d984ba0ef02337fbd8f927f3f2bf9734290783ac697772eecb8d69a0479281b380fb4
7
+ data.tar.gz: 0de688a31227832bc2dfc44c7ee1755e7a58f66802d79f2e9d754b7a3217270ac912126cd625c7dd24fa5b7346dfeb11bd8bc01b0a9ebf1d1b8ac4ffc3cb6561
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Smt
2
+ [![Ruby](https://github.com/aladac/smt/actions/workflows/main.yml/badge.svg)](https://github.com/aladac/smt/actions/workflows/main.yml)
2
3
 
3
4
  TODO: Delete this and the text below, and describe your gem
4
5
 
data/Rakefile CHANGED
@@ -1,12 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
5
 
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
- require 'rubocop/rake_task'
9
-
10
- RuboCop::RakeTask.new
11
-
12
- task default: %i[spec rubocop]
8
+ task default: %i[spec]
data/exe/smt CHANGED
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'active_support/all'
5
- require 'bundler'
6
- require 'colorize'
7
- require 'optparse'
8
- require 'smt'
4
+ require "active_support/all"
5
+ require "bundler"
6
+ require "colorize"
7
+ require "optparse"
8
+ require "smt"
9
9
 
10
10
  @input, @format = *Smt::Options.new.parse!
11
11
 
12
- @format ||= '%Y-%m-%d %H:%M:%S'
12
+ @format ||= "%Y-%m-%d %H:%M:%S"
13
13
 
14
14
  config = Smt::Config.load
15
15
 
@@ -17,7 +17,7 @@ time = @input ? Time.parse(@input) : Time.current
17
17
 
18
18
  return unless config
19
19
 
20
- max_length = config.map { |entry| entry[:time_zone].length }.max
20
+ max_length = config.map { |entry| entry[:label].length }.max
21
21
 
22
22
  config.each do |entry|
23
23
  Smt::Display.show(entry, @format, max_length, time)
data/lib/smt/display.rb CHANGED
@@ -4,7 +4,7 @@ module Smt
4
4
  class Display
5
5
  def self.show(entry, format, max_length, time)
6
6
  time_display = time.in_time_zone(entry[:time_zone]).strftime(format)
7
- formatted_time_zone = time.strftime(entry[:time_zone]).rjust(max_length)
7
+ formatted_time_zone = time.strftime(entry[:label]).rjust(max_length)
8
8
  formatted_time_display = time_display
9
9
 
10
10
  puts "#{formatted_time_zone} #{formatted_time_display}".colorize(entry[:color].to_sym)
data/lib/smt/options.rb CHANGED
@@ -6,29 +6,30 @@ module Smt
6
6
  Usage: smt [options]
7
7
  BANNER
8
8
 
9
- def initialize; end
9
+ def initialize
10
+ end
10
11
 
11
12
  def time_opts(opts)
12
- opts.on('-t', '--time TIME', 'Time to convert') do |time|
13
+ opts.on("-t", "--time TIME", "Time to convert") do |time|
13
14
  @input = time
14
15
  end
15
16
  end
16
17
 
17
18
  def format_opts(opts)
18
- opts.on('-f', '--format FORMAT', 'Time format') do |fmt|
19
+ opts.on("-f", "--format FORMAT", "Time format") do |fmt|
19
20
  @format = fmt
20
21
  end
21
22
  end
22
23
 
23
24
  def help_opts(opts)
24
- opts.on('-h', '--help', 'Display this screen') do
25
+ opts.on("-h", "--help", "Display this screen") do
25
26
  puts opts
26
27
  exit
27
28
  end
28
29
  end
29
30
 
30
31
  def list_opts(opts)
31
- opts.on('-l', '--list', 'List all timezones') do
32
+ opts.on("-l", "--list", "List all timezones") do
32
33
  puts ActiveSupport::TimeZone.all.map(&:name)
33
34
  exit
34
35
  end
@@ -36,7 +37,7 @@ module Smt
36
37
 
37
38
  def for_parse
38
39
  parser = OptionParser.new do |opts|
39
- opts.banner = 'Usage: smt [options]'
40
+ opts.banner = "Usage: smt [options]"
40
41
 
41
42
  help_opts(opts)
42
43
  time_opts(opts)
data/lib/smt/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Smt
4
- VERSION = '0.1.2'
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/smt.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'smt/version'
4
- require_relative 'smt/config'
5
- require_relative 'smt/options'
6
- require_relative 'smt/display'
3
+ require_relative "smt/version"
4
+ require_relative "smt/config"
5
+ require_relative "smt/options"
6
+ require_relative "smt/display"
7
7
 
8
8
  module Smt
9
9
  class Error < StandardError; end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Ladachowski
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-06-25 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -67,19 +66,19 @@ dependencies:
67
66
  - !ruby/object:Gem::Version
68
67
  version: 3.13.0
69
68
  - !ruby/object:Gem::Dependency
70
- name: rubocop
69
+ name: standard
71
70
  requirement: !ruby/object:Gem::Requirement
72
71
  requirements:
73
72
  - - "~>"
74
73
  - !ruby/object:Gem::Version
75
- version: 1.64.1
74
+ version: 1.39.0
76
75
  type: :development
77
76
  prerelease: false
78
77
  version_requirements: !ruby/object:Gem::Requirement
79
78
  requirements:
80
79
  - - "~>"
81
80
  - !ruby/object:Gem::Version
82
- version: 1.64.1
81
+ version: 1.39.0
83
82
  - !ruby/object:Gem::Dependency
84
83
  name: simplecov
85
84
  requirement: !ruby/object:Gem::Requirement
@@ -103,7 +102,6 @@ extensions: []
103
102
  extra_rdoc_files: []
104
103
  files:
105
104
  - ".rspec"
106
- - ".rubocop.yml"
107
105
  - CHANGELOG.md
108
106
  - CODE_OF_CONDUCT.md
109
107
  - LICENSE.txt
@@ -123,7 +121,6 @@ metadata:
123
121
  homepage_uri: https://github.com/aladac/smt
124
122
  source_code_uri: https://github.com/aladac/smt
125
123
  changelog_uri: https://github.com/aladac/smt
126
- post_install_message:
127
124
  rdoc_options: []
128
125
  require_paths:
129
126
  - lib
@@ -138,8 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
135
  - !ruby/object:Gem::Version
139
136
  version: '0'
140
137
  requirements: []
141
- rubygems_version: 3.5.11
142
- signing_key:
138
+ rubygems_version: 3.6.7
143
139
  specification_version: 4
144
140
  summary: Shows time in multiple timezones
145
141
  test_files: []
data/.rubocop.yml DELETED
@@ -1,6 +0,0 @@
1
- AllCops:
2
- TargetRubyVersion: 3.0
3
-
4
- Style/Documentation:
5
- Enabled: false
6
-