kevincolyar-rbsync 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.
File without changes
@@ -0,0 +1,14 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('rbsync', '0.1.0') do |p|
6
+ p.description = "Rsync wrapper to provide easy push and pull from the command line"
7
+ p.url = ''
8
+ p.author = 'Kevin Colyar'
9
+ p.email = 'kevin@colyar.net'
10
+ p.ignore_pattern = ["tmp/*", "script/*"]
11
+ p.development_dependencies = []
12
+ end
13
+
14
+ Dir["#File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'rbsync'
5
+
6
+ if ARGV.size < 1
7
+ puts "Usage: pull_from <host> [path] [rsync args]"
8
+ exit
9
+ end
10
+
11
+ Rbsync.new.pull_from ARGV
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.dirname(__FILE__) + '/../lib/rbsync.rb'
4
+ require 'rubygems'
5
+
6
+ if ARGV.size < 1
7
+ puts "Usage: push_to <host> [path] [rsync args]"
8
+ exit
9
+ end
10
+
11
+ Rbsync.new.push_to ARGV
12
+
@@ -0,0 +1,57 @@
1
+ class Rbsync
2
+
3
+ def initialize
4
+ read_config
5
+ end
6
+
7
+ def read_config
8
+ yaml = YAML::load(File.open(File.expand_path('~/.rbsync')))
9
+ @rsync_args = yaml['rsync'] || ''
10
+ @mappings = yaml['mappings'] || {}
11
+ end
12
+
13
+ def map_path(path)
14
+ @mappings.each_pair do |key, value|
15
+ path = path.gsub(key, value)
16
+ end
17
+ return path
18
+ end
19
+
20
+ def get_paths(argv)
21
+ path = {}
22
+ path[:remote] = argv.shift
23
+
24
+ if argv[0] and /^\-/ =~ argv[0]
25
+ path[:local] = File.expand_path('.')
26
+ else
27
+ path[:local] = File.expand_path(argv.shift || '.')
28
+ end
29
+
30
+ path[:local] += '/' if File.directory? path[:local]
31
+ path[:remote] = map_path(path[:remote] + ':' + path[:local])
32
+ return path
33
+ end
34
+
35
+ def get_rsync_args(argv)
36
+ rsync_args = @rsync_args + ' '
37
+ rsync_args += argv.join ' '
38
+ return rsync_args
39
+ end
40
+
41
+ def push_to(argv)
42
+ path = get_paths(argv)
43
+ rsync_args = get_rsync_args(argv)
44
+
45
+ puts "Pushing #{path[:local]} to #{path[:remote]} with options #{rsync_args}"
46
+ exec("rsync \"#{path[:local]}\" \"#{path[:remote]}\" #{rsync_args}")
47
+ end
48
+
49
+ def pull_from(argv)
50
+ path = get_paths(argv)
51
+ rsync_args = get_rsync_args(argv)
52
+
53
+ puts "Pulling #{path[:remote]} to #{path[:local]} with options #{rsync_args}"
54
+ exec("rsync \"#{path[:remote]}\" \"#{path[:local]}\" #{rsync_args}")
55
+ end
56
+
57
+ end
@@ -0,0 +1,32 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{rbsync}
5
+ s.version = "0.1.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Kevin Colyar"]
9
+ s.date = %q{2009-01-07}
10
+ s.description = %q{Rsync wrapper to provide easy push and pull from the command line}
11
+ s.email = %q{kevin@colyar.net}
12
+ s.executables = ["pull_from", "push_to"]
13
+ s.extra_rdoc_files = ["bin/pull_from", "bin/push_to", "lib/rbsync.rb", "README.rdoc"]
14
+ s.files = ["bin/pull_from", "bin/push_to", "lib/rbsync.rb", "Manifest", "Rakefile", "README.rdoc", "rbsync.gemspec"]
15
+ s.has_rdoc = true
16
+ s.homepage = %q{}
17
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rbsync", "--main", "README.rdoc"]
18
+ s.require_paths = ["lib"]
19
+ s.rubyforge_project = %q{rbsync}
20
+ s.rubygems_version = %q{1.3.1}
21
+ s.summary = %q{Rsync wrapper to provide easy push and pull from the command line}
22
+
23
+ if s.respond_to? :specification_version then
24
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
25
+ s.specification_version = 2
26
+
27
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
28
+ else
29
+ end
30
+ else
31
+ end
32
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kevincolyar-rbsync
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Kevin Colyar
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-01-07 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Rsync wrapper to provide easy push and pull from the command line
17
+ email: kevin@colyar.net
18
+ executables:
19
+ - pull_from
20
+ - push_to
21
+ extensions: []
22
+
23
+ extra_rdoc_files:
24
+ - bin/pull_from
25
+ - bin/push_to
26
+ - lib/rbsync.rb
27
+ - README.rdoc
28
+ files:
29
+ - bin/pull_from
30
+ - bin/push_to
31
+ - lib/rbsync.rb
32
+ - Manifest
33
+ - Rakefile
34
+ - README.rdoc
35
+ - rbsync.gemspec
36
+ has_rdoc: true
37
+ homepage: ""
38
+ post_install_message:
39
+ rdoc_options:
40
+ - --line-numbers
41
+ - --inline-source
42
+ - --title
43
+ - Rbsync
44
+ - --main
45
+ - README.rdoc
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ version:
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: "1.2"
59
+ version:
60
+ requirements: []
61
+
62
+ rubyforge_project: rbsync
63
+ rubygems_version: 1.2.0
64
+ signing_key:
65
+ specification_version: 2
66
+ summary: Rsync wrapper to provide easy push and pull from the command line
67
+ test_files: []
68
+