dtg 4.0.1 → 5.0.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.
@@ -1,109 +1,107 @@
1
- require "spec_helper"
2
-
3
1
  RSpec.describe Zones do
4
- describe "UTC_ZONES" do
5
- it "returns alpha time offset" do
2
+ describe 'UTC_ZONES' do
3
+ it 'returns alpha time offset' do
6
4
  expect(Zones::UTC_ZONES[:a]).to eq(+1)
7
5
  end
8
6
 
9
- it "returns bravo time offset" do
7
+ it 'returns bravo time offset' do
10
8
  expect(Zones::UTC_ZONES[:b]).to eq(+2)
11
9
  end
12
10
 
13
- it "returns charlie time offset" do
11
+ it 'returns charlie time offset' do
14
12
  expect(Zones::UTC_ZONES[:c]).to eq(+3)
15
13
  end
16
14
 
17
- it "returns delta time offset" do
15
+ it 'returns delta time offset' do
18
16
  expect(Zones::UTC_ZONES[:d]).to eq(+4)
19
17
  end
20
18
 
21
- it "returns echo time offset" do
19
+ it 'returns echo time offset' do
22
20
  expect(Zones::UTC_ZONES[:e]).to eq(+5)
23
21
  end
24
22
 
25
- it "returns foxtrot time offset" do
23
+ it 'returns foxtrot time offset' do
26
24
  expect(Zones::UTC_ZONES[:f]).to eq(+6)
27
25
  end
28
26
 
29
- it "returns golf time offset" do
27
+ it 'returns golf time offset' do
30
28
  expect(Zones::UTC_ZONES[:g]).to eq(+7)
31
29
  end
32
30
 
33
- it "returns hotel time offset" do
31
+ it 'returns hotel time offset' do
34
32
  expect(Zones::UTC_ZONES[:h]).to eq(+8)
35
33
  end
36
34
 
37
- it "returns india time offset" do
35
+ it 'returns india time offset' do
38
36
  expect(Zones::UTC_ZONES[:i]).to eq(+9)
39
37
  end
40
38
 
41
- it "returns juliet time offset" do
42
- expect(Zones::UTC_ZONES[:j]).to eq("")
39
+ it 'returns juliet time offset' do
40
+ expect(Zones::UTC_ZONES[:j]).to eq('')
43
41
  end
44
42
 
45
- it "returns kilo time offset" do
43
+ it 'returns kilo time offset' do
46
44
  expect(Zones::UTC_ZONES[:k]).to eq(+10)
47
45
  end
48
46
 
49
- it "returns lima time offset" do
47
+ it 'returns lima time offset' do
50
48
  expect(Zones::UTC_ZONES[:l]).to eq(+11)
51
49
  end
52
50
 
53
- it "returns mike time offset" do
51
+ it 'returns mike time offset' do
54
52
  expect(Zones::UTC_ZONES[:m]).to eq(+12)
55
53
  end
56
54
 
57
- it "returns november time offset" do
55
+ it 'returns november time offset' do
58
56
  expect(Zones::UTC_ZONES[:n]).to eq(-1)
59
57
  end
60
58
 
61
- it "returns oscar time offset" do
59
+ it 'returns oscar time offset' do
62
60
  expect(Zones::UTC_ZONES[:o]).to eq(-2)
63
61
  end
64
62
 
65
- it "returns papa time offset" do
63
+ it 'returns papa time offset' do
66
64
  expect(Zones::UTC_ZONES[:p]).to eq(-3)
67
65
  end
68
66
 
69
- it "returns quebec time offset" do
67
+ it 'returns quebec time offset' do
70
68
  expect(Zones::UTC_ZONES[:q]).to eq(-4)
71
69
  end
72
70
 
73
- it "returns romeo time offset" do
71
+ it 'returns romeo time offset' do
74
72
  expect(Zones::UTC_ZONES[:r]).to eq(-5)
75
73
  end
76
74
 
77
- it "returns sierra time offset" do
75
+ it 'returns sierra time offset' do
78
76
  expect(Zones::UTC_ZONES[:s]).to eq(-6)
79
77
  end
80
78
 
81
- it "returns tango time offset" do
79
+ it 'returns tango time offset' do
82
80
  expect(Zones::UTC_ZONES[:t]).to eq(-7)
83
81
  end
84
82
 
85
- it "returns uniform time offset" do
83
+ it 'returns uniform time offset' do
86
84
  expect(Zones::UTC_ZONES[:u]).to eq(-8)
87
85
  end
88
86
 
89
- it "returns victor time offset" do
87
+ it 'returns victor time offset' do
90
88
  expect(Zones::UTC_ZONES[:v]).to eq(-9)
91
89
  end
92
90
 
93
- it "returns whiskey time offset" do
91
+ it 'returns whiskey time offset' do
94
92
  expect(Zones::UTC_ZONES[:w]).to eq(-10)
95
93
  end
96
94
 
97
- it "returns x-ray time offset" do
95
+ it 'returns x-ray time offset' do
98
96
  expect(Zones::UTC_ZONES[:x]).to eq(-11)
99
97
  end
100
98
 
101
- it "returns yankee time offset" do
99
+ it 'returns yankee time offset' do
102
100
  expect(Zones::UTC_ZONES[:y]).to eq(-12)
103
101
  end
104
102
 
105
- it "returns zulu time offset" do
106
- expect(Zones::UTC_ZONES[:z]).to eq("UTC")
103
+ it 'returns zulu time offset' do
104
+ expect(Zones::UTC_ZONES[:z]).to eq('UTC')
107
105
  end
108
106
  end
109
107
  end
@@ -0,0 +1,13 @@
1
+ RSpec.describe Dtg do
2
+ it 'has a version number' do
3
+ expect(Dtg::VERSION).not_to be nil
4
+ end
5
+
6
+ describe '.dtg' do
7
+ it 'replies as active if gem is loaded' do
8
+ expect(described_class.dtg).to match(
9
+ 'DTG gem is active running version: *'
10
+ )
11
+ end
12
+ end
13
+ end
@@ -5,105 +5,18 @@ if ENV['TRAVIS']
5
5
  Coveralls.wear!
6
6
  end
7
7
 
8
+ require 'bundler/setup'
8
9
  require 'dtg'
9
10
 
10
- # This file was generated by the `rspec --init` command. Conventionally, all
11
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
12
- # The generated `.rspec` file contains `--require spec_helper` which will cause
13
- # this file to always be loaded, without a need to explicitly require it in any
14
- # files.
15
- #
16
- # Given that it is always loaded, you are encouraged to keep this file as
17
- # light-weight as possible. Requiring heavyweight dependencies from this file
18
- # will add to the boot time of your test suite on EVERY test run, even for an
19
- # individual file that may not need all of that loaded. Instead, consider making
20
- # a separate helper file that requires the additional dependencies and performs
21
- # the additional setup, and require it from the spec files that actually need
22
- # it.
23
- #
24
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
25
11
  RSpec.configure do |config|
26
- # rspec-expectations config goes here. You can use an alternate
27
- # assertion/expectation library such as wrong or the stdlib/minitest
28
- # assertions if you prefer.
29
- config.expect_with :rspec do |expectations|
30
- # This option will default to `true` in RSpec 4. It makes the `description`
31
- # and `failure_message` of custom matchers include text for helper methods
32
- # defined using `chain`, e.g.:
33
- # be_bigger_than(2).and_smaller_than(4).description
34
- # # => "be bigger than 2 and smaller than 4"
35
- # ...rather than:
36
- # # => "be bigger than 2"
37
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
38
- end
39
-
40
- # rspec-mocks config goes here. You can use an alternate test double
41
- # library (such as bogus or mocha) by changing the `mock_with` option here.
42
- config.mock_with :rspec do |mocks|
43
- # Prevents you from mocking or stubbing a method that does not exist on
44
- # a real object. This is generally recommended, and will default to
45
- # `true` in RSpec 4.
46
- mocks.verify_partial_doubles = true
47
- end
48
-
49
- # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
50
- # have no way to turn it off -- the option exists only for backwards
51
- # compatibility in RSpec 3). It causes shared context metadata to be
52
- # inherited by the metadata hash of host groups and examples, rather than
53
- # triggering implicit auto-inclusion in groups with matching metadata.
54
- config.shared_context_metadata_behavior = :apply_to_host_groups
55
-
56
- # The settings below are suggested to provide a good initial experience
57
- # with RSpec, but feel free to customize to your heart's content.
58
- =begin
59
- # This allows you to limit a spec run to individual examples or groups
60
- # you care about by tagging them with `:focus` metadata. When nothing
61
- # is tagged with `:focus`, all examples get run. RSpec also provides
62
- # aliases for `it`, `describe`, and `context` that include `:focus`
63
- # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
64
- config.filter_run_when_matching :focus
12
+ # Enable flags like --only-failures and --next-failure
13
+ config.example_status_persistence_file_path =
14
+ '.rspec_status'
65
15
 
66
- # Allows RSpec to persist some state between runs in order to support
67
- # the `--only-failures` and `--next-failure` CLI options. We recommend
68
- # you configure your source control system to ignore this file.
69
- config.example_status_persistence_file_path = "spec/examples.txt"
70
-
71
- # Limits the available syntax to the non-monkey patched syntax that is
72
- # recommended. For more details, see:
73
- # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
74
- # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
75
- # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
16
+ # Disable RSpec exposing methods globally on `Module` and `main`
76
17
  config.disable_monkey_patching!
77
18
 
78
- # This setting enables warnings. It's recommended, but in some cases may
79
- # be too noisy due to issues in dependencies.
80
- config.warnings = true
81
-
82
- # Many RSpec users commonly either run the entire suite or an individual
83
- # file, and it's useful to allow more verbose output when running an
84
- # individual spec file.
85
- if config.files_to_run.one?
86
- # Use the documentation formatter for detailed output,
87
- # unless a formatter has already been configured
88
- # (e.g. via a command-line flag).
89
- config.default_formatter = "doc"
19
+ config.expect_with :rspec do |c|
20
+ c.syntax = :expect
90
21
  end
91
-
92
- # Print the 10 slowest examples and example groups at the
93
- # end of the spec run, to help surface which specs are running
94
- # particularly slow.
95
- config.profile_examples = 10
96
-
97
- # Run specs in random order to surface order dependencies. If you find an
98
- # order dependency and want to debug it, you can fix the order by providing
99
- # the seed, which is printed after each run.
100
- # --seed 1234
101
- config.order = :random
102
-
103
- # Seed global randomization in this process using the `--seed` CLI option.
104
- # Setting this allows you to use `--seed` to deterministically reproduce
105
- # test failures related to randomization by passing the same `--seed` value
106
- # as the one that triggered the failure.
107
- Kernel.srand config.seed
108
- =end
109
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dtg
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SolarisFlare
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-21 00:00:00.000000000 Z
11
+ date: 2019-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -24,6 +24,76 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.17'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.17'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: prettier
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: coveralls
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
27
97
  description: "A DTG is a DateTimeGroup which is used in the military to save time.
28
98
  \ DTG \n are saved in the format DDHHMML MMM YY, where D is
29
99
  day, H is hour, L is \n letter, M is month, and Y is year.
@@ -38,28 +108,48 @@ executables: []
38
108
  extensions: []
39
109
  extra_rdoc_files: []
40
110
  files:
111
+ - ".coveralls.yml"
112
+ - ".gitignore"
113
+ - ".inch.yml"
114
+ - ".prettierignore"
115
+ - ".rspec"
116
+ - ".ruby-version"
117
+ - ".travis.yml"
118
+ - CHANGELOG.md
119
+ - CODE_OF_CONDUCT.md
41
120
  - Gemfile
121
+ - Gemfile.lock
122
+ - LICENSE
123
+ - README.md
42
124
  - Rakefile
125
+ - bin/console
126
+ - bin/setup
43
127
  - dtg.gemspec
128
+ - dtg_zones.png
44
129
  - lib/dtg.rb
45
130
  - lib/dtg/active_support/time_with_zone_ext.rb
46
131
  - lib/dtg/date_time_ext.rb
47
132
  - lib/dtg/date_time_group.rb
133
+ - lib/dtg/format.rb
48
134
  - lib/dtg/time_ext.rb
49
135
  - lib/dtg/version.rb
50
136
  - lib/dtg/zones.rb
51
- - spec/lib/dtg/active_support/time_with_zone_ext_spec.rb
52
- - spec/lib/dtg/date_time_ext_spec.rb
53
- - spec/lib/dtg/date_time_group_spec.rb
54
- - spec/lib/dtg/time_ext_spec.rb
55
- - spec/lib/dtg/zones_spec.rb
56
- - spec/lib/dtg_spec.rb
137
+ - spec/dtg/active_support/time_with_zone_ext_spec.rb
138
+ - spec/dtg/date_time_ext_spec.rb
139
+ - spec/dtg/date_time_group_spec.rb
140
+ - spec/dtg/format_spec.rb
141
+ - spec/dtg/time_ext_spec.rb
142
+ - spec/dtg/zones_spec.rb
143
+ - spec/dtg_spec.rb
57
144
  - spec/spec_helper.rb
58
- homepage: https://github.com/SolarisFlare/dtg/
145
+ homepage: https://github.com/SolarisFlare/dtg/README.md
59
146
  licenses:
60
147
  - MIT
61
148
  metadata:
62
- allowed_push_host: 'TODO: Set to ''http://mygemserver.com'''
149
+ allowed_push_host: NOSERVER
150
+ homepage_uri: https://github.com/SolarisFlare/dtg/README.md
151
+ source_code_uri: https://github.com/SolarisFlare/dtg
152
+ changelog_uri: https://github.com/SolarisFlare/dtg/CHANGELOG.md
63
153
  post_install_message:
64
154
  rdoc_options: []
65
155
  require_paths:
@@ -78,13 +168,14 @@ requirements: []
78
168
  rubyforge_project:
79
169
  rubygems_version: 2.7.7
80
170
  signing_key:
81
- specification_version: 3
171
+ specification_version: 4
82
172
  summary: DTG converts from a DateTime to a DTG
83
173
  test_files:
84
174
  - spec/spec_helper.rb
85
- - spec/lib/dtg/zones_spec.rb
86
- - spec/lib/dtg/time_ext_spec.rb
87
- - spec/lib/dtg/date_time_group_spec.rb
88
- - spec/lib/dtg/date_time_ext_spec.rb
89
- - spec/lib/dtg/active_support/time_with_zone_ext_spec.rb
90
- - spec/lib/dtg_spec.rb
175
+ - spec/dtg/zones_spec.rb
176
+ - spec/dtg/format_spec.rb
177
+ - spec/dtg/time_ext_spec.rb
178
+ - spec/dtg/date_time_group_spec.rb
179
+ - spec/dtg/date_time_ext_spec.rb
180
+ - spec/dtg/active_support/time_with_zone_ext_spec.rb
181
+ - spec/dtg_spec.rb
@@ -1,169 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ActiveSupport::TimeWithZone do
4
- # Set Time Zone before tests
5
- before do
6
- Time.zone = "UTC"
7
- end
8
-
9
- # ActiveSupport::TimeWithZone preferred method of instantiation is with Time.zone.now, not new
10
- let(:time) { Time.zone.now { include DateTimeGroup }}
11
-
12
- describe "#to_dtg" do
13
- context "when zone is a symbol" do
14
- context "when symbol is lowercase" do
15
- it "converts and formats as dtg" do
16
- (:a..:z).to_set.delete(:j).each do |zone|
17
- expect(time.to_dtg(zone)).to eq(time.in_time_zone(
18
- Zones::UTC_ZONES[zone])
19
- .strftime(
20
- "%d%H%M#{zone.upcase.to_s} %b %y"))
21
- end
22
- # :j is separate because there is no local timezone identifier,
23
- # it just gets returned and formatted
24
- expect(time.to_dtg(:j)).to eq(time.format(:j))
25
- end
26
- end
27
-
28
- context "when symbol is uppercase" do
29
- it "converts and formats as dtg" do
30
- (:A..:Z).to_set.delete(:J).each do |zone|
31
- expect(time.to_dtg(zone)).to eq(time.in_time_zone(
32
- Zones::UTC_ZONES[zone.downcase])
33
- .strftime(
34
- "%d%H%M#{zone.to_s} %b %y"))
35
- end
36
- # :J is separate because there is no local timezone identifier,
37
- # it just gets returned and formatted
38
- expect(time.to_dtg(:J)).to eq(time.format(:j))
39
- end
40
- end
41
- end
42
-
43
- context "when zone is a single character string" do
44
- context "when string is lowercase" do
45
- it "converts and formats as dtg" do
46
- ('a'..'z').to_set.delete('j').each do |zone|
47
- expect(time.to_dtg(zone)).to eq(time.in_time_zone(
48
- Zones::UTC_ZONES[zone.to_sym])
49
- .strftime(
50
- "%d%H%M#{zone.upcase} %b %y"))
51
- end
52
- # 'j' is separate because there is no local timezone identifier
53
- # it just gets returned and formatted
54
- expect(time.to_dtg('j')).to eq(time.format(:j))
55
- end
56
- end
57
-
58
- context "when string is uppercase" do
59
- it "converts and formats as dtg" do
60
- ('A'..'Z').to_set.delete('J').each do |zone|
61
- expect(time.to_dtg(zone)).to eq(time.in_time_zone(
62
- Zones::UTC_ZONES[zone.downcase.to_sym])
63
- .strftime(
64
- "%d%H%M#{zone} %b %y"))
65
- end
66
- # 'J' is separate because there is no local timezone identifier,
67
- # it just gets returned and formatted
68
- expect(time.to_dtg('J')).to eq(time.format(:j))
69
- end
70
- end
71
- end
72
- end
73
-
74
- describe "#format" do
75
- context "when zone is a symbol" do
76
- context "when symbol is lowercase" do
77
- it "formats to dtg standard" do
78
- (:a..:z).each do |zone|
79
- expect(time.format(zone)).to eq(time.strftime(
80
- "%d%H%M#{zone.upcase.to_s} %b %y"))
81
- end
82
- end
83
- end
84
-
85
- context "when symbol is uppercase" do
86
- it "formats to dtg standard" do
87
- (:A..:Z).each do |zone|
88
- expect(time.format(zone)).to eq(time.strftime(
89
- "%d%H%M#{zone.to_s} %b %y"))
90
- end
91
- end
92
- end
93
- end
94
-
95
- context "when zone is a single character string" do
96
- context "when string is lowercase" do
97
- it "formats to dtg standard" do
98
- ('a'..'z').each do |zone|
99
- expect(time.format(zone)).to eq(time.strftime(
100
- "%d%H%M#{zone.upcase} %b %y"))
101
- end
102
- end
103
- end
104
-
105
- context "when string is uppercase" do
106
- it "formats to dtg standard" do
107
- ('A'..'Z').each do |zone|
108
- expect(time.format(zone)).to eq(time.strftime(
109
- "%d%H%M#{zone} %b %y"))
110
- end
111
- end
112
- end
113
- end
114
- end
115
-
116
- describe "#convert" do
117
- context "when zone is a symbol" do
118
- context "when symbol is lowercase" do
119
- it "returns converted time to new zone" do
120
- (:a..:z).to_set.delete(:j).each do |zone|
121
- expect(time.convert(zone)).to eq(time.in_time_zone(
122
- Zones::UTC_ZONES[zone]))
123
- end
124
- # :j is separate because there is no local timezone identifier,
125
- # it just gets returned and formatted
126
- expect(time.convert(:j)).to eq(time)
127
- end
128
- end
129
-
130
- context "when symbol is uppercase" do
131
- it "returns converted time to new zone" do
132
- (:A..:Z).to_set.delete(:J).each do |zone|
133
- expect(time.convert(zone)).to eq(time.in_time_zone(
134
- Zones::UTC_ZONES[zone.downcase]))
135
- end
136
- # :J is separate because there is no local timezone identifier,
137
- # it just gets returned and formatted
138
- expect(time.convert(:J)).to eq(time)
139
- end
140
- end
141
- end
142
-
143
- context "when zone is a single character string" do
144
- context "when string is lowercase" do
145
- it "returns converted time to new zone" do
146
- ('a'..'z').to_set.delete('j').each do |zone|
147
- expect(time.convert(zone)).to eq(time.in_time_zone(
148
- Zones::UTC_ZONES[zone.to_sym]))
149
- end
150
- # 'j' is separate because there is no local timezone identifier,
151
- # it just gets returned and formatted
152
- expect(time.convert('j')).to eq(time)
153
- end
154
- end
155
-
156
- context "when string is uppercase" do
157
- it "returns converted time to new zone" do
158
- ('A'..'Z').to_set.delete('J').each do |zone|
159
- expect(time.convert(zone)).to eq(time.in_time_zone(
160
- Zones::UTC_ZONES[zone.downcase.to_sym]))
161
- end
162
- # 'J' is separate because there is no local timezone identifier,
163
- # it just gets returned and formatted
164
- expect(time.convert('J')).to eq(time)
165
- end
166
- end
167
- end
168
- end
169
- end