kate-get 0.1.0 → 0.1.1

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 +18 -7
  2. data/lib/kate-get.rb +5 -3
  3. metadata +2 -2
data/README CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  Kate-Get takes a space separated list of file paths and checks each one against a list of sources. If a match is found, the file is copied via rsync to a local directory. Options for each source are controlled by a config file. Subdirectories are handled automatically based on how local and remote root paths are set.
4
4
 
5
+ == Usage
6
+
7
+ First, make a config file for kate-get (see the next section) and then call it with
8
+
9
+ kate-get "file_1 file_2 file_3"
10
+
11
+ The quoted argument is a space separated string of full file paths. Each file will be checked against the list of sources until it matches one, then the file will be copied into the corresponding subdirectory of the root directory for that source.
12
+
5
13
  == Making a config file
6
14
 
7
15
  By default, Kate-Get looks for the YAML file
@@ -42,16 +50,17 @@ There are two sections
42
50
 
43
51
  Note that the string ##source_name## will be automatically replaced by the source name.
44
52
 
45
- == Limitations
46
-
47
- * Currently, only rsync over ssh is supported.
48
- * An input file path matches a source if the input file path contains the source name.
49
- * This can cause unexpected behavior if the input file name includes two strings which match two different source names.
53
+ In this example config, there are two sources named foo.com and bar.com. Here, bar.com has been configured to use different connection info. If a file path starts with the base of one of these sources, it will be copied to the corresponding subdirectory of the root directory for that source. For example, if file_1 was
54
+ sftp://user@foo.com:22/var/www/vhosts/foo.com/htdocs/css/style.css
55
+ rsync would copy the remote file from example.com
56
+ /var/www/vhosts/foo.com/htdocs/css/style.css
57
+ to the local file
58
+ ~/Development/foo/css/style.css
59
+ This configuration uses a base which is the form Kate uses when accessing a file over sftp.
50
60
 
51
61
  == Setting up Kate to use Kate-Get
52
62
 
53
- Kate-Get is meant to be used with Kate (http://kate-editor.org/) as an external tool. For information on adding external tools to Kate see http://docs.kde.org/stable/en/kdesdk/kate/config-dialog.html.
54
-
63
+ Kate-Get is meant to be used with Kate (http://kate-editor.org) as an external tool. For information on adding external tools to Kate see http://docs.kde.org/stable/en/kdesdk/kate/config-dialog.html.
55
64
 
56
65
  If you want a tool that only copies the currently open file use
57
66
 
@@ -65,6 +74,8 @@ Note that you may need to use the full path to the kate-get binary, usually
65
74
 
66
75
  /var/lib/gems/1.9.1/bin/kate-get
67
76
 
77
+ The example confiuration given above
78
+
68
79
  == Installation
69
80
 
70
81
  === Gem Installation
data/lib/kate-get.rb CHANGED
@@ -15,10 +15,12 @@ class KateGet
15
15
 
16
16
  fail "Failed to load config." unless @config.is_a? Hash
17
17
 
18
+ #update
19
+
18
20
  end
19
21
 
20
- # Files to get
21
- # @param [String] files space seperated list of file paths
22
+ # Addes a file to the array of files to be copied.
23
+ # @param [String] file path to file
22
24
  def add_file file
23
25
  @files = [] unless @files
24
26
  @files << file
@@ -32,7 +34,7 @@ class KateGet
32
34
  # Look for the first source that matches the file.
33
35
  site, name = nil
34
36
  @config[:sources].each do |n, s|
35
- name, site = [n, s] if f[n]
37
+ name, site = [n, s] if f[/^#{s[:base].sub "##source_name##", n}/ ]
36
38
  break if site
37
39
  end
38
40
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Evan Boyd Sosenko