beginning_open_source 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5d0569c0a434023a4d38061c61defb296ca8b34a
4
+ data.tar.gz: 000938c955852253fbc125a7276ebee3171b68ec
5
+ SHA512:
6
+ metadata.gz: 741e8cc28710aa921af43c5c9598681492108d5c3ebf2c7dcd841c59b8dcdc20cfa4a8249db71395bba018e9e95882aae176cb44e3ae223be4355707056d154c
7
+ data.tar.gz: fbafb65ac20be15e97bcd3e37370df65c58d96274cdbb304412d77a0cea6c3430cb4b1b4037b03d1c1d3ada8d2f15e0a76505dd06335c35050a8c963b568575f
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /lib/secrets.rb
11
+ /lib/this_will_be_secrets_file.rb
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ before_install: gem install bundler -v 1.10.6
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in beginning_open_source.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Corey Morris
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,64 @@
1
+ # BeginningOpenSource
2
+
3
+ A tool to find beginner friendly open source issues to work on.
4
+
5
+ **NOTE:** Unless you provide a github token to authenicate, your search results will only return repository descriptions and stars once per hour due to github api restrictions". Please only generate a public token as this application only accesses public data. Instructions to generate a github token are here: https://help.github.com/articles/creating-an-access-token-for-command-line-use/ .
6
+
7
+ ###Other resources for finding beginner friendly open source projects*:
8
+
9
+ http://www.agileventures.org/
10
+
11
+ http://24pullrequests.com/projects
12
+
13
+ https://contribulator.herokuapp.com/?language=Ruby
14
+
15
+ http://www.codetriage.com/
16
+
17
+ https://github.com/trending
18
+
19
+ https://blog.newrelic.com/2014/05/05/open-source_gettingstarted/
20
+
21
+ https://www.youtube.com/watch?v=IXnNgLmd6BM
22
+
23
+ https://www.youtube.com/watch?v=0OQg42gSol4
24
+
25
+ https://guides.github.com/activities/contributing-to-open-source/
26
+
27
+ https://www.quora.com/How-can-I-contribute-to-open-source-software
28
+
29
+
30
+ ## Installation
31
+
32
+ Add this line to your application's Gemfile:
33
+
34
+ ```ruby
35
+ gem 'beginning_open_source'
36
+ ```
37
+
38
+ And then execute:
39
+
40
+ $ bundle
41
+
42
+ Or install it yourself as:
43
+
44
+ $ gem install beginning_open_source
45
+
46
+ ## Usage
47
+
48
+ TODO: Write usage instructions here
49
+
50
+ ## Development
51
+
52
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
53
+
54
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
55
+
56
+ ## Contributing
57
+
58
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/beginning_open_source. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
59
+
60
+
61
+ ## License
62
+
63
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
64
+
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
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'beginning_open_source/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "beginning_open_source"
8
+ spec.version = BeginningOpenSource::VERSION
9
+ spec.authors = ["Corey Morris"]
10
+ spec.email = ["coreym247@gmail.com"]
11
+
12
+ spec.summary = %q{A tool to find beginner friendly open source issues to work on.}
13
+ spec.description = %q{A tool to find beginner friendly open source issues to work on.}
14
+ spec.homepage = "https://github.com/c1505/beginning-open-source"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
+ # delete this section to allow pushing this gem to any host.
19
+
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
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", "~> 1.10"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rspec"
29
+ spec.add_development_dependency "pry"
30
+
31
+ spec.add_dependency "httparty"
32
+
33
+
34
+ end
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require '../lib/beginning_open_source'
3
+ BeginningOpenSource::CLI.new.call
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "beginning_open_source"
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
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,11 @@
1
+ require_relative "beginning_open_source/version"
2
+ require_relative "beginning_open_source/github_api.rb"
3
+ require_relative "beginning_open_source/issues.rb"
4
+
5
+
6
+ require_relative "secrets.rb"
7
+ require_relative "cli"
8
+
9
+ require 'json'
10
+ require 'httparty'
11
+ # require 'pry' #just for development
@@ -0,0 +1,97 @@
1
+ class BeginningOpenSource::GithubApi
2
+
3
+ #i am passing around variables. might be better off using class variables.
4
+ @@array_of_issues = []
5
+
6
+ def self.get_issues(input_string) #still very long. refactor
7
+ response = self.search_issues(input_string)
8
+
9
+ puts "Total Issue count matching #{input_string}:".blue + " #{response["total_count"]}".red
10
+
11
+ search_results = JSON.parse(response.body)["items"]
12
+
13
+ loaded_repo_count = 1
14
+ search_results.each do |issue|
15
+ hash_of_issue = {}
16
+
17
+ issue_url_array = issue["html_url"].split("/")
18
+
19
+ hash_of_issue[:repo_name] = issue_url_array[4]
20
+ repo_string = "https://api.github.com/repos/#{issue_url_array[3]}/#{issue_url_array[4]}"
21
+
22
+ hash_of_issue[:title] = issue["title"]
23
+ hash_of_issue[:labels] = (issue["labels"].map {|issue| issue["name"]})
24
+ hash_of_issue[:body] = issue["body"]
25
+ hash_of_issue[:html_url] = issue["html_url"]
26
+ hash_of_issue[:created_at] = issue["created_at"]
27
+ hash_of_issue[:repo_url] = repo_string
28
+
29
+ if loaded_repo_count > 10
30
+ puts "loading #{loaded_repo_count}/30"
31
+ end
32
+ loaded_repo_count += 1
33
+
34
+ self.get_repository(issue_url_array[3], issue_url_array[4], hash_of_issue)
35
+
36
+ @@array_of_issues << hash_of_issue
37
+
38
+ end #end of each statement
39
+ @@array_of_issues
40
+ #there are pagination options.
41
+ # right now it is only giving me 30 per page. can go up to 100
42
+ end #end of method
43
+
44
+ def self.search_issues(input_string)
45
+ if self.token == 'PASTE_TOKEN_HERE_AS_STRING' #doing this twice, but with a different url. if i take in the url or have it set as a variable, i might be able to combine these
46
+ response = HTTParty.get("https://api.github.com/search/issues?q=label:\"#{input_string}\"+language:ruby+state:open&sort=created&order=desc")
47
+ else
48
+ response = HTTParty.get("https://api.github.com/search/issues?q=label:\"#{input_string}\"+language:ruby+state:open&sort=created&order=desc",
49
+ :headers => {
50
+ "Authorization" => "token #{self.token}",
51
+ "User-Agent" => self.agent
52
+ })
53
+ end
54
+ response
55
+ end
56
+
57
+ def self.get_repository(user, repository, hash)
58
+ if self.token == 'PASTE_TOKEN_HERE_AS_STRING'
59
+ repo_json = HTTParty.get("https://api.github.com/repos/#{user}/#{repository}")
60
+ else
61
+ repo_json = HTTParty.get(
62
+ "https://api.github.com/repos/#{user}/#{repository}",
63
+ :headers => {
64
+ "Authorization" => "token #{self.token}",
65
+ "User-Agent" => self.agent
66
+ })
67
+ end
68
+ repo_parsed = JSON.parse(repo_json.body)
69
+ hash[:repo_description] = repo_parsed["description"]
70
+ hash[:stars] = repo_parsed["stargazers_count"]
71
+ hash
72
+ end
73
+
74
+ end #end of class
75
+
76
+ class String
77
+ #colorization
78
+ def colorize(color_code)
79
+ "\e[#{color_code}m#{self}\e[0m"
80
+ end
81
+
82
+ def yellow
83
+ colorize(33)
84
+ end
85
+
86
+ def blue
87
+ colorize(34)
88
+ end
89
+
90
+ def green
91
+ colorize(32)
92
+ end
93
+
94
+ def red
95
+ colorize(31)
96
+ end
97
+ end
@@ -0,0 +1,31 @@
1
+ class BeginningOpenSource::Issues
2
+ attr_accessor :title, :html_url, :repo_name, :repo_description, :body, :stars, :created_at, :labels, :repo_url
3
+
4
+ @@all = []
5
+
6
+ @@starred = []
7
+
8
+ def initialize(issues_hash)
9
+ issues_hash.each {|key, value| self.send(("#{key}="), value)}
10
+ @@all << self
11
+ unless @stars == nil
12
+ if @stars > 0
13
+ @@starred << self
14
+ end
15
+ end
16
+ end
17
+
18
+ def self.create_from_collection(issues_array)
19
+ issues_array.each do |issue|
20
+ BeginningOpenSource::Issues.new(issue)
21
+ end
22
+ end
23
+
24
+ def self.all
25
+ @@all
26
+ end
27
+
28
+ def self.starred
29
+ @@starred
30
+ end
31
+ end
@@ -0,0 +1,3 @@
1
+ module BeginningOpenSource
2
+ VERSION = "0.1.0"
3
+ end
data/lib/cli.rb ADDED
@@ -0,0 +1,86 @@
1
+ class BeginningOpenSource::CLI
2
+
3
+ def call
4
+ generate_secret_file
5
+ welcome
6
+ puts "**Caution**\n
7
+ If you don't provide a github token to authenicate, your search results will only return repository descriptions and stars once per hour due to github api restrictions".yellow
8
+ list_beginner_issues
9
+ search_issues
10
+ goodbye
11
+ end
12
+
13
+ def welcome
14
+ puts "Welcome to beginning open source!".blue
15
+ puts "Viewing open github issues labeled 'beginner' within the ruby language".blue
16
+ puts " "
17
+ puts "With this tool, you can find issues on github by label".blue
18
+ end
19
+
20
+ def generate_secret_file
21
+ File.open("../lib/this_will_be_secrets_file.rb", 'w'){|f| f.write("class BeginningOpenSource::GithubApi
22
+ def self.token
23
+ 'PASTE_TOKEN_HERE_AS_STRING'
24
+ end
25
+
26
+ def self.agent
27
+ 'PASTE_GITHUB_USERNAME_HERE_AS_STRING'
28
+ end
29
+ end")}
30
+ end
31
+
32
+ def list_beginner_issues #by default, it will return issues in github repos with 1 star or more
33
+ get_and_print('beginner')
34
+ end
35
+
36
+ def search_issues
37
+ input = nil
38
+ while input != "exit"
39
+ puts "\n" + "Enter the issue label you would like to search for or type 'exit'".green
40
+ input = gets.chomp.scan(/[a-z\s]/).join
41
+ unless input == 'exit'
42
+ get_and_print(input)
43
+ end
44
+ # list_issues #do i want to return all issues or just the last searched ones. i'm thinking last searched
45
+ #possibly could store the other in memory to retrieve again if i want
46
+ end
47
+ end
48
+
49
+ def goodbye
50
+ puts "Happy learning!"
51
+ end
52
+
53
+ def get_and_print(input_string)
54
+ issues_array = BeginningOpenSource::GithubApi.get_issues(input_string)
55
+
56
+ BeginningOpenSource::Issues.create_from_collection(issues_array)
57
+ if BeginningOpenSource::Issues.starred.empty?
58
+ BeginningOpenSource::Issues.all.each do |issue|
59
+ length = "Repository Url: #{issue.repo_url}".length
60
+ puts " "
61
+ puts "Issue Title: #{issue.title}".blue
62
+ puts "Repository Name: #{issue.repo_name}"
63
+ puts "Repository Description: #{issue.repo_description}"
64
+ puts "Stars: #{issue.stars}"
65
+ puts "Labels: #{issue.labels}"
66
+ puts "Issue Url: #{issue.html_url}"
67
+ puts "Repository Url: #{issue.repo_url}"
68
+ length.times {print "*"}
69
+ end
70
+ else
71
+ BeginningOpenSource::Issues.starred.each do |issue|
72
+ length = "Repository Url: #{issue.repo_url}".length
73
+ puts " "
74
+ puts "Issue Title: #{issue.title}".blue
75
+ puts "Repository Name: #{issue.repo_name}"
76
+ puts "Repository Description: #{issue.repo_description}"
77
+ puts "Stars: #{issue.stars}"
78
+ puts "Labels: #{issue.labels}"
79
+ puts "Issue Url: #{issue.html_url}"
80
+ puts "Repository Url: #{issue.repo_url}"
81
+ length.times {print "*"}
82
+ end
83
+ end
84
+ end
85
+
86
+ end
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: beginning_open_source
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Corey Morris
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-01-17 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.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
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: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: httparty
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: A tool to find beginner friendly open source issues to work on.
84
+ email:
85
+ - coreym247@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - ".travis.yml"
93
+ - CODE_OF_CONDUCT.md
94
+ - Gemfile
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - beginning_open_source.gemspec
99
+ - bin/beginning-open-source
100
+ - bin/console
101
+ - bin/setup
102
+ - lib/beginning_open_source.rb
103
+ - lib/beginning_open_source/github_api.rb
104
+ - lib/beginning_open_source/issues.rb
105
+ - lib/beginning_open_source/version.rb
106
+ - lib/cli.rb
107
+ homepage: https://github.com/c1505/beginning-open-source
108
+ licenses:
109
+ - MIT
110
+ metadata: {}
111
+ post_install_message:
112
+ rdoc_options: []
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 2.4.8
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: A tool to find beginner friendly open source issues to work on.
131
+ test_files: []
132
+ has_rdoc: