taps2 0.5.2 → 0.5.3
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 +4 -4
- data/README.rdoc +25 -0
- data/VERSION.yml +1 -1
- data/lib/taps/cli.rb +12 -12
- data/lib/taps/data_stream.rb +1 -1
- data/lib/taps/progress_bar.rb +6 -4
- data/lib/taps/schema.rb +14 -16
- data/lib/taps/utils.rb +8 -8
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3270e6af8e2dc53e576280f136c8770739cea503
|
4
|
+
data.tar.gz: 19c20c887792004a6d912a0dcf2381f7f5f4283d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2437f76336492e0e4b94ca7bed79f86198d80fad72688acf96490061caa5095820980bce4ac7136b4d4919b59087d64202fdaac8e9ed10cc1e3e245553f98a67
|
7
|
+
data.tar.gz: 16c2b38ddb8a6e7ae3dfe9b44456a588f7a4cd1f2dc616f142bd87adf2f446767137791835899a8e0e22a6341e7960825a360b6333f4d5f50ce6247c2c3bce0d
|
data/README.rdoc
CHANGED
@@ -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
|
data/VERSION.yml
CHANGED
data/lib/taps/cli.rb
CHANGED
@@ -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
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
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"
|
data/lib/taps/data_stream.rb
CHANGED
@@ -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
|
-
|
212
|
+
ERROR
|
213
213
|
else raise ex
|
214
214
|
end
|
215
215
|
end
|
data/lib/taps/progress_bar.rb
CHANGED
@@ -115,7 +115,7 @@ class ProgressBar
|
|
115
115
|
if @total.zero?
|
116
116
|
100
|
117
117
|
else
|
118
|
-
@current
|
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
|
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
|
-
|
177
|
+
public
|
178
|
+
|
177
179
|
def clear
|
178
180
|
@out.print "\r"
|
179
181
|
@out.print(" " * (get_width - 1))
|
data/lib/taps/schema.rb
CHANGED
@@ -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
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
-
|
25
|
-
|
26
|
-
end
|
23
|
+
def down
|
24
|
+
drop_table("#{table}") if @db.table_exists?("#{table}")
|
27
25
|
end
|
28
|
-
|
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
|
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
|
-
|
50
|
-
|
51
|
-
|
52
|
-
end
|
47
|
+
Class.new(Sequel::Migration) do
|
48
|
+
def up
|
49
|
+
#{idx}
|
53
50
|
end
|
54
|
-
|
51
|
+
end
|
52
|
+
END_MIG
|
55
53
|
end
|
56
54
|
end
|
57
55
|
::OkJson.encode(idxs)
|
data/lib/taps/utils.rb
CHANGED
@@ -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
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
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.
|
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:
|
71
|
+
name: extlib
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
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:
|
83
|
+
version: '0'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
85
|
+
name: sqlite3
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
91
|
-
type: :
|
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:
|
97
|
+
version: 1.3.8
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: bacon
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|