vagrant_workspace 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -2
- data/lib/vagrant_workspace/action/run.rb +27 -7
- data/lib/vagrant_workspace/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9538aefc390d58d18bd195d0f2576352e531878
|
4
|
+
data.tar.gz: d7dfb14116848aff16082c8e904b34b18cc244dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c3668777bc2bb918b5f1a4a78fad9bbe857a15ec22daa6ce9b89fb371b21a58829166749230f6158ab7dd89000a70b9e8b404313d8353debc75cfc09da7db11
|
7
|
+
data.tar.gz: 387173da3b9c04bb780edf6e7b0dd0a8c732dc87bb3838de1e598e7957695292fc543df6f59c0a70e336a86102a0869bdbda6d5198e06f15aed9fd3bbc31b1f8
|
data/README.md
CHANGED
@@ -22,14 +22,17 @@ end
|
|
22
22
|
Example workspace file:
|
23
23
|
```yml
|
24
24
|
# workspaces/mega_feature.yml
|
25
|
+
_all:
|
26
|
+
before:
|
27
|
+
- git fetch origin
|
28
|
+
after:
|
29
|
+
- echo 'done!'
|
25
30
|
project1:
|
26
31
|
run:
|
27
|
-
- git fetch origin
|
28
32
|
- git checkout mega_feature
|
29
33
|
- bundle install
|
30
34
|
project2:
|
31
35
|
run:
|
32
|
-
- git fetch origin
|
33
36
|
- git checkout mega_feature
|
34
37
|
- npm install
|
35
38
|
```
|
@@ -11,20 +11,40 @@ module VagrantWorkspace
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def call(env)
|
14
|
-
|
14
|
+
workspace_hash.each do |project_name, project|
|
15
|
+
next if project_name == '_all'
|
16
|
+
|
15
17
|
puts "Executing commands on #{project_name}:"
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
18
|
+
execute(project_name, before_commands)
|
19
|
+
execute(project_name, project['run'])
|
20
|
+
execute(project_name, after_commands)
|
20
21
|
end
|
21
22
|
app.call(env)
|
22
23
|
end
|
23
24
|
|
24
25
|
private
|
25
26
|
|
26
|
-
def
|
27
|
-
|
27
|
+
def execute(project_name, commands)
|
28
|
+
commands.each do |command|
|
29
|
+
puts "$ #{command}"
|
30
|
+
machine.communicate.execute "cd #{path(project_name)} && #{command}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def before_commands
|
35
|
+
return [] unless workspace_hash['_all']
|
36
|
+
return [] unless workspace_hash['_all']['before']
|
37
|
+
workspace_hash['_all']['before']
|
38
|
+
end
|
39
|
+
|
40
|
+
def after_commands
|
41
|
+
return [] unless workspace_hash['_all']
|
42
|
+
return [] unless workspace_hash['_all']['after']
|
43
|
+
workspace_hash['_all']['after']
|
44
|
+
end
|
45
|
+
|
46
|
+
def workspace_hash
|
47
|
+
@workspace_hash ||= YAML.load_file(workspace_file)
|
28
48
|
end
|
29
49
|
|
30
50
|
def path(project)
|