xtctimer 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ebae4249ec61bbbed43f6b586200f7db87555697
4
+ data.tar.gz: e98d6e28f05df7abd6a4179a26cb2051d1d89e32
5
+ SHA512:
6
+ metadata.gz: e7440d0a4cfc541c9a51fab5784a9395c4d775985d7ad5a4796cb0dc5e5f8178be4ebf14bfe2f370930b598e2c012c5cc05818a375abf1ac86e5a2157ab80d01
7
+ data.tar.gz: 0e97facbc128acfc9124e2dd50ca9c6f9a7285160832a21ac042330e08bfc626a0494147cd4fc676813949a660b6148a7e392c1d005eaf7008052a4564e0c4b7
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.idea/misc.xml ADDED
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectLevelVcsManager" settingsEditedManually="false">
4
+ <OptionsSetting value="true" id="Add" />
5
+ <OptionsSetting value="true" id="Remove" />
6
+ <OptionsSetting value="true" id="Checkout" />
7
+ <OptionsSetting value="true" id="Update" />
8
+ <OptionsSetting value="true" id="Status" />
9
+ <OptionsSetting value="true" id="Edit" />
10
+ <ConfirmationsSetting value="0" id="Add" />
11
+ <ConfirmationsSetting value="0" id="Remove" />
12
+ </component>
13
+ <component name="ProjectRootManager" version="2" project-jdk-name="ruby-2.0.0-p481" project-jdk-type="RUBY_SDK" />
14
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/xtctimer.iml" filepath="$PROJECT_DIR$/.idea/xtctimer.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,43 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <option name="TRACKING_ENABLED" value="true" />
5
+ <option name="SHOW_DIALOG" value="false" />
6
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
7
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
8
+ <option name="LAST_RESOLUTION" value="IGNORE" />
9
+ </component>
10
+ <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
11
+ <component name="CreatePatchCommitExecutor">
12
+ <option name="PATCH_PATH" value="" />
13
+ </component>
14
+ <component name="NamedScopeManager">
15
+ <order />
16
+ </component>
17
+ <component name="ProjectLevelVcsManager" settingsEditedManually="false">
18
+ <OptionsSetting value="true" id="Add" />
19
+ <OptionsSetting value="true" id="Remove" />
20
+ <OptionsSetting value="true" id="Checkout" />
21
+ <OptionsSetting value="true" id="Update" />
22
+ <OptionsSetting value="true" id="Status" />
23
+ <OptionsSetting value="true" id="Edit" />
24
+ <ConfirmationsSetting value="0" id="Add" />
25
+ <ConfirmationsSetting value="0" id="Remove" />
26
+ </component>
27
+ <component name="ShelveChangesManager" show_recycled="false" />
28
+ <component name="TaskManager">
29
+ <task active="true" id="Default" summary="Default task">
30
+ <created>1430180886563</created>
31
+ <option name="number" value="Default" />
32
+ <updated>1430180886563</updated>
33
+ </task>
34
+ <servers />
35
+ </component>
36
+ <component name="VcsContentAnnotationSettings">
37
+ <option name="myLimit" value="2678400000" />
38
+ </component>
39
+ <component name="XDebuggerManager">
40
+ <breakpoint-manager />
41
+ <watches-manager />
42
+ </component>
43
+ </project>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="FacetManager">
4
+ <facet type="gem" name="Ruby Gem">
5
+ <configuration>
6
+ <option name="GEM_APP_ROOT_PATH" value="$MODULE_DIR$" />
7
+ <option name="GEM_APP_TEST_PATH" value="" />
8
+ <option name="GEM_APP_LIB_PATH" value="$MODULE_DIR$/lib" />
9
+ </configuration>
10
+ </facet>
11
+ </component>
12
+ <component name="NewModuleRootManager">
13
+ <content url="file://$MODULE_DIR$" />
14
+ <orderEntry type="inheritedJdk" />
15
+ <orderEntry type="sourceFolder" forTests="false" />
16
+ <orderEntry type="library" scope="PROVIDED" name="rake (v10.4.2, ruby-2.0.0-p481) [gem]" level="application" />
17
+ </component>
18
+ </module>
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in xtctimer.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Xtctimer
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/xtctimer`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'xtctimer'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install xtctimer
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ 1. Fork it ( https://github.com/[my-github-username]/xtctimer/fork )
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "xtctimer"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,3 @@
1
+ module Xtctimer
2
+ VERSION = "0.0.1"
3
+ end
data/lib/xtctimer.rb ADDED
@@ -0,0 +1,73 @@
1
+ require 'xtctimer/version'
2
+ require 'net/http'
3
+ require 'json'
4
+ require 'uri'
5
+ require 'openssl'
6
+ require 'time'
7
+ require 'xtc/timer/version'
8
+
9
+ module Xtctimer
10
+ class Timer
11
+ BASE_URL = "http://xtc-timings.azurewebsites.net/"
12
+
13
+ attr_reader :guid
14
+ attr_reader :scenario
15
+ attr_reader :isTestCloud
16
+ attr_reader :isAndroid
17
+ attr_reader :device
18
+ attr_reader :runTime
19
+ attr_reader :startTime
20
+
21
+ def initialize(guid, scenario, isTestCloud, isAndroid, device = "Local device")
22
+ @guid = guid
23
+ @scenario = scenario
24
+ @isTestCloud = isTestCloud
25
+ @isAndroid = isAndroid
26
+ @device = device
27
+
28
+ @runTime = nil
29
+ end
30
+
31
+ def start()
32
+ @startTime = Time.now
33
+ end
34
+
35
+ def finish()
36
+ endTime = Time.now
37
+ @runTime = endTime - startTime
38
+ post(self)
39
+ puts "Ended timer. Elapsed: #{@runTime}"
40
+ end
41
+
42
+ private
43
+ def post(timer)
44
+ postUrl = "#{BASE_URL}api/timingentry"
45
+
46
+ puts postUrl
47
+
48
+ uri = URI.parse(postUrl)
49
+ http = Net::HTTP.new(uri.host, uri.port)
50
+ request = Net::HTTP::Post.new(postUrl, initheader = {'Content-Type' => 'application/json'})
51
+
52
+ timing = {
53
+ 'Guid' => timer.guid,
54
+ 'Scenario' => timer.scenario,
55
+ 'RunTime' => format(timer.runTime),
56
+ 'IsTestCloud' => timer.isTestCloud,
57
+ 'Platform' => timer.isAndroid,
58
+ 'Framework' => 1, # Calabash, not UITest.
59
+ 'DeviceString' => timer.device
60
+ }
61
+
62
+ print timing.to_json
63
+
64
+ request.body = timing.to_json
65
+ response = http.request(request)
66
+ end
67
+
68
+ private
69
+ def format(t)
70
+ Time.at(t).gmtime.strftime("%H:%M:%S.%7N")
71
+ end
72
+ end
73
+ end
data/xtctimer.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'xtctimer/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "xtctimer"
8
+ spec.version = Xtctimer::VERSION
9
+ spec.authors = ["danwaters"]
10
+ spec.email = ["dan.waters@xamarin.com"]
11
+
12
+ spec.summary = %q{Helps us test timings}
13
+ spec.description = %q{Helps us collect timings}
14
+ spec.homepage = "http://www.xamarin.com/test-cloud"
15
+
16
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17
+ # delete this section to allow pushing this gem to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
22
+ end
23
+
24
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_development_dependency "bundler", "~> 1.9"
30
+ spec.add_development_dependency "rake", "~> 10.0"
31
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xtctimer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - danwaters
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-04-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Helps us collect timings
42
+ email:
43
+ - dan.waters@xamarin.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - .idea/misc.xml
50
+ - .idea/modules.xml
51
+ - .idea/vcs.xml
52
+ - .idea/workspace.xml
53
+ - .idea/xtctimer.iml
54
+ - .travis.yml
55
+ - Gemfile
56
+ - README.md
57
+ - Rakefile
58
+ - bin/console
59
+ - bin/setup
60
+ - lib/xtctimer.rb
61
+ - lib/xtctimer/version.rb
62
+ - xtctimer.gemspec
63
+ homepage: http://www.xamarin.com/test-cloud
64
+ licenses: []
65
+ metadata:
66
+ allowed_push_host: 'TODO: Set to ''http://mygemserver.com'''
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 2.0.14
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: Helps us test timings
87
+ test_files: []