zonebie-info 0.0.7 → 0.0.8
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 +8 -8
 - data/lib/zonebie/info/version.rb +1 -1
 - data/lib/zonebie/info.rb +7 -3
 - data/spec/integration/info_spec.rb +1 -0
 - data/spec/zonebie/info_spec.rb +23 -1
 - data/zonebie-info.gemspec +1 -0
 - metadata +16 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            !binary "U0hBMQ==":
         
     | 
| 
       3 
3 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       4 
     | 
    
         
            -
                 
     | 
| 
      
 4 
     | 
    
         
            +
                YTk2ZDA5NjQwYjc5ZjAxYmVkYjlkNDQ1YjVhMWVhZmRhZDQzZjFmYQ==
         
     | 
| 
       5 
5 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       6 
     | 
    
         
            -
                 
     | 
| 
      
 6 
     | 
    
         
            +
                M2M4NmM5NWI0ZjVjZjcwODgyNGNlZGVhY2RkM2NlZjM5MTMxZGU2OA==
         
     | 
| 
       7 
7 
     | 
    
         
             
            SHA512:
         
     | 
| 
       8 
8 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
       10 
     | 
    
         
            -
                 
     | 
| 
       11 
     | 
    
         
            -
                 
     | 
| 
      
 9 
     | 
    
         
            +
                MjViYjE2NmExYWVjNGJiNmQxNzgyOTdmOTAxOGRiN2JkN2YzOTVjOTYyMTgw
         
     | 
| 
      
 10 
     | 
    
         
            +
                OTYzYTBmYjg0YzBlZjY4MWMwYThjNDk1ZDE5MWY3YWZlMTMwOTMzOTlkYjY4
         
     | 
| 
      
 11 
     | 
    
         
            +
                ZGZhNjY3NzUwYTBkMWIzMzg5Njc1YWI1YmJkNTk0YzI5NzMxOWU=
         
     | 
| 
       12 
12 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       13 
     | 
    
         
            -
                 
     | 
| 
       14 
     | 
    
         
            -
                 
     | 
| 
       15 
     | 
    
         
            -
                 
     | 
| 
      
 13 
     | 
    
         
            +
                ODk5MTllYTk2ZTEwODI4ZDMxOWVmNzdmNmJiNTE4NTBiODgxNmZmNzgyMmE3
         
     | 
| 
      
 14 
     | 
    
         
            +
                NjZjOWI1YmY5NzA4MzNiM2QzMmFiMzI3YmM5ODllOTA1YzRjMmIyODY2Mzdi
         
     | 
| 
      
 15 
     | 
    
         
            +
                OTYxYzUxYTBlY2NiYzQ2OTYzZTM4N2UwNzY4OTkwYzhlZjhkOTA=
         
     | 
    
        data/lib/zonebie/info/version.rb
    CHANGED
    
    
    
        data/lib/zonebie/info.rb
    CHANGED
    
    | 
         @@ -1,5 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'zonebie'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'wikipedia'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'byebug'
         
     | 
| 
       3 
4 
     | 
    
         | 
| 
       4 
5 
     | 
    
         
             
            module Zonebie
         
     | 
| 
       5 
6 
     | 
    
         
             
              class << self
         
     | 
| 
         @@ -15,11 +16,14 @@ module Zonebie 
     | 
|
| 
       15 
16 
     | 
    
         
             
                end
         
     | 
| 
       16 
17 
     | 
    
         | 
| 
       17 
18 
     | 
    
         
             
                def print_timezone_info
         
     | 
| 
       18 
     | 
    
         
            -
                   
     | 
| 
       19 
     | 
    
         
            -
                  when nil
         
     | 
| 
      
 19 
     | 
    
         
            +
                  if @request.nil?
         
     | 
| 
       20 
20 
     | 
    
         
             
                    $stderr.puts '', 'Please set the ZONEBIE_INFO environment variable to load data from Wikipedia'
         
     | 
| 
       21 
21 
     | 
    
         
             
                  else
         
     | 
| 
       22 
     | 
    
         
            -
                     
     | 
| 
      
 22 
     | 
    
         
            +
                    if @request.alive?
         
     | 
| 
      
 23 
     | 
    
         
            +
                      $stderr.puts '', 'Wikipedia download did not complete in time, please check your network connection and try again later'
         
     | 
| 
      
 24 
     | 
    
         
            +
                    else
         
     | 
| 
      
 25 
     | 
    
         
            +
                      $stdout.puts '', @request.join.value
         
     | 
| 
      
 26 
     | 
    
         
            +
                    end
         
     | 
| 
       23 
27 
     | 
    
         
             
                  end
         
     | 
| 
       24 
28 
     | 
    
         
             
                end
         
     | 
| 
       25 
29 
     | 
    
         | 
    
        data/spec/zonebie/info_spec.rb
    CHANGED
    
    | 
         @@ -64,8 +64,29 @@ describe Zonebie do 
     | 
|
| 
       64 
64 
     | 
    
         
             
                  end
         
     | 
| 
       65 
65 
     | 
    
         
             
                end
         
     | 
| 
       66 
66 
     | 
    
         | 
| 
      
 67 
     | 
    
         
            +
                context 'when the request has not completed in time' do
         
     | 
| 
      
 68 
     | 
    
         
            +
                  let(:message) do
         
     | 
| 
      
 69 
     | 
    
         
            +
                    'Wikipedia download did not complete in time, please check your network connection and try again later'
         
     | 
| 
      
 70 
     | 
    
         
            +
                  end
         
     | 
| 
      
 71 
     | 
    
         
            +
                  let(:t) { Thread.new { sleep 1000 } }
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
                  before do
         
     | 
| 
      
 74 
     | 
    
         
            +
                    Zonebie.instance_variable_set('@request', t)
         
     | 
| 
      
 75 
     | 
    
         
            +
                    $stderr = out
         
     | 
| 
      
 76 
     | 
    
         
            +
                  end
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                  after do
         
     | 
| 
      
 79 
     | 
    
         
            +
                    $stderr = STDERR
         
     | 
| 
      
 80 
     | 
    
         
            +
                  end
         
     | 
| 
      
 81 
     | 
    
         
            +
                  it 'informs the user the request did not finish in time' do
         
     | 
| 
      
 82 
     | 
    
         
            +
                    Zonebie.print_timezone_info
         
     | 
| 
      
 83 
     | 
    
         
            +
                    out.rewind
         
     | 
| 
      
 84 
     | 
    
         
            +
                    expect(out.read).to eq "\n#{message}\n"
         
     | 
| 
      
 85 
     | 
    
         
            +
                  end
         
     | 
| 
      
 86 
     | 
    
         
            +
                end
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
       67 
88 
     | 
    
         
             
                context 'when the request succeeds' do
         
     | 
| 
       68 
     | 
    
         
            -
                  let(:t) { Thread.new { 'hello' } }
         
     | 
| 
      
 89 
     | 
    
         
            +
                  let!(:t) { Thread.new { 'hello' } }
         
     | 
| 
       69 
90 
     | 
    
         | 
| 
       70 
91 
     | 
    
         
             
                  before do
         
     | 
| 
       71 
92 
     | 
    
         
             
                    Zonebie.instance_variable_set '@request', t
         
     | 
| 
         @@ -77,6 +98,7 @@ describe Zonebie do 
     | 
|
| 
       77 
98 
     | 
    
         
             
                  end
         
     | 
| 
       78 
99 
     | 
    
         | 
| 
       79 
100 
     | 
    
         
             
                  it 'prints the info from wikipedia' do
         
     | 
| 
      
 101 
     | 
    
         
            +
                    sleep 0.001 # Allow the thread to complete
         
     | 
| 
       80 
102 
     | 
    
         
             
                    Zonebie.print_timezone_info
         
     | 
| 
       81 
103 
     | 
    
         
             
                    out.rewind
         
     | 
| 
       82 
104 
     | 
    
         
             
                    expect(out.read).to eq "\nhello\n"
         
     | 
    
        data/zonebie-info.gemspec
    CHANGED
    
    | 
         @@ -21,4 +21,5 @@ Gem::Specification.new do |gem| 
     | 
|
| 
       21 
21 
     | 
    
         
             
              gem.add_development_dependency 'rspec', '~> 3.0', '>= 3.0.0'
         
     | 
| 
       22 
22 
     | 
    
         
             
              gem.add_development_dependency 'rubocop', '~> 0.34', '>= 0.34.1'
         
     | 
| 
       23 
23 
     | 
    
         
             
              gem.add_development_dependency 'simplecov', '~> 0.10', '>= 0.10.0'
         
     | 
| 
      
 24 
     | 
    
         
            +
              gem.add_development_dependency 'byebug'
         
     | 
| 
       24 
25 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: zonebie-info
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.8
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Tom Bowden
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2015-09- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-09-21 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: zonebie
         
     | 
| 
         @@ -150,6 +150,20 @@ dependencies: 
     | 
|
| 
       150 
150 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
       151 
151 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       152 
152 
     | 
    
         
             
                    version: 0.10.0
         
     | 
| 
      
 153 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 154 
     | 
    
         
            +
              name: byebug
         
     | 
| 
      
 155 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 156 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 157 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 158 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 159 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 160 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 161 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 162 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 163 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 164 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 165 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 166 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       153 
167 
     | 
    
         
             
            description: Downloads the first paragraph from wikipedia about the randomly set timezone
         
     | 
| 
       154 
168 
     | 
    
         
             
            email:
         
     | 
| 
       155 
169 
     | 
    
         
             
            - tom.b1992@gmail.com
         
     |