ie 0.0.3 → 0.0.4

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjBhYzIwMDFhNzI2MWE5YmQyZWFiYTI2ZTEyNzQxOTAxN2MyMWQ4Mg==
4
+ MWY3YWI4ZjRiZGNjNGY2ZDA1MWZiNmNkMjg2NjgzMThkZGQzNzE2MA==
5
5
  data.tar.gz: !binary |-
6
- M2U5M2ZkM2JhNmM0N2M1YTgzOGU3YjQyZTUwNjFhODJlYzMzMzg2ZQ==
6
+ MGZmMDJjMjJhZDE2MDIxYzA2M2IxY2M2OWNhNDI4YzY3NzlmZjJlMw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MTY2OTU0ZjdhM2EwZmMxNGVhZmU1NjkyZDJmNTBmZTNlYWZjZTg1NDc1NjY2
10
- ZTFiNzIyMGQ4OWNmNDkxMzE3Yjg2MDJlMjJjYzE2MzQ0ZGNhZTA1NjAxZTlh
11
- NTE0ODgyMzcwNDRmMmRlN2ZlMzllNGMxODUwMzEzNjdmMTkyYjU=
9
+ NzIyNzUwYWFmOTc4NmZjMzQ0NjZiZWQ1YjhmYjllYmQzMmUwZDllOTYzMGMy
10
+ YmRiNmYyMmYxNmYzZDkyNWQ5YjgwODVhMGEzZWUzNTVhNTg2YmUxYWUzMDRl
11
+ N2E2NzYwMTQwNDBmYTI0NTIzMGIxNjEyMDRiYTA3Y2EyOWNlM2I=
12
12
  data.tar.gz: !binary |-
13
- OGNmYzViMGMyNDY1ZWQ4NjE0MDNjNjEyNTJkNWUyZmNkYzhjZTlhNjRlNmYw
14
- ZThiNTdkOWRkMTliNGE2MmU3NmVhNDIzZjFiMTIyYzk4YmZmNWVjZjJmZGU5
15
- MTY2NjJkN2E2NGI5MWMzOTI1ZDZkNzQ4NzdhMGRkYzAzMTg0NjU=
13
+ ODdjZGVjZGIyMzE2ZWViZDA0M2QwYjIxOWQ5MDQ0Y2U4NzdkMmQzNjZjNzA4
14
+ ZTIyYjVmOWNhZWU0ZDE4ODhlMTM2ZDZiNGE5YTI0M2IyOGM1ZmI1YjAzYWI5
15
+ YjdiN2E0ODRiODdhZGNhOWU4MTZlMGVmZjk2YTQ1OWZlNjQzZTQ=
data/Rakefile CHANGED
@@ -1,7 +1,29 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'ie'
3
4
 
4
5
  RSpec::Core::RakeTask.new
5
6
 
6
7
  task :default => :spec
7
- task :test => :spec
8
+ task :test => :spec
9
+
10
+ namespace :ie9 do
11
+ desc "get ie9 vm ip"
12
+ task :guest_ip do
13
+ (IE.get_ie9_vm_ip.size > 0) ? (puts "found VM with name #{IE.get_ie9_vm_name}") : (puts "couldn't find VM with name #{IE.get_ie9_vm_name}")
14
+ end
15
+
16
+ desc "download IE9 and set it up"
17
+ task :setup_vm do
18
+ IE.download_ie9_vm
19
+ IE.unzip_appliance
20
+ IE.import_appliance
21
+ end
22
+
23
+ desc "run all cucumber tests against ie vm"
24
+ task :cucumber do
25
+ IE.setup_ie9_env
26
+ cucumber
27
+ IE.tear_down_ie9_env
28
+ end
29
+ end
data/ie.gemspec CHANGED
@@ -20,6 +20,5 @@ Gem::Specification.new do |spec|
20
20
  spec.add_development_dependency 'bundler', '~> 1.5'
21
21
  spec.add_development_dependency 'rake', '~> 0.9'
22
22
  spec.add_development_dependency 'rspec', '~> 2.14'
23
- spec.add_development_dependency 'curb', '~> 0.8'
24
23
  spec.add_development_dependency 'capybara', '~> 2.1'
25
24
  end
data/lib/ie/ie.rb CHANGED
@@ -1,77 +1,92 @@
1
1
 
2
2
  module IE
3
- def self.download_ie9_vm
4
- puts 'downloading win7 IE9 image...'
5
- responses = {}
6
- base_url = "http://www.modern.ie/vmdownload?platform=mac&virtPlatform=virtualbox&browserOS=IE9-Win7&filename=VirtualBox/IE9_Win7/Mac/IE9.Win7.For.MacVirtualBox.part"
7
- requests = ["#{base_url}1.sfx", "#{base_url}2.rar", "#{base_url}3.rar", "#{base_url}4.rar"]
8
-
9
- m = Curl::Multi.new
10
-
11
- requests.each do |url|
12
- responses[url] = ""
13
- c = Curl::Easy.new(url) do |curl|
14
- curl.follow_location = true
15
- curl.on_body{|data| responses[url] << data; data.size }
16
- curl.on_success {|easy| puts "download finished successfully" }
17
- curl.on_failure {|easy| puts "download failed" }
18
- end
19
- m.add(c)
20
- end
3
+ IE9_VM_NAME = "IE9 - Win7"
4
+ DOWNLOAD_DIR = 'tmp'
5
+ DEPENDENCIES = ['vagrant', 'VBoxManage', 'awk', 'curl', 'unrar']
6
+ CMD_SUCCESSFUL = 0
7
+ CMD_FAILED= 1
21
8
 
22
- m.perform
23
- end
9
+ def self.get_ie9_vm_name
10
+ IE9_VM_NAME
11
+ end
24
12
 
13
+ def self.get_ie9_vm_ip
14
+ `VBoxManage guestproperty get "#{IE9_VM_NAME}" '/VirtualBox/GuestInfo/Net/0/V4/IP' | awk '{print $NF}'`[0..-2]
15
+ end
25
16
 
26
- def self.unzip_image
27
- puts 'unziping image...'
28
- system "chmod +x IE9.Win7.For.MacVirtualBox.part1.sfx"
29
- system "./IE9.Win7.For.MacVirtualBox.part1.sfx"
30
- end
17
+ def self.get_host_ip
18
+ `ifconfig en0 inet | grep inet | awk '{print $2}'`
19
+ end
31
20
 
32
- def self.check_for_vm(vm_name)
33
- puts "checking for vm with name #{vm_name}"
34
- system "VboxManage list vms | grep 'IE9 - Win7' | awk '{ print $1 $2 $3}'"
35
- end
21
+ def self.setup_ie9_env
22
+ ENV[IE9_VM_NAME] = get_ie9_vm_ip
36
23
 
37
- def self.import_appliance
38
- puts 'importing appliance'
39
- system "VboxManage import 'IE9 - Win7.ova'"
40
- end
24
+ if ENV[IE9_VM_NAME].present? and ( ENV[IE9_VM_NAME].size > 0 )
25
+ puts "configuring selenium driver to point to #{IE9_VM_NAME} VM at #{ENV[IE9_VM_NAME]}"
26
+ selenium_server_url = "http://#{ie_vm_ip}:4444/wd/hub"
41
27
 
42
- def self.clean_up
43
- puts 'cleaning up'
44
- system "rm *.rar *.sfx"
28
+ Capybara.register_driver :selenium do |app|
29
+ Capybara::Selenium::Driver.new(app,
30
+ :browser => :remote,
31
+ :url => selenium_server_url,
32
+ :desired_capabilities => :internet_explorer
33
+ )
34
+ end
45
35
  end
36
+ end
37
+
38
+ def self.tear_down_ie9_env
39
+ ENV[IE9_VM_NAME] = ""
40
+ Capybara.default_driver = :selenium
41
+ end
42
+
43
+ def self.download_ie9_vm
44
+ Dir.mkdir(DOWNLOAD_DIR) unless Dir.entries('.').include?(DOWNLOAD_DIR)
45
+ mac_os? ? download_ie_vm() : puts("Sorry ie gem currently only supports mac os")
46
+ end
46
47
 
48
+ def self.download_ie_vm(ie_version=9)
49
+ Dir.chdir(DOWNLOAD_DIR)
50
+ puts "getting ready to download and setup IE#{ie_version} vm...this takes ~ 14 mins "
51
+ `curl -O -L "http://www.modern.ie/vmdownload?platform=mac&virtPlatform=virtualbox&browserOS=IE9-Win7&parts=4&filename=VMBuild_20131127/VirtualBox/IE9_Win7/Mac/IE9.Win7.For.MacVirtualBox.part{1.sfx,2.rar,3.rar,4.rar}"`
52
+ end
47
53
 
48
- def self.setup_for_ie9
49
- ie_vm_ip = ENV['IE9_VM_IP']
50
- if ie_vm_ip.present?
51
- selenium_server_url = "http://#{ie_vm_ip}:4444/wd/hub"
54
+ def self.unzip_appliance
55
+ puts "unziping appliance..."
56
+ system "chmod +x *.sfx"
57
+ system "unrar e IE9.Win7.For.MacVirtualBox.part1.sfx"
58
+ end
52
59
 
53
- Capybara.register_driver :selenium do |app|
54
- Capybara::Selenium::Driver.new(app,
55
- :browser => :remote,
56
- :url => selenium_server_url,
57
- :desired_capabilities => :internet_explorer
58
- )
59
- end
60
+ def self.import_appliance
61
+ appliance_path = "#{IE9_VM_NAME}.ova"
62
+ if ie_vm_exists?
63
+ puts "vm with name #{IE9_VM_NAME} already exists!"
64
+ else
65
+ puts "importing '#{appliance_path}' as appliance..."
66
+ system "VboxManage import '#{appliance_path}'"
67
+ end
68
+ end
69
+
70
+ def self.ie_vm_exists?
71
+ `VBoxManage list vms | grep '#{IE9_VM_NAME}' | awk '{ print $1 $2 $3}'` == "IE9-Win7"
72
+ end
73
+
74
+ def self.dependencies_met?
75
+ missing_dependencies = []
76
+ puts "checking command line tools dependencies...."
77
+ DEPENDENCIES.each do |command_line_tool|
78
+ tool_exists = system "which #{command_line_tool}"
79
+ if tool_exists
80
+ puts "#{command_line_tool} dependency met"
81
+ else
82
+ missing_dependencies << command_line_tool
60
83
  end
61
84
  end
85
+ puts "Please install the following missing dependencies: \n #{missing_dependencies}" if (missing_dependencies.size > 0)
86
+ end
62
87
 
63
- def override_localhost_on_vm
64
- ##get host ip
65
- #host_ip=`ifconfig en0 inet | grep inet | awk '{print $2}'`
66
- #echo "host ip is $host_ip"
67
- #
68
- ##get guest ip
69
- #guest_ip=`VBoxManage guestproperty get "IE9 - Win7" '/VirtualBox/GuestInfo/Net/0/V4/IP' | awk '{
70
- #echo "guest ip is $guest_ip"
71
- #
72
- #
73
- ##create workdir
74
- #sshpass -p Passw0rd! ssh ieuser@$guest_ip -p 2222 "mkdir workdir || echo \"directory already exists"
88
+ def self.mac_os?
89
+ (/darwin/ =~ RUBY_PLATFORM) != nil
75
90
  end
76
91
 
77
92
  end
@@ -0,0 +1,21 @@
1
+ class UrlBuilder
2
+ #platform=mac&virtPlatform=virtualbox&browserOS=IE9-Win7&filename=VirtualBox/IE9_Win7/Mac/
3
+ #parts = ["IE9.Win7.For.MacVirtualBox.part1.sfx", "IE9.Win7.For.MacVirtualBox.part2.rar", "IE9.Win7.For.MacVirtualBox.part3.rar", "IE9.Win7.For.MacVirtualBox.part4.rar"]
4
+
5
+ BASE_URL = "http://www.modern.ie/vmdownload?"
6
+ PLATFORM = "mac"
7
+ VIRT_PLATFORM = "virtualbox"
8
+ BROWSER_OS = "IE9-Win7"
9
+ FILENAME = "VirtualBox/IE9_Win7/Mac/IE9.Win7.For.MacVirtualBox.part{1.sfx,2.rar,3.rar,4.rar}"
10
+
11
+ def initialize
12
+ self.url = BASE_URL
13
+ end
14
+
15
+ def platform
16
+ self.platform = PLATFORM
17
+ end
18
+
19
+
20
+
21
+ end
data/lib/ie/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module IE
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/spec/lib/ie_spec.rb CHANGED
@@ -2,15 +2,5 @@ require_relative '../spec_helper'
2
2
 
3
3
  describe IE do
4
4
  describe "setup" do
5
- before :each do
6
- ENV.stub(:[]).with("IE9_VM_IP").and_return("1.2.3.4")
7
- end
8
-
9
- it "should assign the environment variable for ie9 if it exists" do
10
- ENV["IE9_VM_IP"].should == "1.2.3.4"
11
- end
12
- end
13
-
14
- describe "download_ie9_vm" do
15
5
  end
16
6
  end
data/spec/spec_helper.rb CHANGED
@@ -1,2 +1 @@
1
- require 'ie/ie'
2
- require 'curl'
1
+ require 'ie'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nii
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-31 00:00:00.000000000 Z
11
+ date: 2014-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.14'
55
- - !ruby/object:Gem::Dependency
56
- name: curb
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- version: '0.8'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ~>
67
- - !ruby/object:Gem::Version
68
- version: '0.8'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: capybara
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -95,6 +81,7 @@ files:
95
81
  - ie.gemspec
96
82
  - lib/ie.rb
97
83
  - lib/ie/ie.rb
84
+ - lib/ie/url_builder.rb
98
85
  - lib/ie/version.rb
99
86
  - spec/lib/ie_spec.rb
100
87
  - spec/spec_helper.rb