backgem 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.
Files changed (4) hide show
  1. data/LICENSE +22 -0
  2. data/README +1 -0
  3. data/bin/backgem +42 -0
  4. metadata +57 -0
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2009 Mitko Kostov
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1 @@
1
+ Backgem is dead simple tool for backing up and restoring installed gems
data/bin/backgem ADDED
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby
2
+ # Author: Mitko Kostov
3
+ # http://mitkokostov.info | mitko.kostov@gmail.com
4
+ # LICENSE: MIT
5
+
6
+ class Backgem
7
+
8
+ def get_list
9
+ @list = %x[gem list -d --no-details --no-versions].split(/\n/).join(" ")
10
+ end
11
+
12
+ def save_list
13
+ File.open('gems.txt',"w+") do |file|
14
+ file.write @list
15
+ end
16
+ end
17
+
18
+ def restore
19
+ File.open('gems.txt', "r") do |item|
20
+ item.each_line do |line|
21
+ system "sudo gem install #{line}"
22
+ end
23
+ end
24
+ end
25
+
26
+ def backup
27
+ get_list
28
+ save_list
29
+ end
30
+
31
+
32
+ def method_missing(name)
33
+ puts "Undefined command #{name}. Availble commands: backup and restore"
34
+ end
35
+ end
36
+
37
+ if ARGV[0]
38
+ action = Backgem.new
39
+ action.send(ARGV[0].to_sym)
40
+ else
41
+ puts "Usage: ./backgem.rb command"
42
+ end
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: backgem
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Mitko Kostov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-10-25 00:00:00 +03:00
13
+ default_executable: backgem
14
+ dependencies: []
15
+
16
+ description:
17
+ email: mitko.kostov@gmail.com
18
+ executables:
19
+ - backgem
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - LICENSE
24
+ - README
25
+ files:
26
+ - LICENSE
27
+ - README
28
+ has_rdoc: true
29
+ homepage: http://github.com/mitkok/backgem
30
+ licenses: []
31
+
32
+ post_install_message:
33
+ rdoc_options:
34
+ - --charset=UTF-8
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: "0"
42
+ version:
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: "0"
48
+ version:
49
+ requirements: []
50
+
51
+ rubyforge_project:
52
+ rubygems_version: 1.3.5
53
+ signing_key:
54
+ specification_version: 3
55
+ summary: Backgem is dead simple tool for backing up and restoring installed gems
56
+ test_files: []
57
+