usaidwat 0.0.10 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,4 +1,4 @@
1
- *.gem
2
- .bundle
1
+ .bundle/
3
2
  Gemfile.lock
4
- pkg/*
3
+ pkg/
4
+ *.gem
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "http://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in usaidwat.gemspec
4
4
  gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Michael Dippery
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Usaidwat
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'usaidwat'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install usaidwat
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
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 new Pull Request
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ desc "Clean built products"
4
+ task :clean do
5
+ rm_rf "pkg", :verbose => true
6
+ end
data/bin/usaidwat CHANGED
@@ -1,59 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'usaidwat'
4
- require 'usaidwat/utils'
5
- require 'rainbow'
6
4
 
7
-
8
- def die(code=1, stream=STDERR)
9
- stream.puts "Usage: #{File.basename $0} <user> [<subreddit>]"
10
- exit code
11
- end
12
-
13
- die if ARGV.length < 1 or ARGV.length > 2
14
-
15
- die(0, STDOUT) if ARGV.first == '--help' || ARGV.first == '-h'
16
-
17
- if ARGV.first == '--version' or ARGV.first == '-V'
18
- puts "usaidwat v#{USaidWat::VERSION}"
19
- exit 0
20
- end
21
-
22
- reddit_user = USaidWat::RedditUser.new ARGV.shift
23
- if ARGV.length == 0
24
- comments = reddit_user.retrieve_comments
25
- exit 2 unless comments
26
- max_key = comments.longest_subreddit.length
27
- comments.each { |c| printf "%-*s %s\n", max_key, c.first, c.last }
28
- else
29
- if ARGV[0] == '--all'
30
- comments = reddit_user.retrieve_comments
31
- comments.each do |record|
32
- subreddit = record[0]
33
- comments = reddit_user.comments_for_subreddit subreddit
34
- run_pager
35
- is_first = true
36
- comments.each do |c|
37
- puts unless is_first
38
- puts subreddit.foreground(:green).bright
39
- puts c
40
- is_first = false
41
- end
42
- end
43
- else
44
- subreddit = ARGV.shift
45
- comments = reddit_user.comments_for_subreddit subreddit
46
- unless comments
47
- puts "No comments by #{reddit_user.username} for #{subreddit}."
48
- exit 0
49
- end
50
- run_pager
51
- is_first = true
52
- comments.each do |c|
53
- puts unless is_first
54
- puts subreddit.foreground(:green).bright
55
- puts c
56
- is_first = false
57
- end
58
- end
59
- end
5
+ USaidWat.application.run(ARGV)