protractor-rails 0.0.8 → 0.0.9

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: 80b33f3dc4595f5b9c54eda75c31d1a6f01f9da6
4
- data.tar.gz: cbf20359cb8cbee1af1ee4cf05c48d32c6867b37
3
+ metadata.gz: 8fc32fad5a4153160310ef39a668be0dde0f9e71
4
+ data.tar.gz: eebf81e2741edcd7ceee76f1da6af55fbee8657d
5
5
  SHA512:
6
- metadata.gz: 0b9e22b26046a558044a380f85b8c66aa1b0625ccaf75cbccbd1a5af728ef995e736192e78db5d035507a335abb6645c328be6ea69b9a3d886afd38e48ab0978
7
- data.tar.gz: 4d9a9325a455721dde218c26ff13a8d9bfbc62bdceddd855e851e42e248e8c9bcd8b6af543864a9d72b4e23bc1cf8f3705d14ac11a817962ff5a6ada18818fb0
6
+ metadata.gz: 66ae54f75fe47bcefe7568461f3ec31cb63f5b271c6f1db7f2fc65aebd7c4d306f0cf8efb29c20a99ad0f5cde76fa4b2c38ae19e75051b5150b54e765c65e63d
7
+ data.tar.gz: a29b92fec5364dd83d29f362c4c5af4f9ed3d0d735e193caa143964a7b35e1d3434dc662d76fde68dd8694fb17e25a548e245be3f6d16d0755c10221276ce9b6
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  spec/javascripts/protractor.conf.js
3
3
  spec/javascripts/example_spec.js
4
4
  pkg
5
+ .DS_Store
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- protractor-rails (0.0.8)
4
+ protractor-rails (0.0.9)
5
5
  colorize
6
6
  railties
7
7
 
@@ -1,5 +1,6 @@
1
- require "protractor/rails/version"
1
+ require 'protractor/rails/version'
2
2
  require 'protractor/rails/railtie'
3
+ require 'protractor/rails/configuration'
3
4
 
4
5
  module Protractor
5
6
  module Rails
@@ -0,0 +1,41 @@
1
+
2
+ require 'yaml'
3
+
4
+ module Protractor
5
+ class << self
6
+ attr_accessor :configuration
7
+ end
8
+
9
+ def self.load file_name
10
+ file_name = file_name
11
+
12
+ if File.exists? file_name
13
+ file = File.read file_name
14
+ yaml = ERB.new( file ).result
15
+ data = YAML.load yaml
16
+ end
17
+
18
+ return Configuration.new data
19
+ end
20
+
21
+ def self.configuration
22
+ @configuration ||= load 'config/protractor.yml'
23
+ end
24
+
25
+ class Configuration
26
+ attr_accessor :config_path,
27
+ :startup_timeout,
28
+ :port
29
+
30
+ def initialize ( data=nil )
31
+ @data = data
32
+ @config_path = get( :config_path ) || 'spec/javascripts/protractor.conf.js'
33
+ @startup_timeout = get( :startup_timeout ) || 6
34
+ @port = get( :port ) || 4000
35
+ end
36
+
37
+ def get *keys
38
+ keys.inject( @data ) { |result, key| result.try :[], key.to_s }
39
+ end
40
+ end
41
+ end
@@ -1,5 +1,5 @@
1
1
  module Protractor
2
2
  module Rails
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
@@ -47,17 +47,17 @@ namespace :protractor do
47
47
  puts "Create spec/javascripts directory".yellow
48
48
  `mkdir spec/javascripts`
49
49
  end
50
- if !File.exist?('spec/javascripts/protractor.conf.js')
51
- puts "Creating template configuration file in spec/javascripts/protractor.conf.js".green
52
- template_path = File.expand_path('../../../spec/javascripts/templates', __FILE__)
50
+ if !File.exist? Protractor.configuration.config_path
51
+ puts "Creating template configuration file in #{Protractor.configuration.config_path}".green
52
+ template_path = File.expand_path("../../../#{Protractor.configuration.config_path}", __FILE__)
53
53
  template_conf = File.join(template_path, 'protractor.conf.js')
54
54
  template_spec = File.join(template_path, 'example_spec.js')
55
- system "cp #{template_conf} spec/javascripts/protractor.conf.js"
56
- puts "You will need to edit the spec/javascripts/protractor.conf.js file to suite your requirements."
55
+ system "cp #{template_conf} #{Protractor.configuration.config_path}"
56
+ puts "You will need to edit the #{Protractor.configuration.config_path} file to suite your requirements."
57
57
  system "cp #{template_spec} spec/javascripts/example_spec.js"
58
58
  puts "created example_spec.js in spec/javascripts. You can test it out by running rake protractor:spec"
59
59
  else
60
- puts "You already have a configuration file. If you would like to start over, remove spec/javascripts/protractor.conf.js and run rake protractor:init".red
60
+ puts "You already have a configuration file. If you would like to start over, remove #{Protractor.configuration.config_path} and run rake protractor:init".red
61
61
  end
62
62
  end
63
63
  end
@@ -17,7 +17,7 @@ namespace :protractor do |args|
17
17
  end
18
18
  end
19
19
 
20
- desc "Run specs from spec/javascripts/protractor.conf.js"
20
+ desc "Run specs from config file"
21
21
  task :spec do
22
22
  begin
23
23
  options = ''
@@ -43,8 +43,8 @@ namespace :protractor do |args|
43
43
  puts "webdriver PID: #{webdriver_pid}".yellow.bold
44
44
  puts "Rails Server PID: #{rails_server_pid}".yellow.bold
45
45
  puts "Waiting for servers to finish starting up...."
46
- sleep 6
47
- success = system "protractor #{options} spec/javascripts/protractor.conf.js"
46
+ sleep Protractor.configuration.startup_timeout
47
+ success = system "protractor #{options} #{Protractor.configuration.config_path}"
48
48
  Process.kill 'TERM', webdriver_pid
49
49
  Process.kill 'TERM', rails_server_pid
50
50
  Process.wait webdriver_pid
@@ -80,12 +80,12 @@ namespace :protractor do |args|
80
80
 
81
81
  task :kill_rails do
82
82
  puts "kill protractor rails tests server...".yellow
83
- system "ps aux | grep -ie 'rails s -e test -P tmp/pids/protractor_test_server.pid --port=4000' | awk '{print $2}' | xargs kill -9"
83
+ system "ps aux | grep -ie 'rails s -e test -P tmp/pids/protractor_test_server.pid --port=#{Protractor.configuration.port}' | awk '{print $2}' | xargs kill -9"
84
84
  end
85
85
 
86
86
  task :rails do
87
- puts "Starting Rails server on port 4000 pid file in tmp/pids/protractor_test_server.pid".green
88
- rails_command = "rails s -e test -P tmp/pids/protractor_test_server.pid --port=4000"
87
+ puts "Starting Rails server on port #{Protractor.configuration.port} pid file in tmp/pids/protractor_test_server.pid".green
88
+ rails_command = "rails s -e test -P tmp/pids/protractor_test_server.pid --port=#{Protractor.configuration.port}"
89
89
  if ENV['rails_binding'] != nil
90
90
  rails_command << " --binding #{ ENV['rails_binding'] }"
91
91
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protractor-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyrone Wilson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-23 00:00:00.000000000 Z
11
+ date: 2014-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -82,6 +82,7 @@ files:
82
82
  - Rakefile
83
83
  - lib/protractor-rails.rb
84
84
  - lib/protractor/rails.rb
85
+ - lib/protractor/rails/configuration.rb
85
86
  - lib/protractor/rails/railtie.rb
86
87
  - lib/protractor/rails/version.rb
87
88
  - lib/tasks/install.rake
@@ -111,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
112
  version: '0'
112
113
  requirements: []
113
114
  rubyforge_project:
114
- rubygems_version: 2.2.2
115
+ rubygems_version: 2.4.2
115
116
  signing_key:
116
117
  specification_version: 4
117
118
  summary: Seemlessly run protractor for angularjs in your rails app.