lazy_fork 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 40f12ef820c5cd5d1e7e496765a2aa7312a4d0fd
4
+ data.tar.gz: a45d6177b1ce78f6a31037a71e0a8ed7a5496750
5
+ SHA512:
6
+ metadata.gz: 35724883ad89ffd04d6c7a034a7e3f4cd6205ece17ab3dcef37e86ae899f292c5765900978919e6c86e02c62b76aff0b40d091444aa2b5501fc6b92367238a15
7
+ data.tar.gz: 20537b72f8aebc6057b9451f35eb58e844b19663d0cfa39a722f97918aaa6be67b136ea768b2d2158cab011e0ddf37e1d01f1a8cec74d9a5fe38a6a46331facf
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.0
5
+ before_install: gem install bundler -v 1.14.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in lazy_fork.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Christian Gregg
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.
data/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # LazyFork - a command line utility for all the lazy forkers out there
2
+
3
+ Who really wants to go through a web interface to fork a repo, just to head back to the command line to clone it?
4
+
5
+ Fork and clone your fork all without leaving the comfort of your terminal. :relieved:
6
+ ## Installation
7
+
8
+ $ gem install lazy_fork
9
+
10
+ ## Usage
11
+
12
+ $ lazy_fork --repo <owner>/<repo>
13
+
14
+ For example, if you wanted to fork this repo:
15
+
16
+ $ lazy_fork --repo CGA1123/lazy_fork
17
+
18
+ ## Development
19
+
20
+ TODO
21
+
22
+ ## Contributing
23
+
24
+ Bug reports and pull requests are welcome on GitHub at https://github.com/CGA1123/lazy_fork.
25
+
26
+
27
+ ## License
28
+
29
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
30
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "lazy_fork"
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__)
data/bin/lazy_fork ADDED
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'lazy_fork'
4
+ require 'optparse'
5
+ require 'octokit'
6
+ require 'io/console'
7
+ require 'fileutils'
8
+
9
+ HOME = File.expand_path("~")
10
+
11
+ FileUtils.mkdir_p "#{HOME}/.lazy_forker"
12
+
13
+ puts "You lazy forker..."
14
+
15
+ options = {}
16
+ OptionParser.new do |opt|
17
+ opt.on('--repo user/repo', '-r user/repo', 'GitHub user/repo to be forked & cloned') { |o| options[:repo] = o }
18
+ end.parse!
19
+
20
+ if options[:repo].nil?
21
+ puts "repo must be specified!"
22
+ abort
23
+ end
24
+
25
+ if File.exists?("#{HOME}/.lazy_forker/oauth")
26
+ puts "OAuth key found..."
27
+ token = File.open("#{HOME}/.lazy_forker/oauth", "r").read
28
+ client = Octokit::Client.new access_token: token
29
+ else
30
+ puts "Basic Authentication"
31
+ print "username: "
32
+ user = gets.chomp
33
+ print "password: "
34
+ pass = STDIN.noecho(&:gets).chomp
35
+ puts ""
36
+ client = Octokit::Client.new \
37
+ login: user,
38
+ password: pass
39
+ puts "Creating OAuth Token..."
40
+ token = client.create_authorization(:scopes => ["user","repo"], :note => "Lazy Forker Access Token")
41
+ File.open("#{HOME}/.lazy_forker/oauth",'w') do |s|
42
+ s.puts token[:token]
43
+ end
44
+ puts "Token created!"
45
+ end
46
+
47
+ begin
48
+ repo = Octokit::Repository.new(options[:repo])
49
+ rescue Octokit::InvalidRepository
50
+ puts "Invalid Repository: use owner/name format!"
51
+ abort
52
+ end
53
+
54
+ unless Octokit.repository?(repo)
55
+ puts "Repo #{repo.to_s} could not be found."
56
+ abort
57
+ end
58
+
59
+ puts "Repo #{repo.to_s} found."
60
+
61
+ fork_repo = client.fork(repo)
62
+
63
+ puts "Forked #{repo.to_s} to #{fork_repo[:full_name]}"
64
+
65
+ puts "Cloning Fork..."
66
+
67
+ `git clone #{fork_repo[:html_url]}`
data/bin/setup ADDED
@@ -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
data/lazy_fork.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'lazy_fork/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "lazy_fork"
8
+ spec.version = LazyFork::VERSION
9
+ spec.authors = ["Christian Gregg"]
10
+ spec.email = ["c_arlt@hotmail.com"]
11
+
12
+ spec.summary = %q{A gem for lazy forkers.}
13
+ spec.homepage = "https://github.com/CGA1123/lazy_fork"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+
20
+ spec.executables = ["lazy_fork"]
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.14"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "rspec", "~> 3.0"
26
+
27
+ spec.add_runtime_dependency "octokit"
28
+ end
@@ -0,0 +1,3 @@
1
+ module LazyFork
2
+ VERSION = "0.0.1"
3
+ end
data/lib/lazy_fork.rb ADDED
@@ -0,0 +1,9 @@
1
+ require "lazy_fork/version"
2
+
3
+ require "optparse"
4
+
5
+ module LazyFork
6
+ def lazy_fork
7
+ end
8
+ module_function :lazy_fork
9
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lazy_fork
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Christian Gregg
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-05-30 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.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.14'
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: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: octokit
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description:
70
+ email:
71
+ - c_arlt@hotmail.com
72
+ executables:
73
+ - lazy_fork
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".travis.yml"
80
+ - Gemfile
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - bin/console
85
+ - bin/lazy_fork
86
+ - bin/setup
87
+ - lazy_fork.gemspec
88
+ - lib/lazy_fork.rb
89
+ - lib/lazy_fork/version.rb
90
+ homepage: https://github.com/CGA1123/lazy_fork
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 2.6.11
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: A gem for lazy forkers.
114
+ test_files: []