idata 0.3.1 → 0.4.0

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/iload +10 -8
  3. data/lib/idata/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69a99cb6ea4fb972dec876c88ec37ca7e3d4986e
4
- data.tar.gz: 9f17bc2ab0867328c9140496d3acedc00f1a4f95
3
+ metadata.gz: 45d9ad3aa3448f33bbae663345c40e37f2d93ab6
4
+ data.tar.gz: 55b2264c03d2554b5d784cb2bc30a1a1fa294555
5
5
  SHA512:
6
- metadata.gz: 59bdce85d4720ad18bdaec24abef16efbb40674316a30474d878cfd0fd1b6d13d0180ebcec98592b6cd0f95c8e59477655aeaa0cff595010482d064f9b91e693
7
- data.tar.gz: c559ab7741fe815b518daffb75a21b24cc86514535e8736c1cb10456ecb0b652904ce1fa7c92dcd215071f88dba62c5dad1165b22435adb0218714d2040454c8
6
+ metadata.gz: 0f85c264b07d477ae9227f7732e47a2f81d78504fd947dee3615ca25c86d60e1b319452ee42a223ef2bdc8ecbb801b653ba008e19d726dd6924773418e03d4c1
7
+ data.tar.gz: a354d23e196ea2155f70be07d9239d96a96943e2e8b495c1a430034e689783fd2fcb2f00140c72d0ab2ff0a9ecd8b9772653a3a3dd99d50125d1d308f230bca9
data/bin/iload CHANGED
@@ -22,7 +22,6 @@ CSV_DEFAULT_DELIMITER = ','
22
22
  CSV_DEFAULT_QUOTE = '"'
23
23
  CSV_DEFAULT_FORMAT = 'CSV'
24
24
 
25
-
26
25
  def error(msg)
27
26
  puts "Error: #{msg}"
28
27
  exit(-1)
@@ -83,10 +82,6 @@ parser = OptionParser.new("", 24) do |opts|
83
82
  opts.on("-l", "--listen PORT", "PostgreSQL listen port (default to 5432)") do |v|
84
83
  $options[:listen] = v
85
84
  end
86
-
87
- opts.on("-c", "--client CLIENT", "Client name") do |v|
88
- $options[:client] = v
89
- end
90
85
 
91
86
  opts.on_tail('--help', 'Displays this help') do
92
87
  puts opts, "", help
@@ -125,6 +120,9 @@ $options[:delim] ||= CSV_DEFAULT_DELIMITER
125
120
  $options[:quote] ||= CSV_DEFAULT_QUOTE
126
121
  $options[:drop] ||= false
127
122
 
123
+ # extra options
124
+ $options[:client] = ARGV[0] if ARGV[0]
125
+
128
126
  # validate parameters
129
127
  if $options[:input].nil?
130
128
  error "please specify input file: -i"
@@ -147,16 +145,20 @@ if $options[:table].nil?
147
145
  end
148
146
 
149
147
  if $options[:client] and ($options[:host] or $options[:database] or $options[:username] or $options[:password])
150
- error "once -c is specified, -h/-u/-d/-p is no longer needed"
148
+ error "once client name (#{$options[:client]}) is specified, -h/-u/-d/-p is no longer needed"
149
+ end
150
+
151
+ if ARGV.count > 1
152
+ error "too many arguments!"
151
153
  end
152
154
 
153
155
  if $options[:client]
154
156
  if ENV['MAINDBNAME'].blank?
155
- error "The environment variable MAINDBNAME (used by -c/--client) is not present"
157
+ error "the environment variable MAINDBNAME is not present"
156
158
  end
157
159
 
158
160
  if ENV['MAINDBHOST'].blank?
159
- error "The environment variable MAINDBHOST (used by -c/--client) is not present"
161
+ error "the environment variable MAINDBHOST is not present"
160
162
  end
161
163
 
162
164
  ActiveRecord::Base.establish_connection(
data/lib/idata/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Idata
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: idata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nghi Pham