vagrant_workspace 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd3b2075002d793c75d7beddd350cf140675760d
4
- data.tar.gz: 563bfc7c7811e30fb7f6a056f8ad3d65a0c25ae4
3
+ metadata.gz: c9538aefc390d58d18bd195d0f2576352e531878
4
+ data.tar.gz: d7dfb14116848aff16082c8e904b34b18cc244dd
5
5
  SHA512:
6
- metadata.gz: 8d220df6a2b9b6b56dc460eedf7ac3872888112fec3c4335d36c23aac2c7cc7e0220e4ac1cb214d6ae2e72e4ee8b2c26531bbf165e74ffccf15574e779ca4833
7
- data.tar.gz: 1e309d74fe77f9fefed14d36e502e2dbb24556a089b196f5a39d39ff0f2baf6ecaa48fd282003df9b1717313cde3be2814e1a2027693537c2aee95b1cada901d
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
- projects.each do |project_name, project|
14
+ workspace_hash.each do |project_name, project|
15
+ next if project_name == '_all'
16
+
15
17
  puts "Executing commands on #{project_name}:"
16
- project['run'].each do |command|
17
- puts "$ #{command}"
18
- machine.communicate.execute "cd #{path(project_name)} && #{command}"
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 projects
27
- YAML.load_file(workspace_file)
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)
@@ -1,3 +1,3 @@
1
1
  module VagrantWorkspace
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant_workspace
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
  - Ali Ismayilov