1
0
Fork 0
mirror of https://github.com/Luzifer/github-masswatch.git synced 2024-10-18 12:44:25 +00:00

Bugfix: Unwatch was not working

This commit is contained in:
Knut Ahlers 2015-06-02 19:53:37 +02:00
parent cc710435cb
commit b27e1c9aaa
2 changed files with 25 additions and 15 deletions

View file

@ -17,6 +17,17 @@ This project is a small helper for mass-watching / unwatching in GitHub reposito
# bundle install
[...]
# ruby watch.rb help
Commands:
watch.rb help [COMMAND] # Describe available commands or one specific command
watch.rb list <regex> # lists all repos, useful to test your watch regex
watch.rb unwatch <regex> # unwatch all repos matching your regex
watch.rb watch <regex> # watch all repos matching your regex
watch.rb watched <regex> # show all watched repos, useful to test your unwatch regex
Options:
[--token=TOKEN]
# ruby watch.rb list --token=<mytoken>
Luzifer/alarmclock
Luzifer/alfred-fold
@ -25,14 +36,11 @@ Luzifer/AMZWishlist
Luzifer/awsenv
[...]
# ruby watch.rb watch '^Luzifer/.*' --token=<mytoken>
Subscribing to Luzifer/blog.knut.me...
Subscribing to Luzifer/go-selfupdate...
Subscribing to Luzifer/golang-builder...
Subscribing to Luzifer/habitrpg...
Subscribing to Luzifer/homebrew...
Subscribing to Luzifer/homebrew-tools...
Subscribing to Luzifer/license...
Subscribing to Luzifer/radiopi...
Subscribing to Luzifer/simpleproxy...
# ruby watch.rb list '^Luzifer/alfred-.*' --token=<mytoken>
Luzifer/alfred-fold
Luzifer/alfred-pwdgen
# ruby watch.rb watch '^Luzifer/alfred-.*' --token=<mytoken>
Subscribing to Luzifer/alfred-fold...
Subscribing to Luzifer/alfred-pwdgen...
```

View file

@ -26,7 +26,7 @@ class WatchCLI < Thor
get_repos().each do |repo|
if !subscriptions.include?(repo.full_name) and /#{regex}/.match(repo.full_name)
puts "Subscribing to #{repo.full_name}..."
get_octokit().update_subscription(repo.full_name, {subscribed: true})
get_octokit().update_subscription(repo.full_name, {subscribed: true})
end
end
end
@ -35,8 +35,10 @@ class WatchCLI < Thor
def unwatch(regex)
subscriptions = get_subscriptions()
get_repos().each do |repo|
puts "Unsubscribing from #{repo.full_name}..."
get_octokit().update_subscription(repo.full_name, {subscribed: false}) if subscriptions.include?(repo.full_name) and /#{regex}/.match(repo.full_name)
if subscriptions.include?(repo.full_name) and /#{regex}/.match(repo.full_name)
puts "Unsubscribing from #{repo.full_name}..."
get_octokit().delete_subscription(repo.full_name)
end
end
end
@ -53,9 +55,9 @@ class WatchCLI < Thor
def get_repos
client = get_octokit
repos = client.repositories(client.user.login)
orgs = client.organizations()
orgs.each do |org|
client.organization_repositories(org.login).each do |repo|