mini_autobot 0.0.1 → 0.0.2

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: 07bfa98f67061e2dce64bed72de1d674bb30d3b6
4
- data.tar.gz: 0fdc455f8d5bbf1ba1b25b8e91971bfb8733400e
3
+ metadata.gz: 0be74808c6604cb2f503582cc1e3a40319b7bfd3
4
+ data.tar.gz: a8fe1cdb8886edeb940b2ddde23a45d08d21e9f1
5
5
  SHA512:
6
- metadata.gz: 4c499b1873bb699eda4907a921084ad05d5cbb08fdf9f847aab0e163111bc0e50b51bd91446f3476d2831140fdef6199c102ff4ab07b80bf22c50f9e026199b3
7
- data.tar.gz: 92a4539d1dea671d6e5ba03b9f9570078d899a151e7b18381020305d897790cb0c3a07d0359a3f3a0346cafc47582249c1fbeffde92a1fda868c9796e328db60
6
+ metadata.gz: c00a2bfb63e5daf14878cdf70d14eded1ec7a69cc0b655816c433e8a3c92c1ef7bf11ee5b613485659df30194d2713a14e6090bd3313d53130d4202894e288ca
7
+ data.tar.gz: 5e74bdd9c2d39af94c5d9f678da6f07f1482b324d593ae314125e477fd5001dbc15a203dafbd577618a490802daf767ed35ce58f559be4f47ee0008441354783
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mini_autobot (0.0.0)
4
+ mini_autobot (0.0.2)
5
5
  activesupport (~> 4.2)
6
6
  faker (~> 1.4)
7
7
  google-api-client (~> 0.8)
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ task :default => :test
5
+ task :test => :spec
6
+
7
+ begin
8
+ require 'rspec/core/rake_task'
9
+ RSpec::Core::RakeTask.new(:spec) { |r| r.verbose = false }
10
+ rescue LoadError
11
+ puts '==> no rspec available'
12
+ end
@@ -39,28 +39,25 @@ module MiniAutobot
39
39
 
40
40
  # before hook where you have parsed @options when loading tests
41
41
  def self.before_run
42
- host_env = @options[:env]
43
- if host_env.nil?
44
- # TODO(phu): default host needs to be set in a user's local env file
45
- host = 'rent'
46
- puts "No argument given for option -e \nLoading tests using default host: #{host}"
47
- else
48
- host = host_env.split(/_/)[0]
49
- end
50
- self.load_tests(host)
51
- end
52
-
53
- # only load tests you need by specifying env option in command line
54
- def self.load_tests(host)
55
42
  tests_yml_full_path = MiniAutobot.root.join('config/mini_autobot', 'tests.yml').to_s
56
43
  if File.exist? tests_yml_full_path
57
- tests_yml = YAML.load_file tests_yml_full_path
58
- tests_dir_relative_path = tests_yml['tests_dir']['relative_path']
59
- multi_host_flag = tests_yml['tests_dir']['multi-host']
44
+ self.load_tests(tests_yml_full_path)
60
45
  else
61
46
  puts "Config file #{tests_yml_full_path} doesn't exist"
62
47
  puts "mini_autobot doesn't know where your tests are located and how they are structured"
63
48
  end
49
+ end
50
+
51
+ # only load tests you need by specifying env option in command line
52
+ def self.load_tests(tests_yml_full_path)
53
+ tests_yml = YAML.load_file tests_yml_full_path
54
+
55
+ self.check_config(tests_yml)
56
+
57
+ tests_dir_relative_path = tests_yml['tests_dir']['relative_path']
58
+ multi_host_flag = tests_yml['tests_dir']['multi-host']
59
+ default_host = tests_yml['tests_dir']['default_host']
60
+ host = @options[:env].split(/_/)[0] rescue default_host
64
61
 
65
62
  self.configure_load_path(tests_dir_relative_path)
66
63
 
@@ -77,6 +74,12 @@ module MiniAutobot
77
74
  end
78
75
  end
79
76
 
77
+ def self.check_config(tests_yml)
78
+ raise "relative_path must be provided in #{tests_yml}" unless tests_yml['tests_dir']['relative_path'].is_a? String
79
+ raise "multi-host must be provided in #{tests_yml}" unless [true, false].include?(tests_yml['tests_dir']['multi-host'])
80
+ raise "default_host must be provided in #{tests_yml}" unless tests_yml['tests_dir']['default_host'].is_a? String
81
+ end
82
+
80
83
  def self.configure_load_path(tests_dir_relative_path)
81
84
  tests_dir_full_path = MiniAutobot.root.join(tests_dir_relative_path).to_s
82
85
  if Dir.exist? tests_dir_full_path
@@ -10,7 +10,11 @@ module MiniAutobot
10
10
  YAML.load_file(MiniAutobot.root.join("config/mini_autobot/test_suite.yml"))
11
11
  else
12
12
  default = {"regression"=>{"tag_to_exclude"=>:non_regression}}
13
- puts "config/mini_autobot/test_suite.yml doesn't exist, using default:\n#{default}"
13
+ if MiniAutobot.root != MiniAutobot.gem_root
14
+ # Only necessary to notify gem user, not gem developer
15
+ puts "config/mini_autobot/test_suite.yml doesn't exist, using default:\n#{default}"
16
+ puts "It's recommended to have this config file as it'll avoid problem when using tapout"
17
+ end
14
18
  default
15
19
  end
16
20
 
@@ -1,3 +1,3 @@
1
1
  module MiniAutobot
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_autobot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ripta Pasay
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-08-11 00:00:00.000000000 Z
13
+ date: 2015-08-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -239,6 +239,7 @@ files:
239
239
  - Gemfile.lock
240
240
  - LICENSE
241
241
  - README.md
242
+ - Rakefile
242
243
  - bin/mini_autobot
243
244
  - lib/mini_autobot.rb
244
245
  - lib/mini_autobot/connector.rb