nsrr 0.1.0.rc → 0.1.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f40189a9d84626e30194f50c78d9b3223c74c817
4
- data.tar.gz: 9acdd40aa3ebe199c644607b0932846f0e7577a7
3
+ metadata.gz: 3acd6f73765b32f956fc2419b3fcf1951c1e825a
4
+ data.tar.gz: 4cd666686bd47641844247f2ade46c20d2364ad2
5
5
  SHA512:
6
- metadata.gz: f869dca518b47dbf5b34c028d4d037661639a166f2670dac658cf08208f960c493870df7f01d25369980460cabb520615824e1da7950c27c17d2adf64c86ee24
7
- data.tar.gz: 5a695dd5da13822137dc9f9cc0059813599590a62f29fdc60eeb0e73ff865dfc528117efdfe21faf6c329fe30e0338330415d23692d0a84e69226708b9f3c2a1
6
+ metadata.gz: 58202e7c2f14914d50cec6873f1d0c253b30cac0ebc9b07076b738cd618add3af022e145905847ae6e9d50729bec306921343b6ed19d783bec6394da1087ac0c
7
+ data.tar.gz: 0dab0139cdac9fdd2a961ee3122b480dd7f59849666ddd1a7e17446aa276d1933eb3fea822fb320176c159e95c2da485982eff84cf92b96f7f043a228645bd5a
@@ -23,5 +23,6 @@
23
23
  - Downloads files in selected path folder and all subfolders
24
24
  - 'shallow'
25
25
  - Only downloads files in selected path folder
26
+ - Added a `nsrr update` command the provides the user with information on how to update the nsrr gem
26
27
  - Added a `nsrr version` command the returns the current version of the nsrr gem
27
28
  - Added testing framework to more easily add new tests for new features
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/nsrr/nsrr-gem.svg?branch=master)](https://travis-ci.org/nsrr/nsrr-gem)
4
4
  [![Dependency Status](https://gemnasium.com/nsrr/nsrr-gem.svg)](https://gemnasium.com/nsrr/nsrr-gem)
5
- [![Code Climate](https://codeclimate.com/github/nsrr/nsrr-gem.png)](https://codeclimate.com/github/nsrr/nsrr-gem)
5
+ [![Code Climate](https://codeclimate.com/github/nsrr/nsrr-gem/badges/gpa.svg)](https://codeclimate.com/github/nsrr/nsrr-gem)
6
6
 
7
7
  The official ruby gem built to simplify file downloads and dataset integration tasks for the [National Sleep Research Resource](https://sleepdata.org).
8
8
 
@@ -18,7 +18,7 @@ You must have **Ruby 2.0+ installed** on your system to use the NSRR gem.
18
18
 
19
19
  Install it yourself as:
20
20
 
21
- $ gem install nsrr --pre --no-ri --no-rdoc
21
+ $ gem install nsrr --no-ri --no-rdoc
22
22
 
23
23
  Or add this line to your application's Gemfile:
24
24
 
@@ -169,6 +169,14 @@ Finished in 2.384734 seconds.
169
169
  1 folder created, 0 files downloaded, 0 MiBs downloaded, 2 files skipped, 0 files failed
170
170
  ```
171
171
 
172
+ ### Update the NSRR gem
173
+
174
+ To make sure you're using the latest stable version of the NSRR gem, you can run the following command:
175
+
176
+ ```
177
+ nsrr update
178
+ ```
179
+
172
180
  ### Show the version of the NSRR gem
173
181
 
174
182
  ```
@@ -5,6 +5,7 @@ require "nsrr/version"
5
5
  Nsrr::COMMANDS = {
6
6
  'c' => :console,
7
7
  'd' => :download,
8
+ 'u' => :update,
8
9
  'v' => :version
9
10
  }
10
11
 
@@ -23,6 +24,11 @@ module Nsrr
23
24
  Nsrr::Commands::Download.run(argv)
24
25
  end
25
26
 
27
+ def self.update(argv)
28
+ require 'nsrr/commands/update'
29
+ Nsrr::Commands::Update.start(argv)
30
+ end
31
+
26
32
  def self.help(argv)
27
33
  puts <<-EOT
28
34
 
@@ -32,6 +38,7 @@ The most common nsrr commands are:
32
38
  [c]onsole Load an interactive console to access
33
39
  and download datasets and files
34
40
  [d]ownload Download all or some files in a DATASET
41
+ [u]pdate Update the nsrr gem
35
42
  [v]ersion Returns the version of nsrr gem
36
43
 
37
44
  Commands can be referenced by the first letter:
@@ -0,0 +1,37 @@
1
+ require 'colorize'
2
+
3
+ require 'nsrr/helpers/json_request'
4
+
5
+ module Nsrr
6
+ module Commands
7
+ class Update
8
+ class << self
9
+ def start(*args)
10
+ new(*args).start
11
+ end
12
+ end
13
+
14
+ def initialize(argv)
15
+ end
16
+
17
+ def start
18
+ json = Nsrr::Helpers::JsonRequest.get("https://rubygems.org/api/v1/gems/nsrr.json")
19
+
20
+ if json
21
+ if json['version'] == Nsrr::VERSION::STRING
22
+ puts "The nsrr gem is " + "up-to-date".colorize(:green) + "!"
23
+ else
24
+ puts
25
+ puts "A newer version (v#{json['version']}) is available! Type the following command to update:"
26
+ puts
27
+ puts " gem install nsrr --no-ri --no-rdoc".colorize(:white)
28
+ puts
29
+ end
30
+ else
31
+ puts "Unable to connect to RubyGems.org. Please try again later."
32
+ end
33
+ end
34
+
35
+ end
36
+ end
37
+ end
@@ -14,20 +14,27 @@ module Nsrr
14
14
  attr_reader :url
15
15
 
16
16
  def initialize(url)
17
- @url = URI.parse(url)
18
- @http = Net::HTTP.new(@url.host, @url.port)
19
- if @url.scheme == 'https'
20
- @http.use_ssl = true
21
- @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
17
+ begin
18
+ @url = URI.parse(url)
19
+ @http = Net::HTTP.new(@url.host, @url.port)
20
+ if @url.scheme == 'https'
21
+ @http.use_ssl = true
22
+ @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
23
+ end
24
+ rescue
22
25
  end
23
26
  end
24
27
 
25
28
  def get
26
- req = Net::HTTP::Get.new(@url.path)
27
- response = @http.start do |http|
28
- http.request(req)
29
+ begin
30
+ req = Net::HTTP::Get.new(@url.path)
31
+ response = @http.start do |http|
32
+ http.request(req)
33
+ end
34
+ JSON.parse(response.body)
35
+ rescue
36
+ nil
29
37
  end
30
- JSON.parse(response.body) rescue nil
31
38
  end
32
39
  end
33
40
  end
@@ -3,7 +3,7 @@ module Nsrr
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
5
  TINY = 0
6
- BUILD = "rc" # nil, "pre", "rc", "rc2"
6
+ BUILD = "rc2" # nil, "pre", "rc", "rc2"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nsrr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.rc
4
+ version: 0.1.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Remo Mueller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-20 00:00:00.000000000 Z
11
+ date: 2014-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -97,6 +97,7 @@ files:
97
97
  - lib/nsrr.rb
98
98
  - lib/nsrr/commands/console.rb
99
99
  - lib/nsrr/commands/download.rb
100
+ - lib/nsrr/commands/update.rb
100
101
  - lib/nsrr/helpers/constants.rb
101
102
  - lib/nsrr/helpers/download_request.rb
102
103
  - lib/nsrr/helpers/hash_helper.rb