joya 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2265ed2b2e87706a7a910cef208edfd549b20849b5c09a3ebf26b1c6caa1caf2
4
+ data.tar.gz: 9191f4e361df10680d4e47a35784af4c8c21c54e946131ec7f3abf0040aa7362
5
+ SHA512:
6
+ metadata.gz: d88c91b17cb7f5fff0130e598e311802e909651a330680f28f12be569e10a4e87c33de20930d85add3b3c7ff335e46a6b3e88c20e891ee0bd1f0c739299ed282
7
+ data.tar.gz: 566a79d062db2e6d2d0ef9bc85daa7e3a7b130d46e550d030197f111b55741bb4d934abadbb5759097d26e64cf01a4ebe245fe6014adafbb894ff723737240de
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ TODO.md
10
+ gems-*
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.3
7
+ before_install: gem install bundler -v 2.0.1
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in joya.gemspec
4
+ gemspec
@@ -0,0 +1,37 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ joya (0.1.0)
5
+ nokogiri (~> 1.10.4)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ansi (1.5.0)
11
+ builder (3.2.3)
12
+ byebug (11.0.1)
13
+ mini_portile2 (2.4.0)
14
+ minitest (5.12.2)
15
+ minitest-reporters (1.3.8)
16
+ ansi
17
+ builder
18
+ minitest (>= 5.0)
19
+ ruby-progressbar
20
+ nokogiri (1.10.4)
21
+ mini_portile2 (~> 2.4.0)
22
+ rake (10.5.0)
23
+ ruby-progressbar (1.10.1)
24
+
25
+ PLATFORMS
26
+ ruby
27
+
28
+ DEPENDENCIES
29
+ bundler (~> 2.0)
30
+ byebug (~> 11.0.1)
31
+ joya!
32
+ minitest (~> 5.0)
33
+ minitest-reporters (~> 1.3.8)
34
+ rake (~> 10.0)
35
+
36
+ BUNDLED WITH
37
+ 2.0.2
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 sergioro
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,41 @@
1
+ Joya
2
+ ====
3
+
4
+ [joya](https://en.wiktionary.org/wiki/joya#Spanish) clones gems of a
5
+ given RubyGems.org author.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ $ gem install joya
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Pass the name of a <https://rubygems.org> account:
16
+
17
+ ```bash
18
+ $ joya sergioro
19
+ 4 gems found
20
+ [0/4] Unpacking hola-sergio
21
+ [1/4] Unpacking trick_or_treat
22
+ [2/4] Unpacking repo-sergio
23
+ [3/4] Unpacking clup
24
+ Done: gems available at gems-sergioro
25
+ ```
26
+
27
+ Recommended steps to maximize profit:
28
+
29
+ 1. Find an awesome Ruby programmer to learn from
30
+ 2. Use `joya programmer_name`
31
+ 3. Read the source code of the programmer and learn new techniques
32
+ 4. Become an awesome Ruby programmer
33
+
34
+ ## Contributing
35
+
36
+ Bug reports and pull requests are welcome on [GitHub.](https://github.com/sergioro9/joya)
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT
41
+ License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,14 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+ require 'rake/clean'
4
+ require 'fileutils'
5
+
6
+ CLEAN.include ['**/.*.sw?', '**/*.gem', 'test/test.log']
7
+
8
+ task :default => [:test, :package]
9
+ task :package => [:clean]
10
+
11
+ Rake::TestTask.new do |t|
12
+ t.libs << 'lib' << 'test'
13
+ t.test_files = FileList["test/**/*_test.rb"]
14
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "joya"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "joya"
4
+
5
+ Joya.main
@@ -0,0 +1,33 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "joya/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "joya"
8
+ spec.version = Joya::VERSION
9
+ spec.authors = ["Sergio Romero"]
10
+ spec.email = ["sergioro@nmsu.edu"]
11
+
12
+ spec.summary = %q{Clone gems from a specified author}
13
+ spec.description = %q{Clone gems from a specified author with `joya rubygems_username`}
14
+ spec.homepage = "https://github.com/sergioro9/joya"
15
+ spec.license = "MIT"
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_development_dependency "bundler", "~> 2.0"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "minitest", "~> 5.0"
29
+ spec.add_development_dependency "minitest-reporters", "~> 1.3.8"
30
+ spec.add_development_dependency "byebug", "~> 11.0.1"
31
+
32
+ spec.add_runtime_dependency "nokogiri", "~> 1.10.4"
33
+ end
@@ -0,0 +1,97 @@
1
+ require "joya/version"
2
+ require 'open-uri'
3
+ require 'nokogiri'
4
+
5
+ class Array
6
+ def even_values
7
+ self.values_at(* self.each_index.select {|i| i.even?})
8
+ end
9
+ end
10
+
11
+ class String
12
+ def gem_installed?
13
+ gem_name=self.dup
14
+ path=ENV['GEM_PATH'].split(":")[0]
15
+ version='-[0-9]*\.[0-9]*\.[0-9]*'
16
+ !Dir.glob([path, 'gems', gem_name << version].join('/')).empty?
17
+ end
18
+ end
19
+
20
+ class Joya
21
+ class Error < StandardError; end
22
+
23
+ CSS='.gems__gem__name'
24
+ def self.main
25
+ parse_args
26
+ fetch_gems
27
+ %x(mkdir -p #{directory})
28
+ Dir.chdir directory
29
+ total=Joya.gems.size
30
+ digits=total.to_s.size
31
+ puts "#{total} gems found"
32
+ Joya.gems.each_with_index do |g,i|
33
+ printf("[%#{digits}d/%#{digits}d] Unpacking %s\n", i, total, g)
34
+ gem_install(g) unless g.gem_installed?
35
+ gem_unpack(g)
36
+ end
37
+ Dir.chdir '..'
38
+ puts "Done: gems available at #{directory}"
39
+ rescue
40
+ puts "There was a problem, maybe try with a different argument?"
41
+ end
42
+
43
+ def self.parse_args
44
+ Joya.author ||= ARGV.shift
45
+ if author.nil?
46
+ puts "Usage: joya <rubygems_author>"
47
+ exit
48
+ end
49
+ end
50
+
51
+ def self.url
52
+ "https://rubygems.org/profiles/#{Joya.author}"
53
+ end
54
+
55
+ def self.fetch_gems
56
+ page=Nokogiri::HTML(open(url))
57
+ Joya.gems=page.css(CSS).text.split(regex).even_values
58
+ .map{|s| s.gsub(/[ \n]/,'')}
59
+ .reject!{|s| s.empty?}
60
+ rescue OpenURI::HTTPError
61
+ puts "Could not find #{url}"
62
+ end
63
+
64
+ def self.regex
65
+ Regexp.new(/(?<=\w)\n/)
66
+ end
67
+
68
+ def self.gem_install(gem)
69
+ %x(gem install #{gem})
70
+ end
71
+
72
+ def self.gem_unpack(gem)
73
+ %x(gem unpack #{gem})
74
+ end
75
+
76
+ def self.directory
77
+ "gems-#{Joya.author}"
78
+ end
79
+
80
+ private
81
+
82
+ def self.author=(val)
83
+ @author=val
84
+ end
85
+
86
+ def self.author
87
+ @author
88
+ end
89
+
90
+ def self.gems=(val)
91
+ @gems=val
92
+ end
93
+
94
+ def self.gems
95
+ @gems
96
+ end
97
+ end
@@ -0,0 +1,3 @@
1
+ class Joya
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: joya
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Sergio Romero
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-10-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest-reporters
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.3.8
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.3.8
69
+ - !ruby/object:Gem::Dependency
70
+ name: byebug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 11.0.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 11.0.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: nokogiri
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 1.10.4
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 1.10.4
97
+ description: Clone gems from a specified author with `joya rubygems_username`
98
+ email:
99
+ - sergioro@nmsu.edu
100
+ executables:
101
+ - joya
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".gitignore"
106
+ - ".travis.yml"
107
+ - Gemfile
108
+ - Gemfile.lock
109
+ - LICENSE.txt
110
+ - README.md
111
+ - Rakefile
112
+ - bin/console
113
+ - bin/setup
114
+ - exe/joya
115
+ - joya.gemspec
116
+ - lib/joya.rb
117
+ - lib/joya/version.rb
118
+ homepage: https://github.com/sergioro9/joya
119
+ licenses:
120
+ - MIT
121
+ metadata: {}
122
+ post_install_message:
123
+ rdoc_options: []
124
+ require_paths:
125
+ - lib
126
+ required_ruby_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ required_rubygems_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ requirements: []
137
+ rubygems_version: 3.0.6
138
+ signing_key:
139
+ specification_version: 4
140
+ summary: Clone gems from a specified author
141
+ test_files: []