taps2 0.5.2 → 0.5.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: a9180fa16a2a3559b6ac1469d8f0b13d8b316bf6
4
- data.tar.gz: 22fb069d469aa11a6eacbfa5393500eaefadc54a
3
+ metadata.gz: 3270e6af8e2dc53e576280f136c8770739cea503
4
+ data.tar.gz: 19c20c887792004a6d912a0dcf2381f7f5f4283d
5
5
  SHA512:
6
- metadata.gz: 2831c2f6d2a7014c4e880c7dc2c0ddad48fbbfb068766d1ab8d3458e374f54d491168b4305816df9b6ec1898408e805aae5b20282badd0195834c9850078e447
7
- data.tar.gz: ae762f9e63281d8418341de24a1db33c937ce24fad41c09d507bfc7849745cc569860fc7e0fbb7deed5b3c2e63c9266890449a445f6ca9b835899debc2ef1b74
6
+ metadata.gz: 2437f76336492e0e4b94ca7bed79f86198d80fad72688acf96490061caa5095820980bce4ac7136b4d4919b59087d64202fdaac8e9ed10cc1e3e245553f98a67
7
+ data.tar.gz: 16c2b38ddb8a6e7ae3dfe9b44456a588f7a4cd1f2dc616f142bd87adf2f446767137791835899a8e0e22a6341e7960825a360b6333f4d5f50ce6247c2c3bce0d
@@ -10,6 +10,31 @@ Renamed gem
10
10
 
11
11
  $ gem install taps2
12
12
 
13
+ By default, Taps will attempt to create a SQLite3 database for sessions. Unless you specify a different database type, you'll need to install SQLite 3. (See _Environment Variables_ for alternative session databases.)
14
+
15
+ $ gem install sqlite3
16
+
17
+ Install the gems to support databases you want to work with, such as MySQL or PostgreSQL.
18
+
19
+ $ gem install mysql2
20
+ $ gem install pg
21
+
22
+ == Configuration: Environment Variables
23
+
24
+ _All environment variables are optional._
25
+
26
+ The `TAPS_DATABASE_URL` variable specifies the database URI where session data is stored on CLI or Server.
27
+ The `DATABASE_URL` variable is a fallback (and compatible with Heroku) if `TAPS_DATABASE_URL` is not specified.
28
+ By default, Taps will create a SQLite3 database.
29
+
30
+ The `TAPS_LOGIN` and `TAPS_PASSWORD` variables are used for default Basic Authentication.
31
+
32
+ The `NO_DEFAULT_DATABASE_URL` variable allows you to require a database URI be sent in the `body` of the request that initiates a Taps session. (Default behavior will use the database URI specified when starting the server.)
33
+
34
+ The `NO_DUMP_MARSHAL_ERRORS` variable allows you to disable dumping of marshalled data that caused an error.
35
+
36
+ The `NO_DEFLATE` variable allows you to disable gzip compression (`Rack::Deflater`) on the server.
37
+
13
38
  == Usage: Server
14
39
 
15
40
  Here's how you start a taps server
@@ -2,4 +2,4 @@
2
2
  :build:
3
3
  :major: 0
4
4
  :minor: 5
5
- :patch: 2
5
+ :patch: 3
@@ -5,7 +5,7 @@ require 'taps/config'
5
5
  require 'taps/log'
6
6
  require 'vendor/okjson'
7
7
 
8
- Taps::Config.taps_database_url = ENV['TAPS_DATABASE_URL'] || begin
8
+ Taps::Config.taps_database_url = ENV['TAPS_DATABASE_URL'] || ENV['DATABASE_URL'] || begin
9
9
  # this is dirty but it solves a weird problem where the tempfile disappears mid-process
10
10
  require 'sqlite3'
11
11
  $__taps_database = Tempfile.new('taps.db')
@@ -73,15 +73,15 @@ module Taps
73
73
 
74
74
  def help
75
75
  puts <<EOHELP
76
- Options
77
- =======
78
- server Start a taps database import/export server
79
- pull Pull a database from a taps server
80
- push Push a database to a taps server
81
- version Taps version
82
-
83
- Add '-h' to any command to see their usage
84
- EOHELP
76
+ Options
77
+ =======
78
+ server Start a taps database import/export server
79
+ pull Pull a database from a taps server
80
+ push Push a database to a taps server
81
+ version Taps version
82
+
83
+ Add '-h' to any command to see their usage
84
+ EOHELP
85
85
  end
86
86
 
87
87
  def serveroptparse
@@ -95,8 +95,8 @@ module Taps
95
95
  o.parse!(argv)
96
96
 
97
97
  opts[:database_url] = argv.shift
98
- opts[:login] = argv.shift
99
- opts[:password] = argv.shift
98
+ opts[:login] = argv.shift || ENV['TAPS_LOGIN']
99
+ opts[:password] = argv.shift || ENV['TAPS_PASSWORD']
100
100
 
101
101
  if opts[:database_url].nil?
102
102
  $stderr.puts "Missing Database URL"
@@ -209,7 +209,7 @@ class DataStream
209
209
  \nDetected integer data that exceeds the maximum allowable size for an integer type.
210
210
  This generally occurs when importing from SQLite due to the fact that SQLite does
211
211
  not enforce maximum values on integer types.
212
- ERROR
212
+ ERROR
213
213
  else raise ex
214
214
  end
215
215
  end
@@ -115,7 +115,7 @@ class ProgressBar
115
115
  if @total.zero?
116
116
  100
117
117
  else
118
- @current * 100 / @total
118
+ @current * 100 / @total
119
119
  end
120
120
  end
121
121
 
@@ -137,10 +137,11 @@ class ProgressBar
137
137
  end
138
138
 
139
139
  def show
140
- arguments = @format_arguments.map {|method|
140
+ arguments = @format_arguments.map do |method|
141
141
  method = sprintf("fmt_%s", method)
142
142
  send(method)
143
- }
143
+ end
144
+
144
145
  line = sprintf(@format, *arguments)
145
146
 
146
147
  width = get_width
@@ -173,7 +174,8 @@ class ProgressBar
173
174
  end
174
175
  end
175
176
 
176
- public
177
+ public
178
+
177
179
  def clear
178
180
  @out.print "\r"
179
181
  @out.print(" " * (get_width - 1))
@@ -13,19 +13,18 @@ module Taps
13
13
  end
14
14
 
15
15
  def dump_table(database_url, table)
16
- table = table.to_sym
17
16
  Sequel.connect(database_url) do |db|
18
17
  <<END_MIG
19
- Class.new(Sequel::Migration) do
20
- def up
21
- #{db.extension(:schema_dumper).dump_table_schema(Sequel.identifier(table), :indexes => false)}
22
- end
18
+ Class.new(Sequel::Migration) do
19
+ def up
20
+ #{db.extension(:schema_dumper).dump_table_schema(Sequel.identifier(table.to_sym), :indexes => false)}
21
+ end
23
22
 
24
- def down
25
- drop_table("#{table}") if @db.table_exists?("#{table}")
26
- end
23
+ def down
24
+ drop_table("#{table}") if @db.table_exists?("#{table}")
27
25
  end
28
- END_MIG
26
+ end
27
+ END_MIG
29
28
  end
30
29
  end
31
30
 
@@ -37,8 +36,7 @@ module Taps
37
36
  def indexes_individual(database_url)
38
37
  idxs = {}
39
38
  Sequel.connect(database_url) do |db|
40
- tables = db.tables
41
- tables.each do |table|
39
+ db.tables.each do |table|
42
40
  idxs[table] = db.extension(:schema_dumper).send(:dump_table_indexes, table, :add_index, {}).split("\n")
43
41
  end
44
42
  end
@@ -46,12 +44,12 @@ module Taps
46
44
  idxs.each do |table, indexes|
47
45
  idxs[table] = indexes.map do |idx|
48
46
  <<END_MIG
49
- Class.new(Sequel::Migration) do
50
- def up
51
- #{idx}
52
- end
47
+ Class.new(Sequel::Migration) do
48
+ def up
49
+ #{idx}
53
50
  end
54
- END_MIG
51
+ end
52
+ END_MIG
55
53
  end
56
54
  end
57
55
  ::OkJson.encode(idxs)
@@ -57,14 +57,14 @@ module Taps
57
57
  row.each do |column, value|
58
58
  if value.to_s.length > (max_lengths[column] || value.to_s.length)
59
59
  raise Taps::InvalidData.new(<<-ERROR)
60
- Detected value that exceeds the length limitation of its column. This is
61
- generally due to the fact that SQLite does not enforce length restrictions.
62
-
63
- Table : #{table}
64
- Column : #{column}
65
- Type : #{schema.detect{|s| s.first == column}.last[:db_type]}
66
- Value : #{value}
67
- ERROR
60
+ Detected value that exceeds the length limitation of its column. This is
61
+ generally due to the fact that SQLite does not enforce length restrictions.
62
+
63
+ Table : #{table}
64
+ Column : #{column}
65
+ Type : #{schema.detect{|s| s.first == column}.last[:db_type]}
66
+ Value : #{value}
67
+ ERROR
68
68
  end
69
69
  end
70
70
  header.collect { |h| row[h] }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taps2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Chimal, Jr.
@@ -68,33 +68,33 @@ dependencies:
68
68
  - !ruby/object:Gem::Version
69
69
  version: 1.4.4
70
70
  - !ruby/object:Gem::Dependency
71
- name: sqlite3
71
+ name: extlib
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: 1.3.8
76
+ version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
- version: 1.3.8
83
+ version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
- name: extlib
85
+ name: sqlite3
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - ">="
89
89
  - !ruby/object:Gem::Version
90
- version: '0'
91
- type: :runtime
90
+ version: 1.3.8
91
+ type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
- version: '0'
97
+ version: 1.3.8
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: bacon
100
100
  requirement: !ruby/object:Gem::Requirement