jaz303-jaz303-deckard 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/bin/deckard +58 -0
  2. metadata +53 -0
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'yaml'
4
+ require 'fileutils'
5
+
6
+ def recurse(root, map)
7
+ map.each do |dir, data|
8
+ loc = File.join(root, dir)
9
+ if data.is_a?(Hash)
10
+ FileUtils.mkdir_p(loc)
11
+ recurse(loc, data)
12
+ elsif data.is_a?(Array)
13
+ if File.directory?(loc)
14
+ puts "Exists: #{loc} (skipping)"
15
+ next
16
+ end
17
+ puts "Checking out #{data.first} repository #{data.last} to #{loc}"
18
+ case data.first.to_sym
19
+ when :git
20
+ `git clone #{data.last} #{loc}`
21
+ when :svn
22
+ `svn co #{data.last} #{loc}`
23
+ else
24
+ puts "Unknown repo format: #{data.first}"
25
+ end
26
+ end
27
+ end
28
+ end
29
+
30
+ config_file = File.join(ENV['HOME'], '.deckard')
31
+ if !File.exists?(config_file)
32
+ puts "Error - couldn't read config from #{config_file}"
33
+ exit 1
34
+ end
35
+
36
+ config = YAML.load_file(config_file)
37
+ root = config['root']
38
+
39
+ if !root
40
+ puts "Error - root not specified"
41
+ exit 1
42
+ end
43
+
44
+ if root[0..0] != '/'
45
+ root = File.join(ENV['HOME'], root)
46
+ end
47
+
48
+ if !File.directory?(root)
49
+ puts "Error - #{root} is not a directory"
50
+ exit 1
51
+ end
52
+
53
+ if !config['repositories']
54
+ puts "Error - no repositories specified"
55
+ exit 1
56
+ end
57
+
58
+ recurse(root, config['repositories'])
metadata ADDED
@@ -0,0 +1,53 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jaz303-jaz303-deckard
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jason Frame
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-07-08 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: jason@onehackoranother.com
18
+ executables:
19
+ - deckard
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - bin/deckard
26
+ has_rdoc: false
27
+ homepage: http://github.com/jaz303/deckard/
28
+ post_install_message:
29
+ rdoc_options: []
30
+
31
+ require_paths:
32
+ - lib
33
+ required_ruby_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: "0"
38
+ version:
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ requirements: []
46
+
47
+ rubyforge_project:
48
+ rubygems_version: 1.2.0
49
+ signing_key:
50
+ specification_version: 2
51
+ summary: Replicate the structure of your development environment (i.e. checked out repositories) across multiple machines
52
+ test_files: []
53
+