disloku 0.2.0 → 0.4.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.
- checksums.yaml +4 -4
- data/lib/disloku/BaseCommand.rb +79 -0
- data/lib/disloku/ChangeSet.rb +13 -1
- data/lib/disloku/CliAdapter.rb +36 -0
- data/lib/disloku/Constants.rb +4 -0
- data/lib/disloku/FileChange.rb +7 -2
- data/lib/disloku/Log.rb +39 -12
- data/lib/disloku/Repository.rb +10 -1
- data/lib/disloku/SysCmd.rb +2 -2
- data/lib/disloku/commands/Build.rb +30 -0
- data/lib/disloku/commands/Config.rb +17 -0
- data/lib/disloku/commands/Deploy.rb +38 -0
- data/lib/disloku/config/Connection.rb +34 -0
- data/lib/disloku/config/ConnectionStore.rb +19 -0
- data/lib/disloku/config/Mapping.rb +84 -0
- data/lib/disloku/config/MappingStore.rb +19 -0
- data/lib/disloku/config/NamedConfigStore.rb +41 -0
- data/lib/disloku/config/Options.rb +51 -0
- data/lib/disloku/config/Target.rb +37 -0
- data/lib/disloku/config/YamlConfig.rb +54 -0
- data/lib/disloku/git/ChangeSetProvider.rb +19 -6
- data/lib/disloku/git/Repository.rb +16 -2
- data/lib/disloku/svn/ChangeSetProvider.rb +44 -41
- data/lib/disloku/svn/Repository.rb +24 -21
- data/lib/disloku/tasks/FolderTask.rb +5 -5
- data/lib/disloku/tasks/NetSftpTask.rb +39 -29
- data/lib/disloku/util/File.rb +9 -3
- data/lib/disloku.rb +24 -10
- metadata +20 -15
- data/lib/disloku/Commit.rb +0 -7
- data/lib/disloku/Config.rb +0 -52
- data/lib/disloku/Connection.rb +0 -31
- data/lib/disloku/ConnectionStore.rb +0 -16
- data/lib/disloku/Disloku.rb +0 -103
- data/lib/disloku/Mapping.rb +0 -81
- data/lib/disloku/MappingStore.rb +0 -16
- data/lib/disloku/NamedConfigStore.rb +0 -39
- data/lib/disloku/Options.rb +0 -46
- data/lib/disloku/Target.rb +0 -35
- data/lib/disloku/tasks/PsFtpTask.rb +0 -58
@@ -0,0 +1,54 @@
|
|
1
|
+
require('yaml')
|
2
|
+
|
3
|
+
module Disloku
|
4
|
+
module Config
|
5
|
+
|
6
|
+
class YamlConfig
|
7
|
+
attr_accessor :yaml
|
8
|
+
|
9
|
+
def initialize(config, isFile = true)
|
10
|
+
if (isFile)
|
11
|
+
@yaml = YAML.load_file(config)
|
12
|
+
else
|
13
|
+
@yaml = config
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def merge(base)
|
18
|
+
@yaml = base.yaml.recursive_merge(@yaml)
|
19
|
+
end
|
20
|
+
|
21
|
+
def has?(key)
|
22
|
+
return self[key] != nil
|
23
|
+
end
|
24
|
+
|
25
|
+
def get(keys)
|
26
|
+
if (keys.empty?())
|
27
|
+
return self
|
28
|
+
end
|
29
|
+
current = keys.shift()
|
30
|
+
return @yaml.has_key?(current) ? YamlConfig.new(@yaml[current], false).get(keys) : nil
|
31
|
+
end
|
32
|
+
|
33
|
+
def [](key)
|
34
|
+
return self.get(key.split('.'))
|
35
|
+
end
|
36
|
+
|
37
|
+
def value()
|
38
|
+
if (@yaml.kind_of?(Array))
|
39
|
+
return @yaml.map() { |item| YamlConfig.new(item, false) }
|
40
|
+
end
|
41
|
+
return @yaml
|
42
|
+
end
|
43
|
+
|
44
|
+
def to_s()
|
45
|
+
return value().to_s()
|
46
|
+
end
|
47
|
+
|
48
|
+
def to_yaml()
|
49
|
+
return @yaml.to_yaml()
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
@@ -25,16 +25,29 @@ module Disloku
|
|
25
25
|
from = "HEAD"
|
26
26
|
end
|
27
27
|
|
28
|
+
dirtyPaths = {}
|
29
|
+
status = SysCmd.new("git status --untracked-files=no --porcelain #{repository.root}").execute()
|
30
|
+
status.output.each_line() do |line|
|
31
|
+
match = /^(.)(.)\s+"([^"]+)"/.match(line) || /^(.)(.)\s+([^ \n\r]+)/.match(line)
|
32
|
+
dirtyPaths[match[3]] = true
|
33
|
+
end
|
34
|
+
|
35
|
+
result = ChangeSet.new(@repository.getHashOfRefspec(from), to || @repository.getHashOfRefspec("HEAD"))
|
36
|
+
|
28
37
|
if (to == nil)
|
29
|
-
|
38
|
+
diff = SysCmd.new("git diff --name-status --staged #{from} #{repository.root}").execute()
|
30
39
|
else
|
31
|
-
|
40
|
+
diff = SysCmd.new("git diff --name-status #{from} #{to} #{repository.root}").execute()
|
32
41
|
end
|
33
42
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
43
|
+
Log.instance.scope([:default, :logfile]) do
|
44
|
+
diff.output.each_line() do |line|
|
45
|
+
match = /^(.)\s+(.*)$/.match(line)
|
46
|
+
dirty = dirtyPaths.has_key?(match[2])
|
47
|
+
change = FileChange.new(repository, match[2], getChangeType(match[1]), dirty)
|
48
|
+
Log.instance.info(change.to_s())
|
49
|
+
result << change
|
50
|
+
end
|
38
51
|
end
|
39
52
|
|
40
53
|
return [result]
|
@@ -19,8 +19,22 @@ module Disloku
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def getBranchName()
|
22
|
-
|
23
|
-
|
22
|
+
return @branch || begin
|
23
|
+
branch = SysCmd.new("git --git-dir=\"#{@gitDir}\" rev-parse --abbrev-ref HEAD").execute()
|
24
|
+
@branch = branch.output.strip()
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def getHashOfRefspec(refspec)
|
29
|
+
hash = SysCmd.new("git --git-dir=\"#{@gitDir}\" rev-parse #{refspec}").execute()
|
30
|
+
return hash.output.strip()
|
31
|
+
end
|
32
|
+
|
33
|
+
def getHeadHash()
|
34
|
+
return @headHash || begin
|
35
|
+
headHash = SysCmd.new("git --git-dir=\"#{@gitDir}\" rev-parse HEAD").execute()
|
36
|
+
@headHash = branch.output.strip()
|
37
|
+
end
|
24
38
|
end
|
25
39
|
|
26
40
|
def getProvider()
|
@@ -1,41 +1,44 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
require_relative('../
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
1
|
+
|
2
|
+
# TODO: start from scratch for SVN repository provider
|
3
|
+
|
4
|
+
# require_relative('../ChangeSetProvider');
|
5
|
+
# require_relative('../ChangeSet');
|
6
|
+
# require_relative('../FileChange');
|
7
|
+
# require_relative('../SysCmd');
|
8
|
+
|
9
|
+
# module Disloku
|
10
|
+
# module Svn
|
11
|
+
|
12
|
+
# CHANGE_MAP = {
|
13
|
+
# ' ' => :nochange,
|
14
|
+
# 'A' => :added,
|
15
|
+
# 'C' => :conflicted,
|
16
|
+
# 'D' => :deleted,
|
17
|
+
# 'I' => :ignored,
|
18
|
+
# 'M' => :modified,
|
19
|
+
# 'R' => :replaced,
|
20
|
+
# 'X' => :external,
|
21
|
+
# '?' => :unversioned,
|
22
|
+
# '!' => :missing,
|
23
|
+
# '~' => :obstructed,
|
24
|
+
# }
|
25
|
+
|
26
|
+
# class ChangeSetProvider < Disloku::ChangeSetProvider
|
27
|
+
# def getChangeSets(from, to)
|
28
|
+
# status = SysCmd.new("svn status #{repository.root}").execute()
|
29
|
+
|
30
|
+
# result = ChangeSet.new()
|
31
|
+
# status.output.each_line do |line|
|
32
|
+
# match = /^(.)......\s+(.*)$/.match(line)
|
33
|
+
# result << FileChange.new(repository, match[2], getChangeType(match[1]))
|
34
|
+
# end
|
35
|
+
|
36
|
+
# return [result]
|
37
|
+
# end
|
38
|
+
|
39
|
+
# def getChangeType(changeChar)
|
40
|
+
# return CHANGE_MAP[changeChar]
|
41
|
+
# end
|
42
|
+
# end
|
43
|
+
# end
|
44
|
+
# end
|
@@ -1,22 +1,25 @@
|
|
1
|
-
require_relative('../Repository')
|
2
|
-
require_relative('ChangeSetProvider')
|
3
1
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
2
|
+
# TODO: start from scratch for SVN repository provider
|
3
|
+
|
4
|
+
# require_relative('../Repository')
|
5
|
+
# require_relative('ChangeSetProvider')
|
6
|
+
|
7
|
+
# module Disloku
|
8
|
+
# module Svn
|
9
|
+
# class Repository < Disloku::Repository
|
10
|
+
# def initialize(location)
|
11
|
+
# super(location)
|
12
|
+
# end
|
13
|
+
|
14
|
+
# def getRepositoryRoot()
|
15
|
+
# info = %x[svn info --xml #{location}]
|
16
|
+
# m = /<wcroot-abspath>(.*)<\/wcroot-abspath>/.match(info)
|
17
|
+
# return m[1]
|
18
|
+
# end
|
19
|
+
|
20
|
+
# def getProvider()
|
21
|
+
# return ChangeSetProvider.new(self)
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
# end
|
25
|
+
# end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require_relative('../Log')
|
2
2
|
require_relative('../BaseTask')
|
3
|
-
require_relative('../
|
3
|
+
require_relative('../config/Options')
|
4
|
+
require_relative('../config/Target')
|
4
5
|
require('fileutils')
|
5
6
|
require('stringio')
|
6
7
|
|
@@ -10,10 +11,9 @@ module Disloku
|
|
10
11
|
|
11
12
|
def initialize(input)
|
12
13
|
super()
|
13
|
-
@options = getInputParam(input, :options, Options)
|
14
|
+
@options = getInputParam(input, :options, Config::Options)
|
14
15
|
@changesets = getInputParam(input, :changesets, Array)
|
15
|
-
@target = getInputParam(input, :target, Target)
|
16
|
-
@allowOverride = getInputParam(input, :allowOverride, Object)
|
16
|
+
@target = getInputParam(input, :target, Config::Target)
|
17
17
|
@deletes = StringIO.new()
|
18
18
|
|
19
19
|
@targetDirectory = File.join(@options.packageDir, @target.name)
|
@@ -22,7 +22,7 @@ module Disloku
|
|
22
22
|
def beforeExecute()
|
23
23
|
if (!Dir.exists?(@targetDirectory))
|
24
24
|
FileUtils.mkpath(@targetDirectory)
|
25
|
-
elsif (Dir.exists?(@targetDirectory) and !@allowOverride)
|
25
|
+
elsif (Dir.exists?(@targetDirectory) and !@options.allowOverride)
|
26
26
|
raise Exception.new("Directory '#{@targetDirectory}' already exists")
|
27
27
|
elsif (Dir.exists?(@targetDirectory))
|
28
28
|
FileUtils.rm_r(@targetDirectory, :force => true)
|
@@ -1,7 +1,10 @@
|
|
1
1
|
require_relative('../DislokuError')
|
2
2
|
require_relative('../Log')
|
3
3
|
require_relative('../BaseTask')
|
4
|
+
require_relative('../CliAdapter')
|
4
5
|
require_relative('../SessionManager')
|
6
|
+
require_relative('../config/Options')
|
7
|
+
require_relative('../config/Target')
|
5
8
|
|
6
9
|
module Net; module SFTP; module Operations
|
7
10
|
class Upload
|
@@ -26,11 +29,11 @@ module Disloku
|
|
26
29
|
|
27
30
|
def initialize(input)
|
28
31
|
super()
|
29
|
-
@repository = getInputParam(input, :repository, Repository)
|
30
|
-
@options = getInputParam(input, :options, Options)
|
32
|
+
@repository = getInputParam(input, :repository, Disloku::Repository)
|
33
|
+
@options = getInputParam(input, :options, Config::Options)
|
31
34
|
@directory = getInputParam(input, :directory, String)
|
32
35
|
@files = getInputParam(input, :files, Array)
|
33
|
-
@target = getInputParam(input, :target, Target)
|
36
|
+
@target = getInputParam(input, :target, Config::Target)
|
34
37
|
end
|
35
38
|
|
36
39
|
def beforeExecute()
|
@@ -46,46 +49,53 @@ module Disloku
|
|
46
49
|
@files.each() do |file|
|
47
50
|
puts(file)
|
48
51
|
end
|
49
|
-
|
50
|
-
|
51
|
-
response = STDIN.readline().chomp()
|
52
|
-
@skip = response.match(/^[Yy]/) == nil
|
53
|
-
puts("skipping: #{@skip}")
|
52
|
+
|
53
|
+
@skip = !CliAdapter.queryYesNo("Continue with deployment?")
|
54
54
|
end
|
55
55
|
|
56
56
|
def executeTask()
|
57
57
|
if (@skip)
|
58
58
|
return
|
59
59
|
end
|
60
|
+
CliAdapter.puts("Doploying target [#{@target.name}]")
|
61
|
+
|
62
|
+
Log.instance.scope([:default, :logfile]) do
|
63
|
+
|
64
|
+
SessionManager.instance.get(@target.connection) do |sftp|
|
65
|
+
Log.instance.info("connection with [#{@target.name}] established")
|
60
66
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
67
|
+
sftp.upload!(@directory, @target.targetDir, { :ignoreMkdirError => true }) do |event, uploader, *args|
|
68
|
+
case event
|
69
|
+
when :open then
|
70
|
+
# args[0] : file metadata
|
71
|
+
# "starting upload: #{args[0].local} -> #{args[0].remote} (#{args[0].size} bytes}"
|
72
|
+
CliAdapter.print(".")
|
73
|
+
Log.instance.info("#{args[0].local} -> #{args[0].remote} (#{args[0].size} bytes)")
|
74
|
+
end
|
69
75
|
end
|
70
|
-
|
71
|
-
puts()
|
76
|
+
CliAdapter.puts()
|
72
77
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
78
|
+
@files.each() do |file|
|
79
|
+
if (file.change.changeType == :deleted)
|
80
|
+
path = file.getAbsoluteDstPath()
|
81
|
+
Log.instance.info("deleting file #{path}")
|
82
|
+
begin
|
83
|
+
sftp.remove!(path)
|
84
|
+
CliAdapter.print("x")
|
85
|
+
rescue
|
86
|
+
if (!@options.ignoreDeleteErrors)
|
87
|
+
Log.instance.fatal("unable to delete file #{path} - failing")
|
88
|
+
raise
|
89
|
+
else
|
90
|
+
Log.instance.warn("unable to delete file #{path} (it probably doesn't exist)")
|
91
|
+
end
|
84
92
|
end
|
85
93
|
end
|
86
94
|
end
|
87
95
|
end
|
96
|
+
|
88
97
|
end
|
98
|
+
|
89
99
|
end
|
90
100
|
|
91
101
|
def afterExecute()
|
data/lib/disloku/util/File.rb
CHANGED
@@ -4,6 +4,11 @@ module Disloku
|
|
4
4
|
SPLIT_EXP = "\\#{File::SEPARATOR}|\\#{File::ALT_SEPARATOR}"
|
5
5
|
|
6
6
|
class File
|
7
|
+
|
8
|
+
def self.getSegments(path)
|
9
|
+
return path.split(/#{SPLIT_EXP}/)
|
10
|
+
end
|
11
|
+
|
7
12
|
attr_accessor :srcPath, :change
|
8
13
|
|
9
14
|
def initialize(filePath, basePath, target, change)
|
@@ -11,8 +16,8 @@ module Disloku
|
|
11
16
|
@target = target
|
12
17
|
@change = change
|
13
18
|
|
14
|
-
fileSegments =
|
15
|
-
baseSegments =
|
19
|
+
fileSegments = File.getSegments(filePath)
|
20
|
+
baseSegments = File.getSegments(basePath)
|
16
21
|
index = 0
|
17
22
|
while (fileSegments[index] == baseSegments[index])
|
18
23
|
index += 1
|
@@ -40,7 +45,8 @@ module Disloku
|
|
40
45
|
end
|
41
46
|
|
42
47
|
def to_s()
|
43
|
-
|
48
|
+
operation = (@change.changeType == :deleted ? "x>" : "->")
|
49
|
+
return "#{srcPath} #{operation} #{getAbsoluteDstPath()}"
|
44
50
|
end
|
45
51
|
end
|
46
52
|
end
|
data/lib/disloku.rb
CHANGED
@@ -1,32 +1,46 @@
|
|
1
|
-
require_relative('disloku/
|
1
|
+
require_relative('disloku/Constants')
|
2
|
+
require_relative('disloku/commands/Config')
|
3
|
+
require_relative('disloku/commands/Build')
|
4
|
+
require_relative('disloku/commands/Deploy')
|
2
5
|
require_relative('disloku/SysCmd')
|
3
6
|
require_relative('disloku/SessionManager')
|
4
7
|
require('thor')
|
5
8
|
|
6
9
|
class DislokuCli < Thor
|
10
|
+
class_option :verbose, :aliases => "-v", :type => :boolean, :desc => "verbose output"
|
11
|
+
class_option :debug, :aliases => "-d", :type => :boolean, :desc => "debug output"
|
12
|
+
class_option :scm, :aliases => "-s", :type => :string, :desc => "source control adapter to use (git) - defaults to git"
|
13
|
+
|
7
14
|
desc "deploy [FROM] [TO]", "deploy changes"
|
8
15
|
method_option :dir, :default => ".", :aliases => "-d", :desc => "repository directory"
|
9
16
|
method_option :target, :aliases => "-t", :desc => "target"
|
17
|
+
method_option :packageDir, :aliases => "-p", :desc => "directory in which the deployment package will be created (a temp folder is created if this option is omitted)"
|
18
|
+
method_option :ignoreDeleteErrors, :aliases => "--ignore-delete-errors", :type => :boolean, :desc => "ignore remote delete errors"
|
10
19
|
def deploy(from = nil, to = nil)
|
11
|
-
|
12
|
-
|
13
|
-
disloku = Disloku::Disloku.new(options)
|
14
|
-
disloku.deployPackage(from, to)
|
20
|
+
cmd = Disloku::Commands::Deploy.new(options)
|
21
|
+
cmd.execute(from, to)
|
15
22
|
end
|
16
23
|
|
17
24
|
desc "build [FROM] [TO]", "build change package"
|
18
25
|
method_option :dir, :default => ".", :aliases => "-d", :desc => "repository directory"
|
19
26
|
method_option :target, :aliases => "-t", :desc => "target"
|
27
|
+
method_option :packageDir, :default => "~/disloku", :aliases => "-p", :desc => "directory in which the deployment package will be created (~/disloku if this option is omitted)"
|
28
|
+
method_option :allowOverride, :aliases => "-f", :type => :boolean, :desc => "overwrites existing deployment packages in packageDir"
|
29
|
+
method_option :createDeletesFile, :aliases => "--create-deletes-file", :type => :boolean, :desc => "creates a .deletes file containing a list of deleted files"
|
20
30
|
def build(from = nil, to = nil)
|
21
|
-
|
22
|
-
|
23
|
-
dir = disloku.buildPackage(from, to)
|
31
|
+
cmd = Disloku::Commands::Build.new(options)
|
32
|
+
cmd.execute(from, to)
|
24
33
|
end
|
25
34
|
|
26
35
|
desc "config", "show configuration"
|
27
36
|
method_option :dir, :default => ".", :aliases => "-d", :desc => "repository directory"
|
28
37
|
def config()
|
29
|
-
|
30
|
-
|
38
|
+
cmd = Disloku::Commands::Config.new(options)
|
39
|
+
cmd.execute()
|
40
|
+
end
|
41
|
+
|
42
|
+
desc "version", "show version"
|
43
|
+
def version()
|
44
|
+
puts(Disloku::VERSION)
|
31
45
|
end
|
32
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: disloku
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukas Angerer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -66,40 +66,45 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 2.14.1
|
69
|
-
description: A deployment tool that allows copying of Git changesets via sftp
|
70
|
-
|
69
|
+
description: A deployment tool that allows copying of Git changesets via sftp (version
|
70
|
+
0.4.0 [e5344aa1bb])
|
71
|
+
email:
|
72
|
+
- executor.dev@gmail.com
|
71
73
|
executables:
|
72
74
|
- disloku
|
73
75
|
extensions: []
|
74
76
|
extra_rdoc_files: []
|
75
77
|
files:
|
78
|
+
- lib/disloku/BaseCommand.rb
|
76
79
|
- lib/disloku/BaseTask.rb
|
77
80
|
- lib/disloku/ChangeSet.rb
|
78
81
|
- lib/disloku/ChangeSetProvider.rb
|
79
|
-
- lib/disloku/
|
80
|
-
- lib/disloku/
|
81
|
-
- lib/disloku/
|
82
|
-
- lib/disloku/
|
83
|
-
- lib/disloku/
|
82
|
+
- lib/disloku/CliAdapter.rb
|
83
|
+
- lib/disloku/commands/Build.rb
|
84
|
+
- lib/disloku/commands/Config.rb
|
85
|
+
- lib/disloku/commands/Deploy.rb
|
86
|
+
- lib/disloku/config/Connection.rb
|
87
|
+
- lib/disloku/config/ConnectionStore.rb
|
88
|
+
- lib/disloku/config/Mapping.rb
|
89
|
+
- lib/disloku/config/MappingStore.rb
|
90
|
+
- lib/disloku/config/NamedConfigStore.rb
|
91
|
+
- lib/disloku/config/Options.rb
|
92
|
+
- lib/disloku/config/Target.rb
|
93
|
+
- lib/disloku/config/YamlConfig.rb
|
94
|
+
- lib/disloku/Constants.rb
|
84
95
|
- lib/disloku/DislokuError.rb
|
85
96
|
- lib/disloku/FileChange.rb
|
86
97
|
- lib/disloku/git/ChangeSetProvider.rb
|
87
98
|
- lib/disloku/git/Repository.rb
|
88
99
|
- lib/disloku/Log.rb
|
89
|
-
- lib/disloku/Mapping.rb
|
90
|
-
- lib/disloku/MappingStore.rb
|
91
|
-
- lib/disloku/NamedConfigStore.rb
|
92
|
-
- lib/disloku/Options.rb
|
93
100
|
- lib/disloku/Repository.rb
|
94
101
|
- lib/disloku/SessionManager.rb
|
95
102
|
- lib/disloku/svn/ChangeSetProvider.rb
|
96
103
|
- lib/disloku/svn/Repository.rb
|
97
104
|
- lib/disloku/SysCmd.rb
|
98
105
|
- lib/disloku/SysCmdResult.rb
|
99
|
-
- lib/disloku/Target.rb
|
100
106
|
- lib/disloku/tasks/FolderTask.rb
|
101
107
|
- lib/disloku/tasks/NetSftpTask.rb
|
102
|
-
- lib/disloku/tasks/PsFtpTask.rb
|
103
108
|
- lib/disloku/util/File.rb
|
104
109
|
- lib/disloku/util/Hash.rb
|
105
110
|
- lib/disloku/util/Kernel.rb
|
data/lib/disloku/Commit.rb
DELETED
data/lib/disloku/Config.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
require('yaml')
|
2
|
-
require_relative('util/Hash')
|
3
|
-
|
4
|
-
module Disloku
|
5
|
-
class Config
|
6
|
-
attr_accessor :yaml
|
7
|
-
|
8
|
-
def initialize(config, isFile = true)
|
9
|
-
if (isFile)
|
10
|
-
@yaml = YAML.load_file(config)
|
11
|
-
else
|
12
|
-
@yaml = config
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def merge(base)
|
17
|
-
@yaml = base.yaml.recursive_merge(@yaml)
|
18
|
-
end
|
19
|
-
|
20
|
-
def has?(key)
|
21
|
-
return self[key] != nil
|
22
|
-
end
|
23
|
-
|
24
|
-
def get(keys)
|
25
|
-
if (keys.empty?())
|
26
|
-
return self
|
27
|
-
end
|
28
|
-
current = keys.shift()
|
29
|
-
return @yaml.has_key?(current) ? Config.new(@yaml[current], false).get(keys) : nil
|
30
|
-
end
|
31
|
-
|
32
|
-
def [](key)
|
33
|
-
return self.get(key.split('.'))
|
34
|
-
end
|
35
|
-
|
36
|
-
def value()
|
37
|
-
if (@yaml.kind_of?(Array))
|
38
|
-
return @yaml.map() { |item| Config.new(item, false) }
|
39
|
-
end
|
40
|
-
return @yaml
|
41
|
-
end
|
42
|
-
|
43
|
-
def to_s()
|
44
|
-
return value().to_s()
|
45
|
-
end
|
46
|
-
|
47
|
-
def to_yaml()
|
48
|
-
return @yaml.to_yaml()
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
end
|
data/lib/disloku/Connection.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
require('net/sftp')
|
2
|
-
require('digest/sha1')
|
3
|
-
|
4
|
-
module Disloku
|
5
|
-
class Connection
|
6
|
-
attr_accessor :hash, :host, :user, :options
|
7
|
-
|
8
|
-
def initialize(config)
|
9
|
-
@host = config["host"].value()
|
10
|
-
@user = config["user"].value() if !config["user"].nil?
|
11
|
-
@options = {}
|
12
|
-
addOption(config, :password)
|
13
|
-
addOption(config, :port)
|
14
|
-
addOption(config, :keys, true)
|
15
|
-
|
16
|
-
@hash = Digest::SHA1.hexdigest([@host, @user, @options].join())
|
17
|
-
end
|
18
|
-
|
19
|
-
def addOption(config, key, unwrap = false)
|
20
|
-
value = config[key.to_s()]
|
21
|
-
if (!value.nil?)
|
22
|
-
if (unwrap)
|
23
|
-
@options[key] = value.value().map() { |e| e.value() }
|
24
|
-
else
|
25
|
-
@options[key] = value.value()
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require_relative('NamedConfigStore')
|
2
|
-
require_relative('Connection')
|
3
|
-
|
4
|
-
module Disloku
|
5
|
-
class ConnectionStore < NamedConfigStore
|
6
|
-
|
7
|
-
def initialize(config = nil)
|
8
|
-
super(config)
|
9
|
-
end
|
10
|
-
|
11
|
-
def transformConfig(configObject)
|
12
|
-
return Connection.new(configObject)
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|