guard-frank 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Alex Denisov
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # Guard::Frank
2
+
3
+ Guard gem for [Frank-Cucumber](http://www.testingwithfrank.com/)
4
+
5
+ ## Installation
6
+
7
+ $ gem install guard-frank
8
+
9
+ ## Usage
10
+
11
+ Add support of the frank-cucumber to your project as [described](http://www.testingwithfrank.com/installing.html).
12
+ Then go to the Xcode settings and setup Derived Data as Relative.
13
+
14
+ ![Xcode locations](https://github.com/AlexDenisov/guard-frank/blob/master/locations.png?raw=true).
15
+
16
+ When you're done, run following commands from project_path/Frank directory
17
+
18
+ $ guard init frank
19
+ $ guard
20
+
21
+ Note that Frank needs to know which target of project you want to test.
22
+ So after initilizing frank you need modify Guardfile, if neccessary.
23
+ By default Guard::Frank trying to test 'frankified' target.
24
+
@@ -0,0 +1,88 @@
1
+ require 'guard'
2
+ require 'guard/guard'
3
+ require 'guard/notifier'
4
+ #require 'frank/runner'
5
+
6
+ module Guard
7
+ class Frank < Guard
8
+
9
+ autoload :Runner, 'guard/frank/runner'
10
+
11
+ # Initialize a Guard.
12
+ # @param [Array<Guard::Watcher>] watchers the Guard file watchers
13
+ # @param [Hash] options the custom Guard options
14
+ def initialize(watchers = [], options = {})
15
+ super
16
+ @options = {
17
+ :all_on_start => true,
18
+ }.update(options)
19
+ end
20
+
21
+ # Call once when Guard starts. Please override initialize method to init stuff.
22
+ # @raise [:task_has_failed] when start has failed
23
+ def start
24
+ @runner = Runner.new @options
25
+ if @runner.nil?
26
+ @raise [:task_has_failed]
27
+ end
28
+ notify_start
29
+ run_all if @options[:all_on_start]
30
+ end
31
+
32
+ # Called when `stop|quit|exit|s|q|e + enter` is pressed (when Guard quits).
33
+ # @raise [:task_has_failed] when stop has failed
34
+ def stop
35
+ end
36
+
37
+ # Called when `reload|r|z + enter` is pressed.
38
+ # This method should be mainly used for "reload" (really!) actions like reloading passenger/spork/bundler/...
39
+ # @raise [:task_has_failed] when reload has failed
40
+ def reload
41
+ end
42
+
43
+ # Called when just `enter` is pressed
44
+ # This method should be principally used for long action like running all specs/tests/...
45
+ # @raise [:task_has_failed] when run_all has failed
46
+ def run_all
47
+ run("features")
48
+ end
49
+
50
+ # Called on file(s) modifications that the Guard watches.
51
+ # @param [Array<String>] paths the changes files or paths
52
+ # @raise [:task_has_failed] when run_on_change has failed
53
+ def run_on_change(paths)
54
+ run(paths)
55
+ end
56
+
57
+ # Called on file(s) deletions that the Guard watches.
58
+ # @param [Array<String>] paths the deleted files or paths
59
+ # @raise [:task_has_failed] when run_on_change has failed
60
+ def run_on_deletion(paths)
61
+ end
62
+
63
+
64
+ private
65
+
66
+ def run(features)
67
+ if @runner.run(features)
68
+ notify_success
69
+ else
70
+ notify_failure
71
+ end
72
+ end
73
+
74
+ def notify_start
75
+ ::Guard::Notifier.notify 'Started successfully', :title => "Frank", :image => :success
76
+ end
77
+
78
+ def notify_success
79
+ ::Guard::Notifier.notify 'Success', :title => "Frank", :image => :success
80
+ end
81
+
82
+ def notify_failure
83
+ ::Guard::Notifier.notify 'Failed', :title => "Frank", :image => :failed
84
+ end
85
+
86
+ end
87
+ end
88
+
@@ -0,0 +1,43 @@
1
+ module Guard
2
+ class Runner
3
+ attr_accessor :bundle_path
4
+ def initialize(options)
5
+ if options[:project].nil?
6
+ Dir.chdir("..")
7
+ project = Dir.glob("*.xcodeproj").first
8
+ if project
9
+ options[:project] = project.gsub(".xcodeproj","")
10
+ else
11
+ UI.info "You must specify project name at your Guardfile."
12
+ end
13
+ end
14
+ self.bundle_path = bundle(options)
15
+ end
16
+
17
+ def run(features)
18
+ unless File.exists? self.bundle_path
19
+ UI.info "Could not run Frank. \n'#{self.bundle_path}' not found."
20
+ return false
21
+ end
22
+ start_message = features.eql?("features") ? "Run all features" : "Run #{features}"
23
+ UI.info start_message
24
+ system(command(features))
25
+ end
26
+
27
+ def command(features)
28
+ "APP_BUNDLE_PATH='#{self.bundle_path}' cucumber #{features} --require features"
29
+ end
30
+
31
+ def bundle(options)
32
+ pwd = Dir::pwd
33
+ if File.exists?"Frank"
34
+ Dir.chdir("Frank")
35
+ end
36
+ project = options[:project]
37
+ target = options[:target] || "frankified"
38
+ config = options[:config] || "Debug"
39
+ device = "iphonesimulator"
40
+ bundle_path = "#{pwd}/DerivedData/#{project}/Build/Products/#{config}-#{device}/#{target}.app"
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,6 @@
1
+ guard 'frank', :project => nil, :target => 'frankified', :config => "Debug" do
2
+ watch(%r{^features/.+\.feature$})
3
+ watch(%r{^features/support/.+$}) { 'features' }
4
+ watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
5
+ end
6
+
@@ -0,0 +1,6 @@
1
+ module Guard
2
+ module FrankVersion
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
6
+
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-frank
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Alex Denisov
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-05-03 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: guard
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: frank-cucumber
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ description: "Guard::Frank automatically run frank-cucumber features for iOS "
49
+ email:
50
+ - 1101.debian@gmail.com
51
+ executables: []
52
+
53
+ extensions: []
54
+
55
+ extra_rdoc_files: []
56
+
57
+ files:
58
+ - lib/guard/frank/runner.rb
59
+ - lib/guard/frank/templates/Guardfile
60
+ - lib/guard/frank/version.rb
61
+ - lib/guard/frank.rb
62
+ - LICENSE
63
+ - README.md
64
+ homepage: https://github.com/AlexDenisov/guard-frank
65
+ licenses: []
66
+
67
+ post_install_message:
68
+ rdoc_options: []
69
+
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ hash: 57
78
+ segments:
79
+ - 1
80
+ - 8
81
+ - 7
82
+ version: 1.8.7
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ hash: 23
89
+ segments:
90
+ - 1
91
+ - 3
92
+ - 6
93
+ version: 1.3.6
94
+ requirements: []
95
+
96
+ rubyforge_project:
97
+ rubygems_version: 1.8.19
98
+ signing_key:
99
+ specification_version: 3
100
+ summary: Guard gem for frank-cucumber
101
+ test_files: []
102
+