rubygemfeed 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,10 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2012 Daniel P. Clark & 6ft Dan(TM)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10
+
data/README ADDED
@@ -0,0 +1,11 @@
1
+ RubyGemFeed
2
+ by Daniel P. Clark
3
+ License: MIT License
4
+
5
+ Get the latest updates and newest releases from RubyGems.org in a nice readable console. Also search any gems you might be interested for a little detail on it.
6
+
7
+ On the command line type:
8
+
9
+ rubygemfeed new
10
+ rubygemfeed updated
11
+ rubygemfeed mygem
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/ruby
2
+ # by Daniel P. Clark
3
+ # webmaster@6ftdan.com
4
+ # @6ftdan on Twitter
5
+
6
+ require 'rubygems'
7
+ require 'rubygemfeed'
8
+
9
+ if ARGV.count == 0
10
+ RubyGemFeed::new50
11
+ elsif ARGV.count == 1
12
+ if ARGV.include?('updated')
13
+ RubyGemFeed::updated50
14
+ elsif ARGV.include?('new')
15
+ RubyGemFeed::new50
16
+ elsif ARGV.include?('help') or ARGV.include?('--help')
17
+ puts "rubygemfeed usage:\n rubygemfeed new\n rubygemfeed updated\n rubygemfeed <your gem here>\n"
18
+ else
19
+ RubyGemFeed::querygem(ARGV[0])
20
+ end
21
+ else
22
+ ARGV.each do |search_item|
23
+ RubyGemFeed::querygem(search_item)
24
+ end
25
+ end
26
+
27
+ puts
@@ -0,0 +1,50 @@
1
+ require 'rubygems'
2
+ require 'open-uri'
3
+ require 'json'
4
+ require 'mightystring'
5
+ require 'rubygemfeed/version'
6
+
7
+ module RubyGemFeed
8
+ MAX_INFO_LENGTH = 76
9
+
10
+ def self.parse_url(in_url = 'https://rubygems.org/api/v1/activity/latest.json')
11
+ content = open(in_url).read
12
+ rgems = JSON.parse(content)
13
+ self.parse(rgems)
14
+ end
15
+
16
+ def self.parse(rgems)
17
+ rgnames = []
18
+ rgems.each do |x|
19
+ rgnames << [x['name'], x['version'], x['authors'], x['info'], x['project_uri']]
20
+ end
21
+ puts (
22
+ rgnames.map { |x|
23
+ x[0] = (
24
+ x[0].gsub(/([-_])/, ' ').split.map { |y|
25
+ y.capitalize
26
+ }
27
+ ).join(' ')
28
+ x[3] = x[3][0..MAX_INFO_LENGTH]
29
+ "\n#{x[0]} #{x[1]} ( by #{x[2]} )\n #{x[3]}\n #{x[4]}\n"
30
+ }
31
+ )
32
+ end
33
+
34
+ def self.new50
35
+ self.parse_url
36
+ end
37
+
38
+ def self.updated50
39
+ self.parse_url('https://rubygems.org/api/v1/activity/just_updated.json')
40
+ end
41
+
42
+ def self.querygem(name)
43
+ begin
44
+ rgem = JSON.parse(open("https://rubygems.org/api/v1/gems/#{name.strip_byac((('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a + ['-','_']).flatten.join(''))}.json").read)
45
+ self.parse([rgem])
46
+ rescue
47
+ puts "\n!!! GEM #{name} NOT FOUND !!!\n"
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,3 @@
1
+ module RubyGemFeed
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubygemfeed
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Daniel P. Clark / 6ftDan(TM)
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-11-26 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: mightystring
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 27
29
+ segments:
30
+ - 0
31
+ - 1
32
+ - 0
33
+ version: 0.1.0
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ description: RubyGemFeed provides command line feed of the newest gems, most recently updated gems, and any specific gem you would like to look up
37
+ email: webmaster@6ftdan.com
38
+ executables:
39
+ - rubygemfeed
40
+ extensions: []
41
+
42
+ extra_rdoc_files:
43
+ - README
44
+ files:
45
+ - bin/rubygemfeed
46
+ - lib/rubygemfeed/version.rb
47
+ - lib/rubygemfeed.rb
48
+ - README
49
+ - LICENSE
50
+ homepage: http://www.github.com/danielpclark/RubyGemFeed
51
+ licenses:
52
+ - The MIT License (MIT)
53
+ post_install_message: Enjoy your Gem goodness!
54
+ rdoc_options:
55
+ - --main
56
+ - README
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ hash: 3
65
+ segments:
66
+ - 0
67
+ version: "0"
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ requirements: []
78
+
79
+ rubyforge_project:
80
+ rubygems_version: 1.8.24
81
+ signing_key:
82
+ specification_version: 3
83
+ summary: Provides a command line feed of what's new in the rubygems.org world.
84
+ test_files: []
85
+