yolo 1.1.8 → 1.1.9

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.
data/Rakefile CHANGED
@@ -5,6 +5,6 @@ namespace :gem do
5
5
  desc "Builds and then installs the gem"
6
6
  task :buildinstall do
7
7
  system 'gem build yolo.gemspec'
8
- system 'gem install yolo-1.1.1.pre.gem'
8
+ system 'gem install yolo-1.1.9.pre.gem'
9
9
  end
10
10
  end
@@ -1,5 +1,3 @@
1
- #!/usr/bin/env ruby
2
-
3
1
  require 'json'
4
2
 
5
3
  module Yolo
@@ -9,6 +9,13 @@ module Yolo
9
9
  #
10
10
  class ErrorFormatter < XcodeBuild::Formatters::ProgressFormatter
11
11
 
12
+ #
13
+ # Outputs a red string stating that the required directory paths are missing
14
+ #
15
+ def coverage_directory_error
16
+ puts red("Aborting coverage calculation, coverage requires a build path and output directory")
17
+ end
18
+
12
19
  #
13
20
  # Outputs a red string stating that the info.plist file could not be found
14
21
  #
@@ -9,6 +9,15 @@ module Yolo
9
9
  # @author [Alex Fish]
10
10
  #
11
11
  class BaseTask < XcodeBuild::Tasks::BuildTask
12
+
13
+ #
14
+ # The name to use for folders etc taken from the scheme or target name
15
+ #
16
+ # @return [String] a name
17
+ def name
18
+ self.scheme ? self.scheme : self.target
19
+ end
20
+
12
21
  #
13
22
  # Defines available rake tasks
14
23
  #
@@ -14,3 +14,4 @@ require 'yolo/tasks/ios/build'
14
14
  require 'yolo/tasks/ios/release'
15
15
  require 'yolo/tasks/ios/ocunit'
16
16
  require 'yolo/tasks/ios/calabash'
17
+ require 'yolo/tasks/ios/coverage'
@@ -0,0 +1,61 @@
1
+ module Yolo
2
+ module Tasks
3
+ module Ios
4
+ #
5
+ # Executes all code coverage related tasks
6
+ #
7
+ # @author [Alex Fish]
8
+ #
9
+ class Coverage < Yolo::Tasks::BaseTask
10
+
11
+ #
12
+ # Initializes the class with default settings
13
+ #
14
+ def initialize
15
+ @xcode = Yolo::Tools::Ios::Xcode.new
16
+ super
17
+ end
18
+
19
+ #
20
+ # Uses Xcode to find the full path to generated app file
21
+ #
22
+ # @return [String] the path to the generated .app file
23
+ def build_path
24
+ files = []
25
+ Find.find(@xcode.build_path) do |path|
26
+ files << path if path =~ /.*#{name}-.*\/Build\/Intermediates\/#{name}.build\/.*-iphoneos\/#{name}.build\/Objects-normal/
27
+ end
28
+ files.sort_by { |filename| File.mtime(filename)}.last # get the latest
29
+ end
30
+
31
+ #
32
+ # Defines rake tasks available to the Coverage class
33
+ #
34
+ def define
35
+ super
36
+ namespace :yolo do
37
+ namespace :coverage do
38
+ desc "Builds the specified scheme(s)."
39
+ task :build => :clean do
40
+ xcodebuild :build
41
+ end
42
+
43
+ desc "Calculates the specified scheme(s) test coverage."
44
+ task :calculate => :build do
45
+ Yolo::Tools::Ios::Coverage.calculate(build_path.gsub(" ", "\\ "), Dir.pwd)
46
+ end
47
+
48
+ desc "Cleans the specified scheme(s)."
49
+ task :clean do
50
+ xcodebuild :clean
51
+ end
52
+
53
+ desc "Builds the specified scheme(s) from a clean slate."
54
+ task :cleanbuild => [:clean, :build]
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -42,14 +42,6 @@ module Yolo
42
42
  files.sort_by { |filename| File.mtime(filename)}.last # get the latest
43
43
  end
44
44
 
45
- #
46
- # The name to use for folders etc taken from the scheme or target name
47
- #
48
- # @return [String] a name
49
- def name
50
- self.scheme ? self.scheme : self.target
51
- end
52
-
53
45
  #
54
46
  # The path to the applications dSYM folder, the dSYM path is calculated by
55
47
  # manipulating the app_path
@@ -14,3 +14,4 @@ require 'yolo/tools/ios/calabash'
14
14
  require 'yolo/tools/ios/xcode'
15
15
  require 'yolo/tools/ios/ipa'
16
16
  require 'yolo/tools/ios/release_notes'
17
+ require 'yolo/tools/ios/coverage'
@@ -0,0 +1,41 @@
1
+ module Yolo
2
+ module Tools
3
+ module Ios
4
+ #
5
+ # Runs test coverage calcuations using gcovr and outputs reports
6
+ #
7
+ # @author [Alex Fish]
8
+ #
9
+ module Coverage
10
+ #
11
+ # Runs gcovr and outputs reports to a defined location
12
+ # @param build_path = "" [String] The path to the build directory containing the .gcno compiler files
13
+ # @param output_dir = "" [String] Folder destination to output the report file too
14
+ #
15
+ # @return [type] [description]
16
+ def self.calculate(build_path = "", output_dir = "")
17
+ error_formatter = Yolo::Formatters::ErrorFormatter.new
18
+ if build_path.length == 0 or output_dir.length == 0
19
+ error_formatter.coverage_directory_error
20
+ return
21
+ end
22
+
23
+ IO.popen("cd #{build_path} && gcovr --xml > #{output_dir}/coverage.xml") do |io|
24
+ begin
25
+ while line = io.readline
26
+ begin
27
+ STDOUT << line
28
+ rescue StandardError => e
29
+ puts "Error from output buffer: #{e.inspect}"
30
+ puts e.backtrace
31
+ end
32
+ end
33
+ rescue EOFError
34
+ end
35
+ end
36
+ $?.exitstatus
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yolo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.8
4
+ version: 1.1.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-03 00:00:00.000000000 Z
12
+ date: 2013-04-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xcodebuild-rb
@@ -102,12 +102,14 @@ files:
102
102
  - lib/yolo/tasks/base_task.rb
103
103
  - lib/yolo/tasks/ios/build.rb
104
104
  - lib/yolo/tasks/ios/calabash.rb
105
+ - lib/yolo/tasks/ios/coverage.rb
105
106
  - lib/yolo/tasks/ios/ocunit.rb
106
107
  - lib/yolo/tasks/ios/release.rb
107
108
  - lib/yolo/tasks/ios.rb
108
109
  - lib/yolo/tasks.rb
109
110
  - lib/yolo/tools/git.rb
110
111
  - lib/yolo/tools/ios/calabash.rb
112
+ - lib/yolo/tools/ios/coverage.rb
111
113
  - lib/yolo/tools/ios/ipa.rb
112
114
  - lib/yolo/tools/ios/release_notes.rb
113
115
  - lib/yolo/tools/ios/xcode.rb