hold_firefox 0.1.0 → 0.1.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: d0d15af50396cff13e1bce63ac4b35d96dd3d404
4
- data.tar.gz: 81b25f0e8a58df83a88c13901738d4ea77a9d621
3
+ metadata.gz: 5a5e255c765d9e7bc4a0b0df91941980adfb8328
4
+ data.tar.gz: 4b2f4e8fa8786f499a4973a59cd7a476130eec73
5
5
  SHA512:
6
- metadata.gz: 2640cc8babfb4584be068ebffa0da7683eebb57b774e85377e86263337703b4c04a5762e7db3963eb7aee34291fabb5f4c92feab0c9b9e9f25c120c7036a4f02
7
- data.tar.gz: 5aaa34d693b7f69b383e68e447c6a59d584d8472d49730ddac7e8b9c059ae1b67c4a182168259e1ced37e19398d3dab6a18285052ea4e0c4b3df91af9d62d7aa
6
+ metadata.gz: 1681a170835120f3acc4a3fe9323a4316b7cad3dcaf3e967d31efd5ef08cb08d28ca18f92273e61abfa0b4ec7008c34c3e70076f64c80ff825994cba5f5c0077
7
+ data.tar.gz: d30119e8bf33b4b11d31a52c3201fbb6dd6af3639e8035f2c2b4617a4f0480700705e9a5c6f6b87b0cf2ba399975fb6cf3f539f77beb4c45c41e6c0ecaa64b11
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.gem
data/README.md CHANGED
@@ -20,6 +20,8 @@ Or install it yourself as:
20
20
 
21
21
  $ gem install hold_firefox
22
22
 
23
+ Tested on Ubuntu, MacOSX.
24
+
23
25
  ## Development
24
26
 
25
27
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -4,13 +4,22 @@ create_makefile 'hold_firefox'
4
4
  exit if RUBY_PLATFORM =~ /mswin/i || RUBY_PLATFORM =~ /win32/i || RUBY_PLATFORM =~ /mingw/
5
5
 
6
6
  root = File.expand_path('..', __FILE__)
7
-
8
7
  Dir.chdir(File.join(root)) do
9
- unless File.exist?('/tmp/firefox-45.0.tar.bz2')
10
- system "wget https://ftp.mozilla.org/pub/firefox/releases/45.0/linux-x86_64/pt-BR/firefox-45.0.tar.bz2 -O /tmp/firefox-45.0.tar.bz2"
8
+ if RUBY_PLATFORM =~ /linux/i
9
+ unless File.exist?('/tmp/firefox-45.0.tar.bz2')
10
+ system "wget https://ftp.mozilla.org/pub/firefox/releases/45.0/linux-x86_64/pt-BR/firefox-45.0.tar.bz2 -O /tmp/firefox-45.0.tar.bz2"
11
+ end
12
+ system "cp /tmp/firefox-45.0.tar.bz2 firefox-45.0.tar.bz2"
13
+ system "tar -jxvf firefox-45.0.tar.bz2"
14
+ system "rm firefox-45.0.tar.bz2"
15
+ elsif RUBY_PLATFORM =~ /darwin/i
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"
18
+ end
19
+ mount_path = `hdiutil attach -nobrowse -noautoopen /tmp/Firefox_45.0.dmg | grep Firefox`.split(' ').first
20
+ system "cp -R /Volumes/Firefox/Firefox.app . "
21
+ system "hdiutil detach #{mount_path}"
22
+ #Selenium::WebDriver::Firefox::Binary.path = "/Users/andreleoni/Documents/Firefox.app/Contents/MacOS/firefox-bin"
11
23
  end
12
- system "cp /tmp/firefox-45.0.tar.bz2 firefox-45.0.tar.bz2"
13
- system "tar -jxvf firefox-45.0.tar.bz2"
14
- system "rm firefox-45.0.tar.bz2"
15
24
  end
16
25
 
@@ -1,3 +1,3 @@
1
1
  module HoldFirefox
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/hold_firefox.rb CHANGED
@@ -2,9 +2,30 @@ require "hold_firefox/version"
2
2
  require 'pathname'
3
3
 
4
4
  module HoldFirefox
5
- # Your code goes here...
6
- end
5
+ # Folder path
6
+ def self.gem_path
7
+ Pathname.new(File.dirname(__FILE__)).join('..', 'ext', 'hold_firefox')
8
+ end
9
+
10
+ # Path to Ubuntu
11
+ def self.linux
12
+ self.gem_path.join('firefox', 'firefox-bin').to_s
13
+ end
7
14
 
8
- if RUBY_PLATFORM =~ /linux/i
9
- Selenium::WebDriver::Firefox::Binary.path = Selenium::WebDriver::Firefox::Binary.path = Pathname.new(File.dirname(__FILE__)).join('..', 'ext', 'hold_firefox', 'firefox', 'firefox-bin').to_s
15
+ # Path to MacOSX
16
+ def self.osx
17
+ self.gem_path.join('Firefox.app', 'Contents', 'MacOS', 'firefox-bin').to_s
18
+ end
19
+
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
27
+ end
28
+ end
10
29
  end
30
+
31
+ HoldFirefox.setup!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hold_firefox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danilo Jeremias da Silva
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-15 00:00:00.000000000 Z
11
+ date: 2016-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler