rbbt-util 5.17.84 → 5.17.85

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: 8842be9c30f7b099e160b65367eb410ff4388343
4
- data.tar.gz: 711d01d859e0a3ff1cb7b13e259cafffff964ab6
3
+ metadata.gz: 5506140dc77115d9116f1ffaa8c607a7b1c10311
4
+ data.tar.gz: cbdd97fff8f718908d76633a6a5afacefd580131
5
5
  SHA512:
6
- metadata.gz: 9234cf00cda78e567c2be8ba91dde0c202eac2b627f37493f5122c68524065e3d8d214bd930ac13da4c9fd537e39adb4b03c48a9389f5b45514d2381c654e77e
7
- data.tar.gz: 864697c695ff8cd8390ea59f0677470696f611aaf738ce36252967440edca7f3d4bdcc044488488a3e6ff831f873085659fdb482728fffcdf6bdf20eabcbad34
6
+ metadata.gz: 19bb5c11c41cca14871e08b1b62bd8c0eef9c678620e34ee933047db73f24f6234caf430f7828ec3481e09e6d51c4838809343011b8d95d634c611f7a0a47bd8
7
+ data.tar.gz: 538b482550cbfa7eb760a85417f7b4f60a419e89701ced17ffaf4572ba8fe99e4f3d3c85dc640ac7da898ac659203f9de855c711262903c6febb47fc539ffd5a
@@ -1,7 +1,32 @@
1
+
1
2
  #!/usr/bin/env ruby
2
3
 
3
- require 'rbbt'
4
- require 'highline/import'
4
+ require 'rbbt-util'
5
+ require 'rbbt/util/simpleopt'
6
+
7
+ $0 = "rbbt #{$previous_commands*""} #{ File.basename(__FILE__) }" if $previous_commands
8
+
9
+ options = SOPT.setup <<EOF
10
+
11
+ Description
12
+
13
+ $ rbbt conf web_user add [options] <user>
14
+
15
+ Use - to read from STDIN
16
+
17
+ -h--help Print this help
18
+ -p--password* Set password (ask otherwise)
19
+
20
+ EOF
21
+ if options[:help]
22
+ if defined? rbbt_usage
23
+ rbbt_usage
24
+ else
25
+ puts SOPT.usage
26
+ end
27
+ exit 0
28
+ end
29
+
5
30
 
6
31
  if Rbbt.etc.web_users.exists?
7
32
  web_users = Rbbt.etc.web_users.yaml
@@ -13,13 +38,20 @@ user = ARGV.shift
13
38
 
14
39
  raise "No user provided" if user.nil?
15
40
 
16
- password = ask("Enter your password: ") { |q| q.echo = "x" }
41
+ if options[:password].nil?
42
+ require 'highline/import'
43
+
44
+ password = ask("Enter your password: ") { |q| q.echo = "x" }
17
45
 
18
- raise "No password provided" if password.nil?
46
+ raise "No password provided" if password.nil?
19
47
 
20
- password_check = ask("Re-enter your password: ") { |q| q.echo = "x" }
48
+ password_check = ask("Re-enter your password: ") { |q| q.echo = "x" }
21
49
 
22
- raise "Passwords don't match" if password != password_check
50
+ raise "Passwords don't match" if password != password_check
51
+
52
+ else
53
+ password = options[:password]
54
+ end
23
55
 
24
56
  web_users[user] = password
25
57
 
@@ -556,4 +556,20 @@ row2 A AA AAA
556
556
  def test_merge_key_field
557
557
  assert TSV.open('/home/mvazquezg/git/workflows/genomics/share/gene_ages', :key_field => "FamilyAge", :merge => true, :persist => false, :zipped => true, :type => :double).values.first.length > 1
558
558
  end
559
+
560
+ def test_flat_merge
561
+ content =<<-EOF
562
+ #Id ValueA ValueB OtherID
563
+ row1 a|aa|aaa b Id1|Id2
564
+ row2 A|aAa B Id3
565
+ row3 AA BB|BBB Id3|Id2
566
+ EOF
567
+
568
+ TmpFile.with_file(content) do |filename|
569
+ tsv = TSV.open(filename, :sep => /\s+/, :key_field => "OtherID", :fields => ["ValueA"], :type => :flat, :merge => true)
570
+ assert_equal %w(A aAa AA).sort, tsv["Id3"].sort
571
+ assert_equal %w(a aa aaa AA).sort, tsv["Id2"].sort
572
+
573
+ end
574
+ end
559
575
  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.17.84
4
+ version: 5.17.85
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-01 00:00:00.000000000 Z
11
+ date: 2015-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake