buildserver 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b72ed4c687eef92500afb2b1c876317b4388999f
4
- data.tar.gz: cdb5884eb239d1eba3c50147523dc2da09bb323e
3
+ metadata.gz: 2fea7b59f4b3317ae8a59d45a88433bb844ac667
4
+ data.tar.gz: 28e8c0e22dfba7253f684e3d8d5e5daa73d58bd9
5
5
  SHA512:
6
- metadata.gz: 915189f82ddc5134fa5b1a86f5c9e6804892a3985f16f8e41bc3539be9b5aa016ad3a91866f678fda2b7153b95098f4f55c548bc0d5ce84e0f1a48454eadd157
7
- data.tar.gz: 3701fa4c48d6ecbf5a6f779af926a830bca19b2b055592eff96e1a2a5821b94693edac7c018064745219a2a02061aedbb5ac830c1ee1fbc52da2814ded382836
6
+ metadata.gz: 16a8bae7835f16fe07bd7f286dceee95be357d72d0e72eef321b4816411d91f11c11e8107a5538a4220087dce7edf49074cb8ae996e29955f6f29f1516059ab1
7
+ data.tar.gz: 1ad4b04a62b7b0863fce1e98183e4a991c7b27479bc05cb0be0f1bbd6502c29a0b0f43cdcdc02ce032dc4ee7000a1777ab482d64a8aefa8da15685440b275900
data/buildserver.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "buildserver"
7
- spec.version = '0.0.4'
7
+ spec.version = '0.0.5'
8
8
  spec.authors = ["Kasper Grubbe"]
9
9
  spec.email = ["kawsper@gmail.com"]
10
10
  spec.summary = %q{Lets you easily compile bash scripts from Ruby to build server instances on your favorite Linux distro.}
@@ -85,6 +85,15 @@ EOF")
85
85
  EOF")
86
86
  end
87
87
 
88
+ ## SYSTEM SETUP
89
+ ###############################################
90
+
91
+ def if_first_system_setup?(direction = nil)
92
+ run_command("if [ ! -f /root/system_setup_complete ]; then", direction)
93
+ yield if block_given?
94
+ run_command("fi", direction)
95
+ end
96
+
88
97
  ## USER
89
98
  ###############################################
90
99
 
@@ -130,5 +139,14 @@ EOF")
130
139
  run_command("fi")
131
140
  end
132
141
 
142
+ ## TEXT EDITING
143
+ ###############################################
144
+
145
+ def find_and_replace(before, after, filepath)
146
+ run_command("OLD=\"#{before}\"")
147
+ run_command("NEW=\"#{after}\"")
148
+ run_command("sed -i \"s/\${OLD}/\${NEW}/g\" #{filepath}")
149
+ end
150
+
133
151
  end
134
152
  end
@@ -40,6 +40,10 @@ module Buildserver
40
40
  @commands = []
41
41
  @after_commands = []
42
42
 
43
+ # Safe bash:
44
+ @commands << "set -eux"
45
+ @commands << "set -o pipefail"
46
+
43
47
  @build_blocks.each do |build_block|
44
48
  @commands << "# ! #{build_block.to_s} -------------------------------------"
45
49
 
@@ -53,6 +57,10 @@ module Buildserver
53
57
 
54
58
  @commands << @after_commands
55
59
 
60
+ @commands << "if [ ! -f /root/system_setup_complete ]; then"
61
+ @commands << "echo $(date \"+%Y.%m.%d-%H:%M:%S\") > /root/system_setup_complete"
62
+ @commands << "fi"
63
+
56
64
  @commands.flatten
57
65
  end
58
66
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buildserver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kasper Grubbe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-02 00:00:00.000000000 Z
11
+ date: 2015-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler