test_track_rails_client 4.0.0.alpha19 → 4.0.0.alpha20

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: 8f0e3ba5a8b25543717d72ce97b118814bb59106
4
- data.tar.gz: e24f6f23172eaffd2f42bbb2225224c61ff8c3fb
3
+ metadata.gz: 98967309eb9dc347f3943d42fd9d2609b04b0c91
4
+ data.tar.gz: f7962d1c6748909b38eec307f29ce651fd8b19a7
5
5
  SHA512:
6
- metadata.gz: 07457a7ca53f7433eca21e33a53fe28a41df6aca0445c8ebce62e08915e120b31ed56f5dbf67a39159b255745ce87a127912c2cea751d6320a2646e8b4a3235c
7
- data.tar.gz: f84f8e74c6b82ce0630bc81e7c66c224180053e42125cff661dc468d88d6cd089f8ef79685335aaf77f75903178fcb7904d8a609b7aeb898ddc68a7ddd246d26
6
+ metadata.gz: ffd92fa9371b8a4319e85a056596c9cc9898c44f6f70fe870bbbb39ebe477090a2c300761a6bfd6dfaead632bee91a5592a4e40e1c5ed67358074ff3382d2898
7
+ data.tar.gz: 6b058380d16a8aeb7bf7358a8121f2d6c7abd68ce05ef3aae2b78949d943cd8e2effbd17771dabc5ecaba1fa616558bc7c651054a54dd103c77d53cca5147962
@@ -0,0 +1,35 @@
1
+ require 'rbconfig'
2
+
3
+ class TesttrackCli
4
+ include Singleton
5
+
6
+ def project_initialized?
7
+ File.exist?(File.join('testtrack', 'schema.yml'))
8
+ end
9
+
10
+ def call(*args)
11
+ system(path, *args)
12
+ $CHILD_STATUS
13
+ end
14
+
15
+ def path
16
+ TestTrackRailsClient::Engine.root.join("vendor", "bin", "testtrack-cli", filename).to_s
17
+ end
18
+
19
+ def filename
20
+ case host_os
21
+ when /darwin/
22
+ "testtrack.darwin"
23
+ when /linux/
24
+ "testtrack.linux"
25
+ else
26
+ raise "no testtrack binary for platform #{host_os}"
27
+ end
28
+ end
29
+
30
+ private
31
+
32
+ def host_os
33
+ RbConfig::CONFIG['host_os']
34
+ end
35
+ end
@@ -1,15 +1,33 @@
1
1
  namespace :test_track do
2
+ desc 'Run outstanding TestTrack migrations'
3
+ task migrate: :environment do
4
+ cli = TesttrackCli.instance
5
+
6
+ if cli.project_initialized?
7
+ result = cli.call('migrate')
8
+ exit(result.exitstatus) unless result.success?
9
+ end
10
+ end
11
+
2
12
  namespace :schema do
3
- desc 'Load all Identifier Types and Splits into TestTrack from the schema file'
13
+ desc 'Load schema.yml state into TestTrack server'
4
14
  task load: :environment do
5
- TestTrack.update_config do |c|
6
- c.load_schema
15
+ cli = TesttrackCli.instance
16
+
17
+ if cli.project_initialized?
18
+ result = cli.call('schema', 'load')
19
+ exit(result.exitstatus) unless result.success?
20
+ else
21
+ TestTrack.update_config do |c|
22
+ c.load_schema # Load legacy schema
23
+ end
7
24
  end
8
25
  end
9
26
  end
10
27
  end
11
28
 
12
- unless Rails.env.test?
29
+ unless Rails.env.test? || (Rails.env.development? || !TesttrackCLI.instance.project_initialized?)
13
30
  task 'db:schema:load' => ['test_track:schema:load']
14
31
  task 'db:structure:load' => ['test_track:schema:load']
32
+ task 'db:migrate' => ['test_track:migrate']
15
33
  end
@@ -1,3 +1,3 @@
1
1
  module TestTrackRailsClient
2
- VERSION = "4.0.0.alpha19" # rubocop:disable Style/MutableConstant
2
+ VERSION = "4.0.0.alpha20" # rubocop:disable Style/MutableConstant
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_track_rails_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.alpha19
4
+ version: 4.0.0.alpha20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan O'Neill
@@ -292,6 +292,7 @@ files:
292
292
  - app/models/test_track/vary_dsl.rb
293
293
  - app/models/test_track/visitor.rb
294
294
  - app/models/test_track/visitor_dsl.rb
295
+ - app/models/testtrack_cli.rb
295
296
  - app/views/tt/api/v1/identifier_visitors/show.json.jbuilder
296
297
  - app/views/tt/api/v1/identifiers/create.json.jbuilder
297
298
  - app/views/tt/api/v1/split_details/show.json.jbuilder
@@ -310,6 +311,8 @@ files:
310
311
  - lib/test_track_rails_client/engine.rb
311
312
  - lib/test_track_rails_client/rspec_helpers.rb
312
313
  - lib/test_track_rails_client/version.rb
314
+ - vendor/bin/testtrack-cli/testtrack.darwin
315
+ - vendor/bin/testtrack-cli/testtrack.linux
313
316
  - vendor/gems/fakeable_her/fakeable_her.gemspec
314
317
  - vendor/gems/fakeable_her/lib/fakeable_her.rb
315
318
  - vendor/gems/fakeable_her/lib/fakeable_her/model.rb