hold_firefox 0.1.2 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a5e255c765d9e7bc4a0b0df91941980adfb8328
4
- data.tar.gz: 4b2f4e8fa8786f499a4973a59cd7a476130eec73
3
+ metadata.gz: 4e25be26e1d8971d6b71ffcdb9100fcaf8c5bd84
4
+ data.tar.gz: 5343ca5e58ecf12c2ec52d53ad1242d8f370c544
5
5
  SHA512:
6
- metadata.gz: 1681a170835120f3acc4a3fe9323a4316b7cad3dcaf3e967d31efd5ef08cb08d28ca18f92273e61abfa0b4ec7008c34c3e70076f64c80ff825994cba5f5c0077
7
- data.tar.gz: d30119e8bf33b4b11d31a52c3201fbb6dd6af3639e8035f2c2b4617a4f0480700705e9a5c6f6b87b0cf2ba399975fb6cf3f539f77beb4c45c41e6c0ecaa64b11
6
+ metadata.gz: 8791dce8a396a5e340a8fab6146e0a90307d7bc0b0d883683884daf1c54442e72930c8ddebffd64b71611b655ff99f30a128ffe786b4c887966946afbad41f27
7
+ data.tar.gz: 2c4ed7dfe9f8228b826f37f64acdf59a84027783f6ce78cb891c5eade25ec15021ad7ccb183281cd64e4462e90a38f36efee976963ea51bb8aa96d5ec0b3e0da
@@ -14,12 +14,11 @@ Dir.chdir(File.join(root)) do
14
14
  system "rm firefox-45.0.tar.bz2"
15
15
  elsif RUBY_PLATFORM =~ /darwin/i
16
16
  unless File.exist?('/tmp/Firefox_45.0.dmg')
17
- system "wget https://ftp.mozilla.org/pub/firefox/releases/45.0/mac/pt-BR/Firefox%2045.0.dmg -O /tmp/Firefox_45.0.dmg"
17
+ system "curl -o /tmp/Firefox_45.0.dmg 'https://ftp.mozilla.org/pub/firefox/releases/45.0/mac/pt-BR/Firefox%2045.0.dmg'"
18
18
  end
19
19
  mount_path = `hdiutil attach -nobrowse -noautoopen /tmp/Firefox_45.0.dmg | grep Firefox`.split(' ').first
20
20
  system "cp -R /Volumes/Firefox/Firefox.app . "
21
21
  system "hdiutil detach #{mount_path}"
22
- #Selenium::WebDriver::Firefox::Binary.path = "/Users/andreleoni/Documents/Firefox.app/Contents/MacOS/firefox-bin"
23
22
  end
24
23
  end
25
24
 
@@ -1,3 +1,3 @@
1
1
  module HoldFirefox
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/hold_firefox.rb CHANGED
@@ -2,30 +2,30 @@ require "hold_firefox/version"
2
2
  require 'pathname'
3
3
 
4
4
  module HoldFirefox
5
- # Folder path
6
- def self.gem_path
7
- Pathname.new(File.dirname(__FILE__)).join('..', 'ext', 'hold_firefox')
8
- end
5
+ class Path
6
+ def initialize(platform)
7
+ @platform = platform
8
+ return unless allowed?
9
+ Selenium::WebDriver::Firefox::Binary.path = firefox_path
10
+ end
9
11
 
10
- # Path to Ubuntu
11
- def self.linux
12
- self.gem_path.join('firefox', 'firefox-bin').to_s
13
- end
12
+ # Folder path
13
+ def home
14
+ Pathname.new(File.dirname(__FILE__)).join('..', 'ext', 'hold_firefox')
15
+ end
14
16
 
15
- # Path to MacOSX
16
- def self.osx
17
- self.gem_path.join('Firefox.app', 'Contents', 'MacOS', 'firefox-bin').to_s
18
- end
17
+ def firefox_path
18
+ if @platform =~ /linux/i
19
+ home.join('firefox', 'firefox-bin').to_s
20
+ elsif @platform =~ /darwin/i
21
+ home.join('Firefox.app', 'Contents', 'MacOS', 'firefox-bin').to_s
22
+ end
23
+ end
19
24
 
20
- def self.setup!
21
- Selenium::WebDriver::Firefox::Binary.path = if RUBY_PLATFORM =~ /linux/i
22
- self.linux
23
- elsif RUBY_PLATFORM =~ /darwin/i
24
- self.osx
25
- else
26
- Selenium::WebDriver::Firefox::Binary.path
25
+ def allowed?
26
+ @platform =~ /linux/i || @platform =~ /darwin/i
27
27
  end
28
28
  end
29
29
  end
30
30
 
31
- HoldFirefox.setup!
31
+ HoldFirefox::Path.new(RUBY_PLATFORM)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hold_firefox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danilo Jeremias da Silva