sundae 0.9.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/test/test_sundae.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'test/unit' unless defined? $ZENTEST and $ZENTEST
1
+ require 'test/unit'
2
2
 
3
3
  $:.unshift File.join(File.dirname(__FILE__), "..", "bin") # add ../bin to the Ruby library path
4
4
  $:.unshift File.join(File.dirname(__FILE__), "..", "lib") # ../lib
@@ -22,6 +22,7 @@ class TestSundae < Test::Unit::TestCase
22
22
  FileUtils.mkdir_p(File.join(@@mnts_dir, 'c1/d2'))
23
23
  FileUtils.mkdir_p(File.join(@@mnts_dir, 'c2/d1'))
24
24
  FileUtils.mkdir_p(File.join(@@mnts_dir, 'c2/d3'))
25
+ FileUtils.mkdir_p(File.join(@@mnts_dir, 'c2/d3/d31'))
25
26
  File.open(File.join(@@mnts_dir, 'c1/d1/f11'), 'w')
26
27
  File.open(File.join(@@mnts_dir, 'c1/d1/f12'), 'w')
27
28
  File.open(File.join(@@mnts_dir, 'c1/d2/f21'), 'w')
@@ -35,25 +36,16 @@ class TestSundae < Test::Unit::TestCase
35
36
  end
36
37
 
37
38
  @@path1 = File.join(@@sandbox, 'mnts')
38
- @@collection_links = true
39
- @@collection_link_prefix = '_'
40
- @@ignore_rule1 = '\\.svn'
41
39
 
42
40
  @@config_file = File.join(@@sandbox, ".sundae")
43
41
  File.open(@@config_file, 'w+') do |f|
44
- f.puts ":paths:"
45
- f.puts " - #{@@path1}"
46
- f.puts ":collection_links:"
47
- f.puts " #{@@collection_links}"
48
- f.puts ":collection_link_prefix:"
49
- f.puts " #{@@collection_link_prefix}"
50
- f.puts ":ignore_rules:"
51
- f.puts " - #{@@ignore_rule1}"
52
- f.puts " - \\.bzr"
53
- f.puts " - \\.DS_Store"
42
+ f.puts "configatron.paths = [\"#{@@path1}\"]"
43
+ f.puts "configatron.ignore_rules = %w("
44
+ f.puts " .svn"
45
+ f.puts " *.git"
46
+ f.puts " .DS_Store) << /bzr/"
54
47
  end
55
48
  Sundae.load_config_file(@@sandbox)
56
-
57
49
  end
58
50
 
59
51
  def teardown
@@ -75,7 +67,6 @@ class TestSundae < Test::Unit::TestCase
75
67
  FileUtils.ln_s(d1, link)
76
68
  Sundae.combine_directories(link, d1, d2)
77
69
  assert File.symlink?(File.join(link, 'f11'))
78
- assert File.symlink?(File.join(link, '_c1'))
79
70
  end
80
71
 
81
72
  def test_class_create_directory_link
@@ -100,13 +91,13 @@ class TestSundae < Test::Unit::TestCase
100
91
  FileUtils.ln_s(File.join(@@mnts_dir, 'c1/d1/f11'), File.join(@@sandbox, 'new_link2'))
101
92
  Sundae.create_file_link(File.join(@@mnts_dir, 'c1/d1/f11'), File.join(@@sandbox, 'new_link2'))
102
93
  end
103
- assert_raise RuntimeError do
94
+ assert_raise ArgumentError do
104
95
  File.open(File.join(@@sandbox, 'new_link3'), 'w')
105
96
  Sundae.create_file_link(File.join(@@mnts_dir, 'c1/d1/f11'), File.join(@@sandbox, 'new_link3'))
106
97
  end
107
- assert_raise RuntimeError do
108
- FileUtils.ln_s(File.join(@@mnts_dir, 'c1/d1/f12'), File.join(@@sandbox, 'new_link4'))
109
- Sundae.create_file_link(File.join(@@mnts_dir, 'c1/d1/f11'), File.join(@@sandbox, 'new_link4'))
98
+ assert_raise ArgumentError do
99
+ FileUtils.ln_s(File.join(@@mnts_dir, 'd1'), File.join(@@sandbox, 'new_link4'))
100
+ Sundae.create_file_link(File.join(@@mnts_dir, 'd1'), File.join(@@sandbox, 'new_link4'))
110
101
  end
111
102
  assert_raise ArgumentError do
112
103
  Sundae.create_file_link(File.join(@@mnts_dir, 'c1/d1'), File.join(@@sandbox, 'new_link4'))
@@ -117,11 +108,9 @@ class TestSundae < Test::Unit::TestCase
117
108
  Sundae.create_filesystem
118
109
  assert File.symlink?(File.join(@@sandbox, 'f11'))
119
110
  assert File.symlink?(File.join(@@sandbox, 'f31'))
120
- assert File.symlink?(File.join(@@sandbox, '_c1'))
121
111
  end
122
112
 
123
113
  def test_class_find_static_file
124
- assert_equal File.basename(Sundae.find_static_file(@@mnts_dir)), 'f11'
125
114
  10.times do
126
115
  assert_not_nil Sundae.find_static_file(@@mnts_dir)
127
116
  FileUtils.rm(Sundae.find_static_file(@@mnts_dir))
@@ -130,15 +119,18 @@ class TestSundae < Test::Unit::TestCase
130
119
  end
131
120
 
132
121
  def test_class_generated_directories
122
+ Sundae.create_filesystem
133
123
  assert_kind_of Array, Sundae.generated_directories
134
- assert Sundae.generated_directories.include?(File.join(@@sandbox, 'f11'))
135
- assert Sundae.generated_directories.size == 6
124
+ assert !Sundae.generated_directories.include?(File.join(@@sandbox, 'f11'))
125
+ assert_equal 1, Sundae.generated_directories.size
136
126
  end
137
127
 
138
128
  def test_class_ignore_file_eh
139
129
  assert Sundae.ignore_file?('.sundae_path')
140
130
  assert Sundae.ignore_file?('..')
141
- assert Sundae.ignore_file?(@@ignore_rule1)
131
+ assert Sundae.ignore_file?(".svn")
132
+ assert Sundae.ignore_file?("arst.git")
133
+ assert Sundae.ignore_file?(".bzrarst")
142
134
  assert_equal Sundae.ignore_file?('normal_file.txt'), false
143
135
  end
144
136
 
@@ -153,14 +145,7 @@ class TestSundae < Test::Unit::TestCase
153
145
 
154
146
  def test_class_load_config_file
155
147
  sundae_paths = Sundae.instance_variable_get(:@paths)
156
- sundae_ignore_rules = Sundae.instance_variable_get(:@ignore_rules)
157
- sundae_collection_links = Sundae.instance_variable_get(:@collection_links)
158
- sundae_collection_link_prefix = Sundae.instance_variable_get(:@collection_link_prefix)
159
-
160
148
  assert_equal sundae_paths[0], File.expand_path(@@path1)
161
- assert_equal sundae_ignore_rules[0], Regexp.new(@@ignore_rule1)
162
- assert_equal sundae_collection_links, @@collection_links
163
- assert_equal sundae_collection_link_prefix, @@collection_link_prefix
164
149
  end
165
150
 
166
151
  def test_class_minimally_create_links
@@ -208,12 +193,6 @@ class TestSundae < Test::Unit::TestCase
208
193
  end
209
194
  end
210
195
 
211
- def test_class_create_collection_links
212
- c1 = File.join(@@mnts_dir, 'c1')
213
- Sundae.create_collection_links(c1, @@sandbox)
214
- assert File.symlink?(File.join(@@sandbox, '_c1'))
215
- end
216
-
217
196
  def test_class_create_link
218
197
  Sundae.create_link(File.join(@@mnts_dir, 'c1/d1/f11'), File.join(@@sandbox, 'new_link1'))
219
198
  assert File.symlink?(File.join(@@sandbox, 'new_link1'))
data/version.txt ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
metadata CHANGED
@@ -1,84 +1,115 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: sundae
3
- version: !ruby/object:Gem::Version
4
- version: 0.9.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
5
6
  platform: ruby
6
- authors:
7
+ authors:
7
8
  - Don
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
-
12
- date: 2009-04-28 00:00:00 -04:00
13
- default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2012-02-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: highline
16
+ requirement: &70976810 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 1.6.11
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70976810
25
+ - !ruby/object:Gem::Dependency
16
26
  name: configatron
27
+ requirement: &70976460 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 2.9.0
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70976460
36
+ - !ruby/object:Gem::Dependency
37
+ name: rdoc
38
+ requirement: &70976180 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '3.12'
17
44
  type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0"
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: hoe
45
+ prerelease: false
46
+ version_requirements: *70976180
47
+ - !ruby/object:Gem::Dependency
48
+ name: bones
49
+ requirement: &71197350 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 3.7.3
27
55
  type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.12.2
34
- version:
35
- description: Mix collections of files while maintaining complete separation. Synchronize any combination of your documents and configuration settings between all of your computers.
56
+ prerelease: false
57
+ version_requirements: *71197350
58
+ description: Mix collections of files while maintaining complete separation.
36
59
  email: don@ohspite.net
37
- executables:
38
- - sundae
60
+ executables:
61
+ - !binary |-
62
+ c3VuZGFl
39
63
  extensions: []
40
-
41
- extra_rdoc_files:
42
- - Copying.txt
43
- - History.txt
44
- - Manifest.txt
45
- - README.txt
46
- files:
47
- - Copying.txt
48
- - History.txt
49
- - Manifest.txt
50
- - README.txt
51
- - Rakefile
52
- - bin/sundae
53
- - setup.rb
54
- - lib/sundae.rb
55
- - test/test_sundae.rb
56
- has_rdoc: true
57
- homepage: http://rubyforge.org/projects.sundae
64
+ extra_rdoc_files:
65
+ - !binary |-
66
+ UkVBRE1FLnJkb2M=
67
+ - !binary |-
68
+ YmluL3N1bmRhZQ==
69
+ files:
70
+ - !binary |-
71
+ LmdpdGlnbm9yZQ==
72
+ - !binary |-
73
+ Q0hBTkdFTE9H
74
+ - !binary |-
75
+ Q09QWUlORw==
76
+ - !binary |-
77
+ UkVBRE1FLnJkb2M=
78
+ - !binary |-
79
+ UmFrZWZpbGU=
80
+ - !binary |-
81
+ YmluL3N1bmRhZQ==
82
+ - !binary |-
83
+ bGliL3N1bmRhZS5yYg==
84
+ - !binary |-
85
+ dGVzdC90ZXN0X3N1bmRhZS5yYg==
86
+ - !binary |-
87
+ dmVyc2lvbi50eHQ=
88
+ homepage: https://github.com/ohspite/sundae
89
+ licenses: []
58
90
  post_install_message:
59
- rdoc_options:
91
+ rdoc_options:
60
92
  - --main
61
- - README.txt
62
- require_paths:
93
+ - README.rdoc
94
+ require_paths:
63
95
  - lib
64
- required_ruby_version: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: "0"
69
- version:
70
- required_rubygems_version: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: "0"
75
- version:
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ none: false
104
+ requirements:
105
+ - - ! '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
76
108
  requirements: []
77
-
78
109
  rubyforge_project: sundae
79
- rubygems_version: 1.3.1
110
+ rubygems_version: 1.8.15
80
111
  signing_key:
81
- specification_version: 2
112
+ specification_version: 3
82
113
  summary: Mix collections of files while maintaining complete separation.
83
- test_files:
114
+ test_files:
84
115
  - test/test_sundae.rb
data/Manifest.txt DELETED
@@ -1,9 +0,0 @@
1
- Copying.txt
2
- History.txt
3
- Manifest.txt
4
- README.txt
5
- Rakefile
6
- bin/sundae
7
- setup.rb
8
- lib/sundae.rb
9
- test/test_sundae.rb
data/README.txt DELETED
@@ -1,108 +0,0 @@
1
- = Sundae
2
-
3
- == Synopsis
4
-
5
- (Re)generates directories by mixing the file hierarchies contained
6
- in various 'mounted' directories. The generated directories contain
7
- symbolic links to the mounted files. Combined with other tools,
8
- this scheme allows you to create separate collections of files
9
- (work, personal, reference, linux, osx, etc.), choose which of these
10
- you want to mount on each of your computers, and then build a
11
- hierarchy that allows you to work on them side by side.
12
-
13
- == Install
14
-
15
- sudo gem install sundae
16
-
17
- == Usage
18
-
19
- The first time you run Sundae, it will create a template config file
20
- in your home directory. This file, <tt>.sundae</tt>, needs to be
21
- customized. It is in YAML format and defines the following:
22
-
23
- [+paths+]
24
- array; where the collections are stored
25
- [+collection_links+]
26
- +true+ or +false+; if true, links are created in generated
27
- directories to the analogous location in mounted directories
28
- [+collection_link_prefix+]
29
- string; the prefix applied to collection links, if they are to be
30
- created
31
- [+ignore_rules+]
32
- array; each line is a Regexp and becomes a rule that prevents
33
- links to files or directories that match the Regexp
34
-
35
- The hierarchy in <em>path</em> should look something like
36
- this:
37
-
38
- path/
39
- |-- collection1/
40
- | |-- mnt1/
41
- | | |-- real_files_and_dirs
42
- | | ` ...
43
- | |-- mnt2/
44
- `-- collection2/
45
- ` ...
46
-
47
- For example, the hierarchy in my <em>path</em> looks sort of like this:
48
-
49
- ~/mnt/ <-- "path"
50
- |-- osx/ <-- "collection"
51
- | |-- home/ <-- "mnt"
52
- | | |-- .emacs
53
- | | |-- doc/
54
- | | ` ...
55
- | |-- home_library/
56
- | | |-- .sundae_path
57
- | | `-- Library-Keyboard_Layouts/
58
- | | `-- Keyboard Layouts/
59
- | | ` Colemak.keylayout
60
- | ` ...
61
- |-- personal
62
- | `-- home/
63
- | |-- doc/
64
- | | ` ...
65
- | ` ...
66
- ` ...
67
-
68
- Sundae will act on all of the <em>mnt</em>s--subdirectories of the
69
- <em>collection</em>s, that is, the sub-subdirectories of the
70
- <em>path</em>. The "collections" are only there to facilitate
71
- grouping common files and syncronizing them between computers.
72
-
73
- By default, all of the contents in each of the <em>mnt</em>s are
74
- placed in the user's home directory. This can be altered by
75
- creating a file called <tt>.sundae_path</tt> in the top of the
76
- <em>mnt</em>; the file should contain one line, which is the
77
- absolute path to where that directory should be "mounted."
78
-
79
- And that's it. When called, Sundae creates links so that you can
80
- work on your files from seperate parts of life as if they were side
81
- by side.
82
-
83
- == Author
84
- <don@ohspite.net>
85
-
86
- == Copyright
87
- Copyright (c) 2008 <don@ohspite.net>.
88
- Licensed under the MIT License.
89
-
90
- Permission is hereby granted, free of charge, to any person obtaining
91
- a copy of this software and associated documentation files (the
92
- 'Software'), to deal in the Software without restriction, including
93
- without limitation the rights to use, copy, modify, merge, publish,
94
- distribute, sublicense, and/or sell copies of the Software, and to
95
- permit persons to whom the Software is furnished to do so, subject to
96
- the following conditions:
97
-
98
- The above copyright notice and this permission notice shall be
99
- included in all copies or substantial portions of the Software.
100
-
101
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
102
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
103
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
104
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
105
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
106
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
107
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
108
-