stapel 0.0.1 → 0.0.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/stapel +34 -7
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7aa52485f766d6fa3f1753c76edd0fe1c7d4fd22
4
- data.tar.gz: c76735760f6cc822ccaf9b1381f76b12d3a649ed
3
+ metadata.gz: 3c283b1bd330e3fed0304184c0c5bbb777177d8b
4
+ data.tar.gz: 81d58d3228c07a60af9b4770b1dea4aa70d8518b
5
5
  SHA512:
6
- metadata.gz: 823f20bcc19751e612e77a95614cc26bf79567353bf4c120e5f5bb748f9c3cd5a2bc8046d7f48b62d1dfa461878ca71d6661e25e07513943624d9e43a091fa47
7
- data.tar.gz: b5431fa08b220b00b2c8f39de551f1317ede0b644eea03348685c91e899613eebae575e5897322028c9326c0c04c9d7b71b6dd8b9c8f5cd585c770a16a58ee5a
6
+ metadata.gz: ff09f39e1c62d3b3869af56bb47e624dd482311f61bed0a44f16ee2f2ea661f84c343889d3e74d263f4749750c3beeb51b25809a6934c281c7f4ff6b52c7efd1
7
+ data.tar.gz: f1094f00d4aecd11b5632662035695ae649f51804902e9a3c46435e1c269b938085d622f9cfa662e70e9d007144552556a05fca835c6b29ebb0c7ca31e15e418
data/bin/stapel CHANGED
@@ -18,9 +18,30 @@ require_relative '../lib/worker.rb'
18
18
  # cleanup #the script that is executed on the worker after a worker is finished
19
19
  # aggregate #the script that will be executed on the master to aggregate all results after all jobs finished
20
20
 
21
- def aggregate(path_to_env,output)
22
- aggregate_path = File.join(path_to_env, "aggregate")
23
- system(aggregate_path, output) if File.exists?(aggregate_path)
21
+
22
+ def main
23
+ Thread.abort_on_exception = true
24
+
25
+ $base_path = File.expand_path(File.dirname(__FILE__))
26
+ $projects_path =File.expand_path(File.join($base_path, "../projects"))
27
+
28
+ if ARGV.length == 2 && ARGV[0] == "init"
29
+ path_to_copy = File.join($projects_path, ARGV[1])
30
+ help unless File.exist?(path_to_copy)
31
+ copy(path_to_copy)
32
+ exit
33
+ elsif ARGV.length == 1 && File.exists?(ARGV[0])
34
+ run(File.expand_path(ARGV[0]))
35
+ end
36
+ help
37
+ end
38
+
39
+ def help
40
+ puts "to run a project use: staple path/to/project"
41
+ puts "to create a new project use: stapel init $template"
42
+ puts "known templates:"
43
+ Dir.glob( File.join($projects_path, "*") ).each{|path| puts "\t#{File.basename(path)}"}
44
+ exit
24
45
  end
25
46
 
26
47
  def run(path_to_env)
@@ -34,6 +55,12 @@ def run(path_to_env)
34
55
  aggregate(path_to_env, pool.output)
35
56
  end
36
57
 
58
+ def aggregate(path_to_env,output)
59
+ aggregate_path = File.join(path_to_env, "aggregate")
60
+ system(aggregate_path, output) if File.exists?(aggregate_path)
61
+ end
62
+
63
+
37
64
  def run_worker_on_machine(path_to_env, machine, pool)
38
65
  worker = Worker.new(path_to_env, machine, pool)
39
66
  worker.upload_environment
@@ -45,7 +72,7 @@ ensure
45
72
  worker.cleanup if worker
46
73
  end
47
74
 
48
-
49
- Thread.abort_on_exception = true
50
- fail 'usage master.rb path/to/project' unless ARGV.length == 1
51
- run(File.expand_path(ARGV[0]))
75
+ def copy(path_to_copy)
76
+ FileUtils.cp_r(path_to_copy,".")
77
+ end
78
+ main
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stapel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cornelius Aschermann