rgversion 0.0.2 → 0.1.0

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: cc19581c25707ba64e0a326d5072ca7e7ae4edfa
4
- data.tar.gz: 362251ede09b7b40289adbc46e2430256ebbbbf9
3
+ metadata.gz: 8d8857202a062cfee1cc92cbe0c54907b54fe6cd
4
+ data.tar.gz: b193287aa676ae06a35baed306e3acd4a8bb9a3b
5
5
  SHA512:
6
- metadata.gz: d89604227918e9a9e4d2d53043067983ab2204f4c82650a555395d2c8a287498ce0e9363476da776c6f6aa2cac3839cbc447c07ac1238dc09ade2ec6ebf51242
7
- data.tar.gz: c3237bf556f39e0afd5fc278492752d57c65f5e694b19163e3be757c8af2a47ccce69246d9821d8508456c8b2cf79c329a36bdf4b2bdda0f4faf0163f1f7cbcb
6
+ metadata.gz: d9b6c4cf773ec4f88b7c8758c45afc5885ed698923686954cd0717def2e39448e94a3cbda87d4cde2ed2961642bd0df01242eee30ea195b46a06d182ccb3fadd
7
+ data.tar.gz: 34d80cbbe7346bfcf6b0092872e0d5de0fa52443016b189290c146b6511055cf3461ec313ed77a446377cbbb6841b8728f4be54ba354b59ac3530fa8d3d39c78
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # rgversion [![Gem](https://img.shields.io/gem/v/rgversion.svg)](https://rubygems.org/gems/rgversion) [![Build Status](https://img.shields.io/travis/vavgustov/rgversion/master.svg)](https://travis-ci.org/vavgustov/rgversion) [![Code Climate](https://img.shields.io/codeclimate/github/vavgustov/rgversion.svg)](https://codeclimate.com/github/vavgustov/rgversion)
2
2
 
3
3
  This library allow you to quickly copy latest semantic versions of specified gems to your clipboard. Versions will be taken from [`rubygems.org`](https://rubygems.org/). Then you can past them in your `Gemfile`.
4
- ![image](https://cloud.githubusercontent.com/assets/312873/25066821/21615b82-223a-11e7-8110-4e91127a0b6c.png)
4
+ ![image](https://user-images.githubusercontent.com/312873/28492511-d2dbf140-6f0d-11e7-9912-beb8b94a1ca7.png)
5
5
 
6
6
  ## Installation
7
7
 
@@ -9,8 +9,11 @@ This library allow you to quickly copy latest semantic versions of specified gem
9
9
  gem install rgversion
10
10
  ```
11
11
 
12
- Copy to clipboard work through ``pbcopy`` and will be work out from the box on macOS / OS X.
13
- To make it work in Ubuntu / Debian you can follow these [steps](https://coderwall.com/p/oaaqwq/pbcopy-on-ubuntu-linux).
12
+ ##### macOS / OS X
13
+ No further actions required.
14
+
15
+ ##### Debian / Ubuntu
16
+ Copy to clipboard work through ``pbcopy`` and to make it work on Ubuntu / Debian you can follow these [steps](https://coderwall.com/p/oaaqwq/pbcopy-on-ubuntu-linux).
14
17
 
15
18
  ## Usage
16
19
  Open terminal and execute ``rgversion`` with list of needed gems. E.g:
data/exe/rgversion CHANGED
@@ -3,4 +3,4 @@
3
3
  require "bundler/setup"
4
4
  require "rgversion"
5
5
 
6
- RgVersion::Application.run
6
+ Rgversion::Application.run
@@ -1,5 +1,4 @@
1
- module RgVersion
2
- # Main application
1
+ module Rgversion
3
2
  module Application
4
3
  def self.run
5
4
  RgVersion::Terminal.copy_to_clipboard
@@ -1,21 +1,30 @@
1
1
  require 'nokogiri'
2
2
  require 'open-uri'
3
3
 
4
- module RgVersion
5
- # Spider take content from https://rubygems.org/
6
- module Spider
7
- def self.grab_version
4
+ module Rgversion
5
+ class Spider
6
+ def initialize(gems)
7
+ @gems = gems
8
+ end
9
+
10
+ def output
8
11
  gem_text = []
9
- ARGV.each do |arg|
12
+ @gems.each do |gem|
10
13
  begin
11
- gem_url = "https://rubygems.org/gems/#{arg}"
12
- gem_page = Nokogiri::HTML(open(gem_url))
13
- gem_text << gem_page.at('#gemfile_text')['value']
14
+ gem_text << grab_version(gem)
14
15
  rescue OpenURI::HTTPError
15
16
  puts "#{gem_url} not found"
16
17
  end
17
18
  end
18
19
  gem_text
19
20
  end
21
+
22
+ private
23
+
24
+ def grab_version(gem)
25
+ gem_url = "https://rubygems.org/gems/#{gem}"
26
+ gem_page = Nokogiri::HTML(open(gem_url))
27
+ gem_page.at('#gemfile_text')['value']
28
+ end
20
29
  end
21
30
  end
@@ -1,8 +1,9 @@
1
- module RgVersion
1
+ module Rgversion
2
2
  # Terminal operations
3
3
  module Terminal
4
4
  def self.copy_to_clipboard
5
- version = RgVersion::Spider.grab_version
5
+ spider = RgVersion::Spider.new(ARGV)
6
+ version = spider.output
6
7
  unless version.empty?
7
8
  version = version.join("\n")
8
9
  `echo "#{version}" | pbcopy`
@@ -1,3 +1,4 @@
1
1
  module Rgversion
2
- VERSION = "0.0.2"
2
+ VERSION = '0.1.0'
3
+ PREVIOUS_VERSION = '0.0.2'
3
4
  end
data/rgversion.gemspec CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["vavgustov"]
10
10
  spec.email = ["vavgustov@gmail.com"]
11
11
 
12
- spec.summary = %q{This library allow you to quickly copy latest semantic versions of specified gems to your clipboard. .}
13
- spec.description = %q{This library allow you to quickly copy latest semantic versions of specified gems to your clipboard. .}
12
+ spec.summary = %q{Copy latest semantic versions of specified gems to your clipboard.}
13
+ spec.description = %q{This library allow you to quickly copy latest semantic versions of specified gems to your clipboard.}
14
14
  spec.homepage = "https://github.com/vavgustov/rgversion"
15
15
  spec.license = "MIT"
16
16
 
@@ -24,8 +24,9 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ["lib"]
26
26
 
27
- spec.add_development_dependency "bundler", "~> 1.14"
27
+ spec.add_development_dependency "bundler", "~> 1.15"
28
28
  spec.add_development_dependency "rake", "~> 12.0"
29
- spec.add_development_dependency "rspec", "~> 3.5"
30
- spec.add_runtime_dependency "nokogiri", "~> 1.7"
29
+ spec.add_development_dependency "rspec", "~> 3.6"
30
+
31
+ spec.add_runtime_dependency "nokogiri", "~> 1.8"
31
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgversion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - vavgustov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-15 00:00:00.000000000 Z
11
+ date: 2017-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.14'
19
+ version: '1.15'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.14'
26
+ version: '1.15'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,30 +44,30 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.5'
47
+ version: '3.6'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.5'
54
+ version: '3.6'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: nokogiri
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.7'
61
+ version: '1.8'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.7'
68
+ version: '1.8'
69
69
  description: This library allow you to quickly copy latest semantic versions of specified
70
- gems to your clipboard. .
70
+ gems to your clipboard.
71
71
  email:
72
72
  - vavgustov@gmail.com
73
73
  executables:
@@ -114,6 +114,5 @@ rubyforge_project:
114
114
  rubygems_version: 2.6.11
115
115
  signing_key:
116
116
  specification_version: 4
117
- summary: This library allow you to quickly copy latest semantic versions of specified
118
- gems to your clipboard. .
117
+ summary: Copy latest semantic versions of specified gems to your clipboard.
119
118
  test_files: []