hubble-image-fetcher 0.0.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.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.yardopts +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +15 -0
- data/bin/hubble-image-fetcher +3 -0
- data/doctest_helper.rb +1 -0
- data/hubble-image-fetcher.gemspec +32 -0
- data/lib/hubble-image-fetcher.rb +26 -0
- data/lib/hubble-image-fetcher/version.rb +3 -0
- metadata +118 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f2dba34307e101b2d8024721749237ef4cd61a1a
|
4
|
+
data.tar.gz: 3a877218021b344dec7271d6e1affa08786e9a17
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a7ade03c1042d0b1ad871b3eec89b8885e16499b45853e3739cf4bcbdbf2963c9bf58b1f4e16cb7986d9afe1d7b3b3b561ded348b3535c96837d4e8a33a5684c
|
7
|
+
data.tar.gz: c029c743b54663a1ad10ea9e60bbaef0558ab2b72aeccbadd5864b5f11a555706875319d040452ee3b9b40eb3fdf66eb017ab8c2f068441bde0b062fd63f531a
|
data/.gitignore
ADDED
data/.yardopts
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Jakukyo Friel
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Hubble image fetcher
|
2
|
+
|
3
|
+
Given a list of image page urls of [Hubble website](http://www.spacetelescope.org/),
|
4
|
+
outputs a list of download urls for original images.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
$ gem install hubble-image-fetcher
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
```
|
13
|
+
cat links.txt | hubble-image-fetcher
|
14
|
+
```
|
15
|
+
## Test
|
16
|
+
|
17
|
+
```
|
18
|
+
rake test
|
19
|
+
```
|
20
|
+
|
21
|
+
## Contributing
|
22
|
+
|
23
|
+
1. Fork it ( https://github.com/weakish/hubble-image-fetcher/fork )
|
24
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
25
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
26
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
27
|
+
5. Create a new Pull Request
|
28
|
+
|
29
|
+
Signing commits with gpg is optional, but preferred.
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rake/clean'
|
3
|
+
|
4
|
+
|
5
|
+
task :default => :test
|
6
|
+
|
7
|
+
desc 'Run doctests'
|
8
|
+
task :test do
|
9
|
+
sh 'bundle exec rubydoctest lib/*.rb'
|
10
|
+
end
|
11
|
+
|
12
|
+
desc 'Generate docs'
|
13
|
+
task('doc') { sh 'bundle exec yard doc' }
|
14
|
+
CLEAN.include 'doc'
|
15
|
+
|
data/doctest_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'lib/hubble-image-fetcher'
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'hubble-image-fetcher/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'hubble-image-fetcher'
|
8
|
+
spec.version = HubbleImageFetcher::VERSION
|
9
|
+
spec.authors = ['Jakukyo Friel']
|
10
|
+
spec.email = ['weakish@gmail.com']
|
11
|
+
spec.summary = %q{A script to help downloading Hubble images.}
|
12
|
+
spec.description = %q{Given a list of image page urls of Hubble website,outputs a list of download urls for original images.}
|
13
|
+
spec.homepage = 'https://github.com/weakish/hubble-image-fetcher'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
spec.metadata = {
|
16
|
+
'repository' => 'https://github.com/weakish/hubble-image-fetcher',
|
17
|
+
'documentation' => 'http://www.rubydoc.info/gems/hubble-image-fetcher/',
|
18
|
+
'issues' => 'https://github.com/weakish/hubble-image-fetcher/issues/',
|
19
|
+
'wiki' => 'https://github.com/weakish/hubble-image-fetcher/wiki/',
|
20
|
+
}
|
21
|
+
|
22
|
+
spec.files = `git ls-files -z`.split("\x0")
|
23
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
24
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
25
|
+
spec.require_paths = ['lib']
|
26
|
+
spec.bindir = 'bin'
|
27
|
+
|
28
|
+
spec.add_runtime_dependency 'nokogiri', '~> 1.6'
|
29
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
30
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
31
|
+
spec.add_development_dependency 'yard-doctest', '~> 0.1'
|
32
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'hubble-image-fetcher/version'
|
2
|
+
require 'open-uri'
|
3
|
+
require 'nokogiri'
|
4
|
+
|
5
|
+
module HubbleImageFetcher
|
6
|
+
|
7
|
+
module_function
|
8
|
+
|
9
|
+
# Get download link for original image.
|
10
|
+
#
|
11
|
+
# @param [String] image_page_url
|
12
|
+
# @return [String] a link to the original image
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
# image_page_url = 'http://www.spacetelescope.org/images/potw1348a/'
|
16
|
+
# HubbleImageFetcher.get_link(image_page_url)
|
17
|
+
# #=> 'http://www.spacetelescope.org/static/archives/images/original/potw1348a.tif'
|
18
|
+
|
19
|
+
def get_link(image_page_url)
|
20
|
+
html = Nokogiri::HTML(open(image_page_url))
|
21
|
+
relative_original_image_url = html.at('.archive_dl_text a')['href']
|
22
|
+
|
23
|
+
base_url = 'http://www.spacetelescope.org'
|
24
|
+
base_url + relative_original_image_url
|
25
|
+
end
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hubble-image-fetcher
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jakukyo Friel
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nokogiri
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
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.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
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: yard-doctest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.1'
|
69
|
+
description: Given a list of image page urls of Hubble website,outputs a list of download
|
70
|
+
urls for original images.
|
71
|
+
email:
|
72
|
+
- weakish@gmail.com
|
73
|
+
executables:
|
74
|
+
- hubble-image-fetcher
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- ".gitignore"
|
79
|
+
- ".yardopts"
|
80
|
+
- Gemfile
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- bin/hubble-image-fetcher
|
85
|
+
- doctest_helper.rb
|
86
|
+
- hubble-image-fetcher.gemspec
|
87
|
+
- lib/hubble-image-fetcher.rb
|
88
|
+
- lib/hubble-image-fetcher/version.rb
|
89
|
+
homepage: https://github.com/weakish/hubble-image-fetcher
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata:
|
93
|
+
repository: https://github.com/weakish/hubble-image-fetcher
|
94
|
+
documentation: http://www.rubydoc.info/gems/hubble-image-fetcher/
|
95
|
+
issues: https://github.com/weakish/hubble-image-fetcher/issues/
|
96
|
+
wiki: https://github.com/weakish/hubble-image-fetcher/wiki/
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
requirements: []
|
112
|
+
rubyforge_project:
|
113
|
+
rubygems_version: 2.2.2
|
114
|
+
signing_key:
|
115
|
+
specification_version: 4
|
116
|
+
summary: A script to help downloading Hubble images.
|
117
|
+
test_files: []
|
118
|
+
has_rdoc:
|