rbbt-image 0.1.14 → 0.1.16

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 333ed8343fe35a750c1b7c35245987b6c0ba2d27
4
- data.tar.gz: 7d44691b0cf8ec502e38d4eaadf021521b3d0d52
3
+ metadata.gz: d807a8cb86f34b8de5d2da2ace7f1c22d2790d37
4
+ data.tar.gz: 88982fb26b4b6c3f4f285f420caf9565d3a7e7c8
5
5
  SHA512:
6
- metadata.gz: 4ae0bb951df2edcd31c800470165f8df8205f5a33ff32fea2c27059c241077d17bc7cafb630650c7060edc3cace6d934ec08841d0fe57b64ef1a4ecd69d7a6fd
7
- data.tar.gz: 112c761df3151f9482eaf4a77ea4561c21dee2805fbeeafac085c5a4ecb3e022b065e20445e8762f9c62363a5ab006ac8900bba07e9f3f7b50d6fae09e2819ef
6
+ metadata.gz: e58c39fe63206371bd873c3f9ffd1cabefd6b03a9d9173c9ffb6d1b65f55a16ed0d424f22c58e52ecb139cbb8684b4ae58ee3918db93c7e3d2d2e5697c25d430
7
+ data.tar.gz: 1832621e353e35c2e90c95ebfdab605800c16a1ee40365cdcc10f3641c5bde481f5847ca84822c881e6d5146809d4fa9c4746e2c3ae00852f0a30611cea49e53
@@ -27,7 +27,7 @@ Log.severity = options[:log].to_i if options[:log]
27
27
  module Log
28
28
  def self.log(msg,level)
29
29
  msg = "" if msg.nil?
30
- puts msg
30
+ puts msg if level >= Log.severity
31
31
  end
32
32
  end
33
33
 
@@ -57,7 +57,19 @@ docker_args = args[1..-1] || []
57
57
 
58
58
  cmd_args.collect!{|a| '"' << a << '"' }
59
59
 
60
- infrastructure_file = Rbbt.etc.infrastructure[infrastructure_file+'.yaml'].find unless File.exists? infrastructure_file
60
+ if not File.exists? infrastructure_file
61
+ name = infrastructure_file
62
+ infrastructure_file = Rbbt.root.etc.infrastructure[name+'.yaml'].find
63
+ if not File.exists? infrastructure_file
64
+ docker_dir = Path.setup("~/Docker").find
65
+ infrastructure_file = docker_dir.infrastructure[name + '.yaml'].find
66
+ raise "Not found: #{name}" unless infrastructure_file.exists?
67
+ directory = docker_dir[name].find
68
+ FileUtils.mkdir_p directory unless File.directory? directory
69
+ FileUtils.cd directory
70
+ end
71
+ end
72
+
61
73
  infrastructure = File.open(infrastructure_file){|io| YAML.load io }
62
74
 
63
75
  IndiferentHash.setup(infrastructure)
@@ -71,76 +83,4 @@ if options[:extra_mounts]
71
83
  end
72
84
  end
73
85
 
74
-
75
-
76
86
  RbbtDocker.load_infrastructure(infrastructure, cmd, cmd_args, docker_args, options)
77
-
78
- #docker_args.collect!{|a| '"' << a << '"' }
79
- #
80
- #infrastructure = File.open(infrastructure_file){|io| YAML.load io }
81
- #IndiferentHash.setup(infrastructure)
82
- #
83
- #image = infrastructure[:image]
84
- #
85
- #if user = infrastructure[:user]
86
- # user_conf = "-u #{user} -e HOME=/home/#{user}/ -e USER=#{user}"
87
- # user_conf = "-e HOME=/home/#{user}/ -e USER=#{user}"
88
- #else
89
- # user_conf = ""
90
- #end
91
- #
92
- #mount_conf = ""
93
- #seen_mounts = {}
94
- #if infrastructure[:mounts]
95
- # infrastructure[:mounts].each do |target,source|
96
- # target = target.gsub("USER", user) if target.include? "USER"
97
- # if source.nil? or source.empty?
98
- # mount_conf << " -v #{target}"
99
- # else
100
- # matches = seen_mounts.select{|starget,ssource| Misc.path_relative_to starget, target }
101
- #
102
- # if matches.any?
103
- # matches.each do |starget,ssource|
104
- # subdir = Misc.path_relative_to starget, target
105
- # dir = File.join(ssource, File.dirname(subdir))
106
- # if not File.directory? dir
107
- # FileUtils.mkdir_p dir
108
- # FileUtils.chmod 0777, dir
109
- # end
110
- # end
111
- #
112
- # end
113
- #
114
- # if not File.directory? source
115
- # FileUtils.mkdir_p source
116
- # FileUtils.chmod 0777, source
117
- # end
118
- # seen_mounts[target] = source
119
- # mount_conf << " -v #{File.expand_path(source)}:#{target}"
120
- # end
121
- # end
122
- #end
123
- #
124
- #if infrastructure[:workflow_autoinstall] and infrastructure[:workflow_autoinstall].to_s == 'true' and cmd =~ /rbbt/
125
- # cmd = "env RBBT_WORKFLOW_AUTOINSTALL=true " + cmd
126
- #end
127
- #
128
- #umask = infrastructure[:umask] ? 'umask 000; ' : ''
129
- #cmd_str = "docker run #{mount_conf} #{user_conf} #{docker_args*" "} #{image} /bin/bash --login -c '#{umask}#{cmd} #{cmd_args*" "}"
130
- #cmd_str += " --log #{Log.severity} " if cmd =~ /\brbbt$/
131
- #cmd_str += "'"
132
- #
133
- #Log.info "Docker: \n" << cmd_str
134
- #exec(cmd_str) unless options[:dry_run]
135
-
136
- __END__
137
- image: mikisvaz/rbbt-basic
138
- user: rbbt
139
- umask: true
140
- workflow_autoinstall: true
141
- mounts:
142
- /home/USER/.rbbt/: ./.rbbt
143
- /home/USER/.rbbt/share/databases: /data3/rbbt/share/databases
144
- /home/USER/.rbbt/share/organisms: /data3/rbbt/share/organisms
145
- /home/USER/.rbbt/var/dbNSFP: /data3/rbbt/var/dbNSFP
146
- /home/USER/.rbbt/var/DbSNP: /data3/rbbt/var/DbSNP
data/lib/rbbt/docker.rb CHANGED
@@ -31,7 +31,7 @@ module RbbtDocker
31
31
  dir = File.join(ssource, File.dirname(subdir))
32
32
  if not File.directory? dir
33
33
  FileUtils.mkdir_p dir
34
- FileUtils.chmod 0777, dir
34
+ FileUtils.chmod_R 0777, File.join(ssource,subdir.split("/").first)
35
35
  end
36
36
  end
37
37
 
@@ -55,11 +55,11 @@ module RbbtDocker
55
55
  name_conf = options[:name]
56
56
  name_conf = "--name " << name_conf if name_conf
57
57
  name_conf ||= ""
58
- cmd_str = "docker run #{name_conf} #{mount_conf} #{user_conf} #{docker_args*" "} #{image} /bin/bash --login -c '#{umask}#{cmd} #{cmd_args*" "}"
58
+ cmd_str = "docker run #{name_conf} #{mount_conf} #{user_conf} #{docker_args.select{|arg| arg != '"--"'}*" "} #{image} /bin/bash --login -c '#{umask}#{cmd} #{cmd_args*" "}"
59
59
  cmd_str += " --log #{Log.severity} " if cmd =~ /\brbbt$/
60
60
  cmd_str += "'"
61
61
 
62
- Log.info "Docker: \n" << cmd_str
62
+ Log.debug "Docker: \n\n" << cmd_str << "\n\n"
63
63
 
64
64
  exec(cmd_str) unless options[:dry_run]
65
65
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-image
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-06 00:00:00.000000000 Z
11
+ date: 2016-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbbt-util