rbbt-util 5.19.2 → 5.19.3

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: 8f0ff6054f7dec554e5bc0d8b989bbe73e044d9b
4
- data.tar.gz: 46fbc8bf8310b15eb76d9ef3c14c3b1d560ce8d6
3
+ metadata.gz: 19688b2b842ede5c05adec2ccb351808012dbe5f
4
+ data.tar.gz: 5a873e53a845b476e481ef328263bb2c52ef0146
5
5
  SHA512:
6
- metadata.gz: 8d4abd07561230e910020c97fe7538b889630766a6e294fd281a5443ece43a0346ec01e146eb6fa5629d30d09e8e2753becd2f01730bc844e8c4155cf7ad28c5
7
- data.tar.gz: 0b45d19a065cfb83fc657e08d1b24baf3a6e539e34a8e1f13881e82cd65c06591553a800566859f43236d43614e40b8f6e78c4cc5072501fad3ce5c002bf44c2
6
+ metadata.gz: 5c7b28062d2a776007054126cebb253899b31971d7622bde5a70476626a15e4a2e7d130eebc4f5a38eaa24d7145c3829eb6c43d0fbb4ade9fe1c25555eaf7bcb
7
+ data.tar.gz: 6b00bb4093ed0fd856973491bda3eb655bb17015731b48f20b427d8dfbee27ecfd4e9156f7ff1b6b48f843bf700fd502eeb7306a32313845591c260fee680b34
@@ -1,37 +1,71 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'rbbt'
4
3
  require 'rbbt-util'
4
+ require 'rbbt/util/simpleopt'
5
5
  require 'rbbt/workflow'
6
6
 
7
+
8
+ $0 = "rbbt #{$previous_commands*""} #{ File.basename(__FILE__) }" if $previous_commands
9
+
10
+ options = SOPT.setup <<EOF
11
+
12
+ Description
13
+
14
+ $ rbbt workflow install <workflow> [<repo>]
15
+
16
+ Install a workflow, or a coma separated list of workflows, from its source. If
17
+ repo is not specified then 'http://github.com/Rbbt-Workflows/' will be used. If
18
+ the workflow is already installed it will be updated. If 'all' is specified
19
+ instead of a particular workflow, all installed workflows will be updated.
20
+
21
+ -h--help Print this help
22
+
23
+ EOF
24
+ if options[:help]
25
+ if defined? rbbt_usage
26
+ rbbt_usage
27
+ else
28
+ puts SOPT.usage
29
+ end
30
+ exit 0
31
+ end
32
+
7
33
  workflow = ARGV[0]
8
34
  repo = ARGV[1]
9
35
 
10
36
  raise "No workflow specified" if workflow.nil?
11
37
 
12
- workflow_dir = Rbbt.etc.workflow_dir.exists? ? Rbbt.etc.workflow_dir.read.strip : Rbbt.workflows.find(:user)
38
+ workflow_dir = Rbbt.etc.workflow_dir.exists? ? Path.setup(Rbbt.etc.workflow_dir.read.strip) : Rbbt.workflows.find(:user)
13
39
 
14
40
  FileUtils.mkdir_p workflow_dir unless File.exists? workflow_dir
15
41
 
42
+ all_workflows = workflow_dir.glob("*/.git").collect{|d| File.basename(File.dirname(d))}
43
+ workflows = workflow == 'all' ? all_workflows : workflow.split(",")
44
+
16
45
  Misc.in_dir(workflow_dir) do
17
- case
18
- when File.exists?(Misc.snake_case(workflow))
19
- Misc.in_dir(Misc.snake_case(workflow)) do
20
- `git pull`
21
- end
22
- when File.exists?(workflow)
23
- Misc.in_dir(workflow) do
24
- `git pull`
25
- end
26
- else
27
- if repo.nil?
28
- repo_base_url = Rbbt.etc.workflow_repo.exists? ? Rbbt.etc.workflow_repo.read.strip : 'https://github.com/Rbbt-Workflows/'
29
- repo = File.join(repo_base_url, Misc.snake_case(workflow) + '.git')
30
- end
31
- Log.warn "Cloning #{ repo }"
32
- Misc.insist do
33
- `git clone "#{repo}"`
34
- raise unless $?.success?
46
+ workflows.each do |workflow|
47
+ case
48
+ when File.exists?(Misc.snake_case(workflow))
49
+ Log.info "Updating: " + workflow
50
+ Misc.in_dir(Misc.snake_case(workflow)) do
51
+ `git pull`
52
+ end
53
+ when File.exists?(workflow)
54
+ Misc.in_dir(workflow) do
55
+ Log.info "Updating: " + workflow
56
+ `git pull`
57
+ end
58
+ else
59
+ Log.info "Installing: " + workflow
60
+ if repo.nil?
61
+ repo_base_url = Rbbt.etc.workflow_repo.exists? ? Rbbt.etc.workflow_repo.read.strip : 'https://github.com/Rbbt-Workflows/'
62
+ repo = File.join(repo_base_url, Misc.snake_case(workflow) + '.git')
63
+ end
64
+ Log.warn "Cloning #{ repo }"
65
+ Misc.insist do
66
+ `git clone "#{repo}"`
67
+ raise unless $?.success?
68
+ end
35
69
  end
36
70
  end
37
71
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.19.2
4
+ version: 5.19.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-26 00:00:00.000000000 Z
11
+ date: 2015-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake