lazygem 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.rdoc +34 -31
  2. data/bin/lazygem +81 -77
  3. metadata +19 -10
@@ -1,31 +1,34 @@
1
- LazyGem
2
-
3
- LazyGem looks at your ATOM feed in your gemcutter profile and auto installs any gems that you are currently subscribed too.
4
- Very useful if you move to a new station. Lazygem requires that you have your credentials file setup according to your http://gemcutter.org/profile page.
5
- This file is used to pull your api_key to retrieve your ATOM feed.
6
-
7
- INSTALL:
8
-
9
- sudo gem install lazygem
10
-
11
- Requirements:
12
-
13
- Ruby (Developed on 1.8.7)
14
- RubyGems (Developed on 1.3.5)
15
-
16
- TODO:
17
-
18
- 1) Check to see if a gem from the subscribed feed is already installed.
19
- 2) Need to add tests.
20
-
21
- LICENSE
22
-
23
- (The MIT License)
24
-
25
- Copyright © 2010 Brian Scott <brainscott@gmail.com>
26
-
27
- 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:
28
-
29
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
30
-
31
- 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.
1
+ LazyGem
2
+
3
+ LazyGem looks at your ATOM feed in your gemcutter profile and auto installs any gems that you are currently subscribed too.
4
+ Very useful if you move to a new station. Lazygem requires that you have your credentials file setup according to your http://gemcutter.org/profile page.
5
+ This file is used to pull your api_key to retrieve your ATOM feed.
6
+
7
+ INSTALL:
8
+
9
+ sudo gem install lazygem
10
+
11
+ Requirements:
12
+
13
+ Ruby (Developed on 1.8.7)
14
+ RubyGems (Developed on 1.3.5)
15
+
16
+ TODO:
17
+
18
+ 1) Check to see if a gem from the subscribed feed is already installed.
19
+ 2) Need to add tests.
20
+
21
+ Currently Working on:
22
+ - Working on gem detection for ver 0.0.4 release
23
+
24
+ LICENSE
25
+
26
+ (The MIT License)
27
+
28
+ Copyright © 2010 Brian Scott <brainscott@gmail.com>
29
+
30
+ 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:
31
+
32
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
33
+
34
+ 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.
@@ -1,77 +1,81 @@
1
- #!/usr/bin/ruby
2
-
3
- # LazyGem 0.0.3
4
- # Author: Brian Scott
5
- #
6
- # Copyright (c) 2010 Brian Scott <brainscott@gmail.com>
7
- #
8
- # Permission is hereby granted, free of charge, to any person obtaining
9
- # a copy of this software and associated documentation files (the
10
- # "Software"), to deal in the Software without restriction, including
11
- # without limitation the rights to use, copy, modify, merge, publish,
12
- # distribute, sublicense, and/or sell copies of the Software, and to
13
- # permit persons to whom the Software is furnished to do so, subject to
14
- # the following conditions:
15
- #
16
- # The above copyright notice and this permission notice shall be
17
- # included in all copies or substantial portions of the Software.
18
- #
19
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24
- # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25
- # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
-
27
-
28
- $:.unshift File.dirname(__FILE__)
29
-
30
- require 'rubygems'
31
- require 'simple-rss'
32
- require 'open-uri'
33
-
34
- # Local Variables
35
- rUrl = "http://gemcutter.org/dashboard.atom?api_key="
36
- titles = Array.new
37
-
38
- # Grabing API key from local credentials file
39
- def read_file ()
40
- data = ""
41
- temp = File.open("#{ENV['HOME']}/.gem/credentials", 'r')
42
- temp.each_line do |line|
43
- data += line
44
- end
45
- return data
46
- end
47
-
48
- # Cleaning up file
49
- api_key = read_file
50
- api_key = api_key.split(/\:\w+\: (.+)/)[1]
51
-
52
- puts "Retrieving ATOM feed from Gemcutter.org"
53
- atom = SimpleRSS.parse open(rUrl + api_key)
54
- # parsing ATOM feed for gem titles
55
- atom.entries.each do |entry|
56
- title = entry.title
57
- title = title.gsub(/ \(.*/, "")
58
- titles.push(title)
59
- end
60
-
61
- # Cleaning up ATOM duplicate entries
62
- titlesAry = titles.uniq!
63
-
64
- # Installing subscribed gems
65
- titlesAry.each do |title|
66
-
67
- puts "Installing #{title}"
68
-
69
- if RUBY_PLATFORM =~ /mingw/
70
-
71
- system("gem install #{title}")
72
-
73
- else system("sudo gem install #{title}")
74
-
75
- end
76
- end
77
-
1
+ #!/usr/local/bin/ruby
2
+
3
+ # LazyGem 0.0.5
4
+ # Author: Brian Scott
5
+ #
6
+ # Copyright (c) 2010 Brian Scott <brainscott@gmail.com>
7
+ #
8
+ # Permission is hereby granted, free of charge, to any person obtaining
9
+ # a copy of this software and associated documentation files (the
10
+ # "Software"), to deal in the Software without restriction, including
11
+ # without limitation the rights to use, copy, modify, merge, publish,
12
+ # distribute, sublicense, and/or sell copies of the Software, and to
13
+ # permit persons to whom the Software is furnished to do so, subject to
14
+ # the following conditions:
15
+ #
16
+ # The above copyright notice and this permission notice shall be
17
+ # included in all copies or substantial portions of the Software.
18
+ #
19
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
+
27
+ # LazyGem installs gems that you are subscribed to on RubyGems.org. Pulls "My Subscriptions" from the dashboard page.
28
+
29
+ # $:.unshift File.dirname(__FILE__)
30
+
31
+ require 'rubygems'
32
+ require 'open-uri'
33
+ require 'nokogiri'
34
+ require 'mechanize'
35
+
36
+ # Varibles
37
+ gemarray = Array.new
38
+ gems = Array.new
39
+ subscriptions_re = /^\/[^\/]+\/(.+)$/
40
+
41
+ # Start of Application
42
+ puts "Please provide your RubyGems.org login."
43
+ puts "What is your username?"
44
+ username = gets.chomp
45
+ puts "What is your password?"
46
+ password = gets.chomp
47
+
48
+ # Logging into RubyGems.org and Parse the Dashboard for subscriptions
49
+ agent = Mechanize.new
50
+ agent.get("http://rubygems.org/session/new")
51
+ form = agent.page.forms[1]
52
+ form['session[email]'] = username
53
+ form['session[password]'] = password
54
+ form.submit
55
+ agent.page.link_with(:text => "dashboard").click
56
+ agent.page.links.each do |link|
57
+ gemArray.push(link.href) if link.href.match(subscriptions_re)
58
+ end
59
+
60
+ # Cleaning up gem list that was pulled from rubygems.org
61
+ gemarray.uniq
62
+ gemarray.each do |gem|
63
+ t = gem.match(subscriptions_re).captures
64
+ gems.push(t)
65
+ end
66
+
67
+ # Installing subscribed gems
68
+
69
+ gems.each do |title|
70
+
71
+ puts "Installing #{title}"
72
+
73
+ if RUBY_PLATFORM =~ /mingw/
74
+
75
+ system("gem install #{title}")
76
+
77
+ else system("sudo gem install #{title}")
78
+
79
+ end
80
+ end
81
+
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lazygem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 5
9
+ version: 0.0.5
5
10
  platform: ruby
6
11
  authors:
7
12
  - Brian Scott
@@ -9,19 +14,21 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-08 00:00:00 -08:00
17
+ date: 2010-05-06 00:00:00 -07:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
- name: simple-rss
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
21
+ name: mechanize
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
23
29
  version: "0"
24
- version:
30
+ type: :runtime
31
+ version_requirements: *id001
25
32
  description: Auto Installs gems that you are subscribed to on gemcutter.org.
26
33
  email: brainscott@gmail.com
27
34
  executables:
@@ -51,18 +58,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
51
58
  requirements:
52
59
  - - ">="
53
60
  - !ruby/object:Gem::Version
61
+ segments:
62
+ - 0
54
63
  version: "0"
55
- version:
56
64
  required_rubygems_version: !ruby/object:Gem::Requirement
57
65
  requirements:
58
66
  - - ">="
59
67
  - !ruby/object:Gem::Version
68
+ segments:
69
+ - 0
60
70
  version: "0"
61
- version:
62
71
  requirements: []
63
72
 
64
73
  rubyforge_project: lazygem
65
- rubygems_version: 1.3.5
74
+ rubygems_version: 1.3.6
66
75
  signing_key:
67
76
  specification_version: 3
68
77
  summary: Auto Installs gems that you are subscribed to on gemcutter.org. Great, if you are moving to a new system and don't want to install each of your favorite gems