findclone 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +6 -0
- data/bin/fineclone +2 -0
- data/findclone.gemspec +23 -0
- data/lib/findclone.rb +192 -0
- data/lib/findclone/logger.rb +6 -0
- data/lib/findclone/version.rb +3 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: efeac85b3da745e223765de9bd273653b5e12095
|
4
|
+
data.tar.gz: 3afc5b81cba88e2eb5c034ed1aa2cf5eeafded36
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d87d5c8ca7cf6da7f9c47fdbcd136f9a8b01ca4c0fcf17fa7ab54bd79614422184e8b3fe4df4eb2c587eed48a006e70c5f5d0516ad25bfe2ea006b598a5320fe
|
7
|
+
data.tar.gz: 0f8841cef0e3642d1b0268634609f77bf78bf06de2508fe433198e9545ac65402bb75cbc9b259cec98cd0590a28e9389ac00276c76f16f23628c9e4899d4744d
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Josh
|
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
|
+
# Findclone
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'findclone'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install findclone
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( https://github.com/[my-github-username]/findclone/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/fineclone
ADDED
data/findclone.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/findclone/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = "findclone"
|
6
|
+
spec.version = Findclone::VERSION
|
7
|
+
spec.authors = ["Josh"]
|
8
|
+
spec.email = ["joshception@icloud.com"]
|
9
|
+
spec.summary = %q{crawl the interwebs for open sourced projects}
|
10
|
+
spec.description = %q{search through the depths of the internet for open-source projects}
|
11
|
+
spec.homepage = ""
|
12
|
+
spec.license = "MIT"
|
13
|
+
|
14
|
+
spec.files = `git ls-files -z`.split("\x0")
|
15
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
16
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
|
19
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
20
|
+
spec.add_development_dependency "rake"
|
21
|
+
spec.add_dependency 'launchy', '>= 2.4'
|
22
|
+
spec.add_dependency 'rainbow', '>= 2.0'
|
23
|
+
end
|
data/lib/findclone.rb
ADDED
@@ -0,0 +1,192 @@
|
|
1
|
+
#Encoding: utf-8
|
2
|
+
require_relative 'findclone/version'
|
3
|
+
# require_relative 'findclone/logger'
|
4
|
+
require 'net/http'
|
5
|
+
require 'uri'
|
6
|
+
require 'rainbow'
|
7
|
+
|
8
|
+
module Findclone
|
9
|
+
# beware
|
10
|
+
# very messy code below
|
11
|
+
|
12
|
+
$links = []
|
13
|
+
query = ARGV[0]
|
14
|
+
tracker = 0
|
15
|
+
cwd = Dir.pwd
|
16
|
+
|
17
|
+
ip = [00, 000, 00, 0]
|
18
|
+
sources = %w(github git stack stackoverflow open-source)
|
19
|
+
# sources.push(query)
|
20
|
+
ignore = %w(webcache.googleusercontent.com)
|
21
|
+
# atom can't process emojis
|
22
|
+
# ugh
|
23
|
+
yes = "✅" #this one is a checkmark emoji
|
24
|
+
no = "❌" #this one is an "x" emoji
|
25
|
+
|
26
|
+
def open(url)
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
unless query.nil?
|
31
|
+
case query
|
32
|
+
when '-v'
|
33
|
+
puts "lasthack crawler v#{Findclone::VERSION} (beta)"
|
34
|
+
else
|
35
|
+
sources.each do |s|
|
36
|
+
query = query.gsub ' ', '%20'
|
37
|
+
url = 'https://www.google.ca/search?q=' + query + s
|
38
|
+
content = Net::HTTP.get(URI.parse(url))
|
39
|
+
content = content.split "/url?q="
|
40
|
+
|
41
|
+
content.length.times do |i|
|
42
|
+
sources.length.times do |a|
|
43
|
+
if content[i].include? sources[a]
|
44
|
+
ignore.each do |m|
|
45
|
+
unless content[i].include? m
|
46
|
+
content[i] = content[i].gsub '/url?q=', ''
|
47
|
+
content[i] = content[i].split('&')[0]
|
48
|
+
content[i] = content[i].split('\n')
|
49
|
+
unless tracker == 0
|
50
|
+
$links.push(content[i])
|
51
|
+
end
|
52
|
+
tracker += 1
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# not too sure why this is deciding not to work
|
62
|
+
# $links.each do |link|
|
63
|
+
# if link.count('/') > 4
|
64
|
+
# $links.delete_at($links.index(link))
|
65
|
+
# puts 'removed'
|
66
|
+
# end
|
67
|
+
# end
|
68
|
+
|
69
|
+
# break out of messy code
|
70
|
+
|
71
|
+
if $links.nil?
|
72
|
+
puts 'what just happened'
|
73
|
+
puts 'this should not be happening'
|
74
|
+
else
|
75
|
+
if ARGV[1] == "-location"
|
76
|
+
begin
|
77
|
+
%x(cd #{ARGV[2]})
|
78
|
+
rescue
|
79
|
+
puts Rainbow("'#{ARGV[2]}' does not exist").red
|
80
|
+
end
|
81
|
+
end
|
82
|
+
# super mega ultra prototype
|
83
|
+
$links.each do |k|
|
84
|
+
# temporary fix
|
85
|
+
# for some reason the last thing in the array is html shit
|
86
|
+
# i don't care about trying to fix it right now
|
87
|
+
unless k.include? 'html'
|
88
|
+
raw_link = k.to_s
|
89
|
+
raw_link = raw_link[2..-3]
|
90
|
+
# thing = raw_link[19..raw_link.length]
|
91
|
+
# thing = thing.split '/'
|
92
|
+
# dev = thing[0]
|
93
|
+
# repo = thing[1]
|
94
|
+
#
|
95
|
+
arrow = Rainbow(' => ').blue
|
96
|
+
print Rainbow(raw_link).green + arrow
|
97
|
+
check = STDIN.gets.chomp
|
98
|
+
|
99
|
+
if check.downcase == 'yes' || check.downcase == 'y'
|
100
|
+
# print 'yes'
|
101
|
+
%x(git clone #{raw_link}.git)
|
102
|
+
puts Rainbow('Successfully Cloned').green
|
103
|
+
else
|
104
|
+
# print 'no'
|
105
|
+
end
|
106
|
+
%x(cd #{cwd})
|
107
|
+
end
|
108
|
+
end
|
109
|
+
# %x(link)
|
110
|
+
# do stuff here
|
111
|
+
# you now have access to an array of URL's
|
112
|
+
# cool
|
113
|
+
# might as well spit out the array right now
|
114
|
+
|
115
|
+
# $links.each do |p|
|
116
|
+
# puts p
|
117
|
+
# raw_url = open(p)
|
118
|
+
# if !raw_url.include? 'LICENSE'
|
119
|
+
# puts Rainbow('LICENSE referencing not found').red
|
120
|
+
# else
|
121
|
+
# puts 'LICENSE file found'
|
122
|
+
# puts 'Inspecting LICENSE'
|
123
|
+
# end
|
124
|
+
# end
|
125
|
+
end
|
126
|
+
|
127
|
+
if ARGV[1] == '-i'
|
128
|
+
|
129
|
+
while true
|
130
|
+
final = ip.join '.'.to_s
|
131
|
+
|
132
|
+
ip[3] += 1
|
133
|
+
|
134
|
+
counter = 0
|
135
|
+
if counter == 10
|
136
|
+
puts Rainbow('Searching').blue
|
137
|
+
end
|
138
|
+
|
139
|
+
if ip[3] == 10
|
140
|
+
ip[3] = 0
|
141
|
+
ip[2] += 1
|
142
|
+
end
|
143
|
+
|
144
|
+
if ip[2] == 100
|
145
|
+
ip[2] = 0
|
146
|
+
ip[1] += 1
|
147
|
+
end
|
148
|
+
|
149
|
+
if ip[1] == 1000
|
150
|
+
ip[1] = 0
|
151
|
+
ip[0] += 1
|
152
|
+
end
|
153
|
+
|
154
|
+
if final == "223.255.255.255"
|
155
|
+
break
|
156
|
+
end
|
157
|
+
|
158
|
+
if ip[2].to_s.length < 2
|
159
|
+
temp = ip[2]
|
160
|
+
# do something here
|
161
|
+
end
|
162
|
+
|
163
|
+
if ip[1].to_s.length < 3
|
164
|
+
temp = ip[1]
|
165
|
+
# do something here
|
166
|
+
end
|
167
|
+
|
168
|
+
if ip[0].to_s.length < 2
|
169
|
+
temp = ip[0]
|
170
|
+
# do something here
|
171
|
+
end
|
172
|
+
|
173
|
+
counter = 0
|
174
|
+
|
175
|
+
# implement crawler later
|
176
|
+
sources.each do |s|
|
177
|
+
ignore.each do |i|
|
178
|
+
begin
|
179
|
+
if ! open(final).include?(i) && open(final).include?(s)
|
180
|
+
# do some majik
|
181
|
+
end
|
182
|
+
rescue
|
183
|
+
# do absolutely nothing
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
else
|
190
|
+
puts Rainbow('You must specify a query').red
|
191
|
+
end
|
192
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: findclone
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Josh
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-11 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: '1.6'
|
20
|
+
type: :development
|
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: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: launchy
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.4'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.4'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rainbow
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.0'
|
69
|
+
description: search through the depths of the internet for open-source projects
|
70
|
+
email:
|
71
|
+
- joshception@icloud.com
|
72
|
+
executables:
|
73
|
+
- fineclone
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- bin/fineclone
|
82
|
+
- findclone.gemspec
|
83
|
+
- lib/findclone.rb
|
84
|
+
- lib/findclone/logger.rb
|
85
|
+
- lib/findclone/version.rb
|
86
|
+
homepage: ''
|
87
|
+
licenses:
|
88
|
+
- MIT
|
89
|
+
metadata: {}
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
requirements: []
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 2.3.0
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: crawl the interwebs for open sourced projects
|
110
|
+
test_files: []
|