xamplr 1.9.0 → 1.9.1
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.
- data/README.md +16 -8
- data/VERSION.yml +1 -1
- data/lib/xamplr/TODO +21 -1
- data/lib/xamplr/TYPES.txt +150 -0
- data/lib/xamplr/from-xml.rb +11 -10
- data/lib/xamplr/persistence.rb +11 -19
- data/lib/xamplr/persister.rb +10 -11
- data/lib/xamplr/persisters/caching.rb +10 -10
- data/lib/xamplr/persisters/filesystem.rb +0 -8
- data/lib/xamplr/persisters/tokyo-cabinet.rb +11 -18
- data/lib/xamplr/xampl-object.rb +23 -19
- data/regression/.gitignore +1 -0
- data/regression/parsing-namespaced-xml/Makefile +5 -0
- data/regression/parsing-namespaced-xml/README +3 -0
- data/regression/parsing-namespaced-xml/project-generator.rb +30 -0
- data/regression/parsing-namespaced-xml/simple.rb +20 -0
- data/regression/parsing-namespaced-xml/xml/simple.xml +3 -0
- data/xamplr.gemspec +9 -5
- metadata +9 -5
- data/lib/xamplr/persistence.rb.more_thread_safe +0 -771
- data/lib/xamplr/persistence.rb.partially_thread_safe +0 -763
- data/lib/xamplr/version.rb +0 -67
data/lib/xamplr/version.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
module Xampl
|
2
|
-
class Version
|
3
|
-
@@version_limit = 5
|
4
|
-
|
5
|
-
def initialize(repo_name, repo_root)
|
6
|
-
@invalid = true
|
7
|
-
throw :refuse_to_version unless repo_name
|
8
|
-
|
9
|
-
repo_name.gsub!(/^[\.\/]*/, '')
|
10
|
-
repo_name.gsub!(/\/.*/, '')
|
11
|
-
throw :refuse_to_version unless repo_name
|
12
|
-
|
13
|
-
@repo_root = repo_root
|
14
|
-
@repo_root << '/' unless '/'[-1] == @repo_root[-1]
|
15
|
-
|
16
|
-
@repo_path = "#{@repo_root}#{repo_name}"
|
17
|
-
@repo_name = repo_name
|
18
|
-
|
19
|
-
throw :refuse_to_version if @repo_path == @repo_root
|
20
|
-
throw :refuse_to_version unless File.directory?(@repo_path)
|
21
|
-
|
22
|
-
@invalid = false
|
23
|
-
end
|
24
|
-
|
25
|
-
def make(version_stream, description=nil)
|
26
|
-
throw :refuse_to_version if @invalid
|
27
|
-
|
28
|
-
existing_versions = Dir.glob("#{@repo_root}/#{@repo_name}_#{version_stream}*")
|
29
|
-
|
30
|
-
if 0 == existing_versions.size then
|
31
|
-
make_first_version(version_stream, existing_versions, description)
|
32
|
-
else
|
33
|
-
make_new_version(version_stream, existing_versions, description)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def make_first_version(version_stream, existing_versions, description)
|
38
|
-
cmd = "cd '#{@repo_root}'; rsync -a --delete '#{@repo_name}/' '#{@repo_name}_#{version_stream}.0/'"
|
39
|
-
# puts "first version: #{cmd}"
|
40
|
-
system(cmd)
|
41
|
-
end
|
42
|
-
|
43
|
-
def make_new_version(version_stream, existing_versions, description)
|
44
|
-
|
45
|
-
existing_versions.reverse!
|
46
|
-
cmd = []
|
47
|
-
eliminate = []
|
48
|
-
existing_versions.each_with_index do | version, i |
|
49
|
-
pushed_name = "#{@repo_name}_#{version_stream}.#{i + 1}"
|
50
|
-
cmd << "mv '#{@repo_name}_#{version_stream}.#{i}' '#{pushed_name}'"
|
51
|
-
eliminate << pushed_name unless i < @@version_limit
|
52
|
-
end
|
53
|
-
cmd << "cd '#{@repo_root}'"
|
54
|
-
cmd = cmd.reverse
|
55
|
-
cmd << "rsync -a --delete --checksum --link-dest='../#{@repo_name}_#{version_stream}.1' '#{@repo_name}/' '#{@repo_name}_#{version_stream}.0/'"
|
56
|
-
cmd << "touch '#{@repo_name}_#{version_stream}.0'"
|
57
|
-
|
58
|
-
eliminate.each do | name |
|
59
|
-
cmd << "rm -rf '#{name}'"
|
60
|
-
end
|
61
|
-
|
62
|
-
cmd = cmd.join("; ")
|
63
|
-
# puts "new version: #{cmd}"
|
64
|
-
system(cmd)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|