rake_ci_tools 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rake_ci_tools/runners/calabash.rb +17 -0
- data/lib/rake_ci_tools/runners/sh.rb +17 -0
- data/lib/rake_ci_tools/runners/vagrant.rb +57 -0
- data/lib/rake_ci_tools/runners/xcode.rb +26 -0
- data/lib/rake_ci_tools/tasks/calabash_task.rb +24 -0
- data/lib/rake_ci_tools/tasks/cucumber_task.rb +25 -0
- data/lib/rake_ci_tools/tasks/deploy_tasks.rb +6 -0
- data/lib/rake_ci_tools/tasks/vagrant_task.rb +19 -0
- data/lib/rake_ci_tools/tasks/xcode_task.rb +17 -0
- data/lib/rake_ci_tools.rb +15 -0
- metadata +13 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c31c3f84945542a41aadc1be037ce954c445b0e2
|
4
|
+
data.tar.gz: c055c4d3a4d947f97a8e99f522e4885625ad0abe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdc601f13dee4b9be9c5aa99b93da55a734d1e7bbc03e74cae60a242a27499ce842c30bb626e37623e467d98775c32eae356e119ec5716f63c21b66bb0858923
|
7
|
+
data.tar.gz: c644b69d7393ec6a29a55996626aaa31913e96bac1bcc32e4edd6b2321f475f92123add16ce2bb404e373abc14b7785f8377b3614e2ff6af685899a6c763666f
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Calabash_Runner
|
2
|
+
def self.enable_accessibility
|
3
|
+
sh 'calabash-ios sim acc'
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.reset_simulator
|
7
|
+
sh 'calabash-ios sim reset'
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.sim_location(bundle_id)
|
11
|
+
sh "calabash-ios sim location on #{bundle_id}"
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.close_simulator
|
15
|
+
sh "/usr/bin/osascript -e 'tell app \"iPhone Simulator\" to quit'"
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Kernel
|
2
|
+
#Define sh runner
|
3
|
+
def sh(*cmd, &block)
|
4
|
+
if Hash === cmd.last then
|
5
|
+
options = cmd.pop
|
6
|
+
else
|
7
|
+
options = {}
|
8
|
+
end
|
9
|
+
unless block_given?
|
10
|
+
block = lambda { |ok, status|
|
11
|
+
ok or fail "Command failed with status (#{status.exitstatus}): [#{cmd.join(" ")}]"
|
12
|
+
}
|
13
|
+
end
|
14
|
+
res = system(*cmd)
|
15
|
+
block.call(res, $?)
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Vagrant
|
2
|
+
def self.task(box_name, tasks=[], project_location='./')
|
3
|
+
begin
|
4
|
+
puts "Creating Vagrantbox for Process ID: $$"
|
5
|
+
create_box(box_name)
|
6
|
+
copy_file_to_guest(project_location,box_name)
|
7
|
+
tasks.each { |task| command(task,box_name) }
|
8
|
+
ensure
|
9
|
+
destroy_box(box_name)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.remoteLocation
|
14
|
+
ENV['VAGANT_REMOTE_DEST'] || 'vagrant_build'
|
15
|
+
end
|
16
|
+
|
17
|
+
#ALL BELOW UNTESTED REFACTOR
|
18
|
+
def self.create_box(box_name)
|
19
|
+
sh "vagrant up #{box_name} --provision"
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.destroy_box(box_name)
|
23
|
+
puts "Destorying: #{box_name}"
|
24
|
+
begin
|
25
|
+
get_file_from_guest('./',"#{remoteLocation}/ci-artifacts",box_name)
|
26
|
+
ensure
|
27
|
+
sh "vagrant destroy -f #{box_name}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.command(command, box_name)
|
32
|
+
sh "vagrant ssh #{box_name} --command \"cd #{remoteLocation} && #{command}\""
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.copy_file_to_guest(localLocation, box_name)
|
36
|
+
serverIp = get_ssh_details(/(?<=HostName ).*/, box_name)
|
37
|
+
scp(localLocation,"vagrant@#{serverIp}:#{remoteLocation}", box_name)
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.get_file_from_guest(localLocation, box_name)
|
41
|
+
serverIp = get_ssh_details(/(?<=HostName ).*/,box_name)
|
42
|
+
scp("vagrant@#{serverIp}:#{remoteLocation}",localLocation,box_name)
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.scp(from, to, box_name)
|
46
|
+
portNum = get_ssh_details(/(?<=Port ).*/,box_name)
|
47
|
+
keyPath = get_ssh_details(/(?<=IdentityFile ).*/,box_name)
|
48
|
+
|
49
|
+
puts "PortNum: #{portNum}"
|
50
|
+
sh "scp -o 'StrictHostKeyChecking no' -i #{keyPath} -P #{portNum} -r #{from} #{to}"
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.get_ssh_details(regex, box_name)
|
54
|
+
response = `vagrant ssh-config #{box_name}`
|
55
|
+
return response.match(regex)
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module XCode
|
2
|
+
def self.build(workspace, scheme, configuration, sdk, build_dir)
|
3
|
+
if workspace.nil? || scheme.nil? || configuration.nil? || sdk.nil? || build_dir.nil?
|
4
|
+
raise(ArgumentError, "parameters can't be nil")
|
5
|
+
end
|
6
|
+
|
7
|
+
sh "xcodebuild -workspace '#{workspace}' -scheme '#{scheme}' -configuration '#{configuration}' -sdk '#{sdk}' CONFIGURATION_BUILD_DIR=#{build_dir}"
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.build_and_test(workspace, scheme, configuration, destination)
|
11
|
+
if workspace.nil? || scheme.nil? || configuration.nil? || destination.nil?
|
12
|
+
raise(ArgumentError, "parameters can't be nil")
|
13
|
+
end
|
14
|
+
|
15
|
+
sh "xcodebuild test -workspace '#{workspace}' -scheme '#{scheme}' -configuration '#{configuration}' -destination '#{destination}'"
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.archive(workspace, scheme, configuration, sdk, provisioning_profile, build_dir)
|
19
|
+
if workspace.nil? || scheme.nil? || provisioning_profile.nil? || configuration.nil? || build_dir.nil?
|
20
|
+
raise(ArgumentError, "parameters can't be nil")
|
21
|
+
end
|
22
|
+
|
23
|
+
build(workspace, scheme, configuration, sdk, build_dir)
|
24
|
+
sh "/usr/bin/xcrun -sdk iphoneos PackageApplication -v '#{build_dir}/#{scheme}.app' -o '#{build_dir}/#{scheme}.ipa' --embed '#{provisioning_profile}'"
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'calabash-cucumber'
|
2
|
+
|
3
|
+
namespace :calabash do
|
4
|
+
|
5
|
+
desc "Reset Simulator Content and Settings"
|
6
|
+
task :reset_simulator do
|
7
|
+
Calabash_Runner::reset_simulator
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "Enable Accessibility On Simulator"
|
11
|
+
task :enable_accessibility do
|
12
|
+
Calabash_Runner::enable_accessibility
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "Disable Location Dialog On Simulator"
|
16
|
+
task :disable_location_dialog , :bundle_id do |_,args|
|
17
|
+
Calabash_Runner::sim_location(args[:bundle_id])
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "Close the Simulator"
|
21
|
+
task :close_simulator do
|
22
|
+
Calabash_Runner::close_simulator
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'cucumber'
|
2
|
+
require 'cucumber/rake/task'
|
3
|
+
|
4
|
+
namespace :cucumber do
|
5
|
+
desc "Run Cucumber Tests"
|
6
|
+
task :run, [:parameters] do |_ , args|
|
7
|
+
args.with_defaults(:parameters=>nil)
|
8
|
+
Cucumber::Rake::Task.new do |t|
|
9
|
+
t.fork = false
|
10
|
+
t.cucumber_opts = args[:parameters] unless args[:parameters].nil?
|
11
|
+
t.runner.run
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "Run Cucumber with profile"
|
16
|
+
task :profile, [:profile,:features] do |_ , args|
|
17
|
+
raise(ArgumentError, "Profile must be defined") if args[:profile].nil?
|
18
|
+
Cucumber::Rake::Task.new do |t|
|
19
|
+
t.fork = false
|
20
|
+
t.cucumber_opts = args[:features] unless args[:features].nil?
|
21
|
+
t.profile = args[:profile]
|
22
|
+
t.runner.run
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
namespace :vagrant do
|
2
|
+
task :ios_cucumber_tests, :box_name do |_, args|
|
3
|
+
args.with_defaults(:box_name=>'default')
|
4
|
+
task_list = []
|
5
|
+
task_list << 'bundle'
|
6
|
+
task_list << 'rake setup'
|
7
|
+
task_list << 'rake build'
|
8
|
+
|
9
|
+
feature_list = ENV['FEATURE_LIST'] || ''
|
10
|
+
|
11
|
+
if feature_list.empty?
|
12
|
+
task_list << "rake cucumber:profile['ios']"
|
13
|
+
else
|
14
|
+
task_list << "rake cucumber:profile['ios','#{feature_list}']"
|
15
|
+
end
|
16
|
+
|
17
|
+
Vagrant::task(args[:box_name], task_list)
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
namespace :xcode do
|
2
|
+
desc "Xcode Build"
|
3
|
+
task :build, [:workspace, :scheme, :configuration, :sdk, :buildDir] do |_, args|
|
4
|
+
args.with_defaults(:sdk => 'iphonesimulator', :buildDir => 'ci-artifacts')
|
5
|
+
XCode::build(args[:workspace],args[:scheme],args[:configuration],args[:sdk],args[:buildDir])
|
6
|
+
end
|
7
|
+
|
8
|
+
desc "Xcode Test"
|
9
|
+
task :build_test, [:workspace, :scheme, :configuration, :destinations] do |_ , args|
|
10
|
+
XCode::build_and_test(args[:workspace],args[:scheme],args[:configuration],args[:destinations])
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "Achieve ipa"
|
14
|
+
task :archive, [:workspace, :scheme, :configuration, :sdk, :provisioning_profile, :destinations] do |_ , args|
|
15
|
+
XCode::archive(args[:workspace],args[:scheme],args[:configuration],args[:sdk],args[:provisioning_profile],args[:destinations])
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
base_path = File.join(File.dirname(__FILE__),'rake_ci_tools')
|
2
|
+
|
3
|
+
require 'rake'
|
4
|
+
|
5
|
+
require File.join(base_path, 'tasks', 'cucumber_task')
|
6
|
+
require File.join(base_path, 'tasks', 'xcode_task')
|
7
|
+
require File.join(base_path, 'tasks', 'vagrant_task')
|
8
|
+
require File.join(base_path, 'tasks', 'calabash_task')
|
9
|
+
# require File.join(base_path, 'tasks', 'deploy_tasks')
|
10
|
+
|
11
|
+
require File.join(base_path, 'runners', 'sh')
|
12
|
+
require File.join(base_path, 'runners', 'xcode')
|
13
|
+
require File.join(base_path, 'runners', 'vagrant')
|
14
|
+
require File.join(base_path, 'runners', 'calabash')
|
15
|
+
# require File.join(base_path, 'runners', 'deploy')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake_ci_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chris griffiths
|
@@ -124,13 +124,23 @@ dependencies:
|
|
124
124
|
version: '1.5'
|
125
125
|
description: " Predined Rake tasks for building, testing and deploying xcode projects\n
|
126
126
|
\ Includes Support for: - XCode: Build, Test\n - Cucumber:
|
127
|
-
calabash\n -
|
127
|
+
calabash\n - Vagrant: Run Cucumber inside Vagrantbox \n"
|
128
128
|
email:
|
129
129
|
- christopher_griffiths@hotmail.com
|
130
130
|
executables: []
|
131
131
|
extensions: []
|
132
132
|
extra_rdoc_files: []
|
133
|
-
files:
|
133
|
+
files:
|
134
|
+
- lib/rake_ci_tools.rb
|
135
|
+
- lib/rake_ci_tools/runners/calabash.rb
|
136
|
+
- lib/rake_ci_tools/runners/sh.rb
|
137
|
+
- lib/rake_ci_tools/runners/vagrant.rb
|
138
|
+
- lib/rake_ci_tools/runners/xcode.rb
|
139
|
+
- lib/rake_ci_tools/tasks/calabash_task.rb
|
140
|
+
- lib/rake_ci_tools/tasks/cucumber_task.rb
|
141
|
+
- lib/rake_ci_tools/tasks/deploy_tasks.rb
|
142
|
+
- lib/rake_ci_tools/tasks/vagrant_task.rb
|
143
|
+
- lib/rake_ci_tools/tasks/xcode_task.rb
|
134
144
|
homepage: https://github.com/ChrisGriffiths/rake_ci_tools
|
135
145
|
licenses:
|
136
146
|
- MIT
|