ios_toolchain 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/README.md +1 -1
- data/lib/ios_toolchain/config.rb +12 -4
- data/lib/ios_toolchain/config_bootstrapper.rb +2 -2
- data/lib/ios_toolchain/project_analyzer.rb +23 -9
- data/lib/ios_toolchain/tasks/bootstrap.rake +4 -4
- data/lib/ios_toolchain/tasks/git.rake +7 -7
- data/lib/ios_toolchain/tasks/ios/clean.rake +6 -6
- data/lib/ios_toolchain/tasks/ios/dependencies.rake +12 -12
- data/lib/ios_toolchain/tasks/ios/provisioning.rake +1 -1
- data/lib/ios_toolchain/tasks/ios/specs.rake +7 -7
- data/lib/ios_toolchain/tasks/ios/tidy.rake +19 -19
- data/lib/ios_toolchain/tasks/shipit.rake +1 -1
- data/lib/ios_toolchain/tasks/validate.rake +1 -1
- data/lib/ios_toolchain/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97f72a22613e5c4bcfe1a313980f51ca3daebf9c
|
4
|
+
data.tar.gz: d850802d0f51dc85fd2615e83797b919547ed2a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ce2d66b9f43486eea853abd3d2572e135bea580a8a2324d4c0f4aeb0054d80470e93bb1f79ff50a144a19575b60f0efb162be70f8cdb090d263148170910d60
|
7
|
+
data.tar.gz: 04a9c2f9689d93a241d101d554dcd384108a25138312ed7e06e6301febf2d0e505e70b083cc3cf1fd238838c8584fc73cde66ba48228cfa5474de07e74be16df
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -58,7 +58,7 @@ This is the full list of available tasks, as output by `rake -T`:
|
|
58
58
|
rake ios:tidy:specs # Unfocusses any focussed Quick specs
|
59
59
|
rake ios:tidy:whitespace # Removes trailing whitespace from code files
|
60
60
|
rake shipit # Checks that we're ready to push, and then pushes the current branch to origin
|
61
|
-
rake toolchain:bootstrap[
|
61
|
+
rake toolchain:bootstrap[project_root] # Bootstraps iOS Toolchain configuration (project_root optional)
|
62
62
|
rake validate # Checks you if you need to do any cleanup of the code before you push
|
63
63
|
|
64
64
|
## Contributing
|
data/lib/ios_toolchain/config.rb
CHANGED
@@ -3,8 +3,12 @@ require 'bundler'
|
|
3
3
|
|
4
4
|
module IosToolchain
|
5
5
|
class Config
|
6
|
+
def project_root_path
|
7
|
+
Bundler.root.to_s
|
8
|
+
end
|
9
|
+
|
6
10
|
def project_file_path
|
7
|
-
config_yaml['project-file-path']
|
11
|
+
absolute_path(config_yaml['project-file-path'])
|
8
12
|
end
|
9
13
|
|
10
14
|
def default_sdk
|
@@ -36,11 +40,11 @@ module IosToolchain
|
|
36
40
|
end
|
37
41
|
|
38
42
|
def provisioning_path
|
39
|
-
config_yaml['provisioning-path']
|
43
|
+
absolute_path(config_yaml['provisioning-path'])
|
40
44
|
end
|
41
45
|
|
42
46
|
def crashlytics_framework_path
|
43
|
-
config_yaml['crashlytics-framework-path']
|
47
|
+
absolute_path(config_yaml['crashlytics-framework-path'])
|
44
48
|
end
|
45
49
|
|
46
50
|
def crashlytics_installed?
|
@@ -53,8 +57,12 @@ module IosToolchain
|
|
53
57
|
|
54
58
|
private
|
55
59
|
|
60
|
+
def absolute_path(path)
|
61
|
+
(Pathname.new(project_root_path) + Pathname.new(path)).to_s unless path.nil?
|
62
|
+
end
|
63
|
+
|
56
64
|
def config_file_path
|
57
|
-
File.join(
|
65
|
+
File.join(project_root_path, file_name)
|
58
66
|
end
|
59
67
|
|
60
68
|
def config_yaml
|
@@ -25,7 +25,7 @@ module IosToolchain
|
|
25
25
|
|
26
26
|
def config
|
27
27
|
{
|
28
|
-
'project-file-path' => analyzer.
|
28
|
+
'project-file-path' => analyzer.project_file_path,
|
29
29
|
'default-scheme' => analyzer.default_scheme,
|
30
30
|
'default-sdk' => 'iphoneos10.2',
|
31
31
|
'default-32bit-test-device' => "'iOS Simulator,OS=10.2,name=iPhone 5'",
|
@@ -33,7 +33,7 @@ module IosToolchain
|
|
33
33
|
'app-targets' => analyzer.app_targets,
|
34
34
|
'test-targets' => analyzer.test_targets,
|
35
35
|
'ui-test-targets' => analyzer.ui_test_targets,
|
36
|
-
'provisioning-path' =>
|
36
|
+
'provisioning-path' => './provisioning',
|
37
37
|
'crashlytics-framework-path' => analyzer.crashlytics_framework_path
|
38
38
|
}
|
39
39
|
end
|
@@ -3,12 +3,15 @@ require 'pathname'
|
|
3
3
|
|
4
4
|
module IosToolchain
|
5
5
|
class ProjectAnalyzer
|
6
|
-
attr_reader :project_root, :
|
6
|
+
attr_reader :project_root, :project_file_path
|
7
7
|
|
8
8
|
def initialize(project_root)
|
9
|
-
|
10
|
-
@
|
11
|
-
@
|
9
|
+
project_root_path = Pathname.new(project_root).realpath
|
10
|
+
@project_root = project_root_path.to_s
|
11
|
+
@absolute_project_path = find_project_path!
|
12
|
+
@project_file_path = relative_from_root(@absolute_project_path)
|
13
|
+
|
14
|
+
@project = Xcodeproj::Project.open(@absolute_project_path)
|
12
15
|
end
|
13
16
|
|
14
17
|
def default_scheme
|
@@ -19,7 +22,8 @@ module IosToolchain
|
|
19
22
|
end
|
20
23
|
|
21
24
|
def crashlytics_framework_path
|
22
|
-
|
25
|
+
path = glob_excluding_carthage('**/Crashlytics.framework').first || return
|
26
|
+
relative_from_root(path)
|
23
27
|
end
|
24
28
|
|
25
29
|
def app_targets
|
@@ -42,24 +46,34 @@ module IosToolchain
|
|
42
46
|
|
43
47
|
private
|
44
48
|
|
49
|
+
def relative_from_root(path)
|
50
|
+
"./#{Pathname(path).relative_path_from(Pathname.new(project_root)).to_s}"
|
51
|
+
end
|
52
|
+
|
45
53
|
def shared_schemes
|
46
|
-
Xcodeproj::Project.schemes(
|
54
|
+
Xcodeproj::Project.schemes(project_file_path)
|
47
55
|
end
|
48
56
|
|
49
57
|
def project_name
|
50
|
-
|
58
|
+
project_file_path.split(File::SEPARATOR)[-1].split('.')[-2]
|
51
59
|
end
|
52
60
|
|
53
61
|
def find_project_path!
|
54
|
-
|
62
|
+
glob_excluding_carthage('**/*.xcodeproj').first.tap do |project|
|
55
63
|
return project unless project.nil?
|
56
64
|
|
57
65
|
error_message = "No .xcodeproj file was found in #{project_root} "
|
58
|
-
error_message +=
|
66
|
+
error_message += 'Run `rake toolchain:bootstrap[/path/containing/project/]`'
|
59
67
|
throw error_message
|
60
68
|
end
|
61
69
|
end
|
62
70
|
|
71
|
+
def glob_excluding_carthage(pattern)
|
72
|
+
Dir.glob(File.join(project_root, pattern)).reject do |name|
|
73
|
+
name =~ /\/Carthage\//
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
63
77
|
attr_reader :project
|
64
78
|
end
|
65
79
|
end
|
@@ -6,11 +6,11 @@ include IosToolchain::Helpers
|
|
6
6
|
|
7
7
|
desc 'iOS Toolchain maintenance tasks'
|
8
8
|
namespace :toolchain do
|
9
|
-
desc
|
10
|
-
task :bootstrap, :
|
11
|
-
args.with_defaults(:
|
9
|
+
desc 'Bootstraps iOS Toolchain configuration (project_root optional)'
|
10
|
+
task :bootstrap, :project_root do |t, args|
|
11
|
+
args.with_defaults(:project_root => Bundler.root)
|
12
12
|
|
13
|
-
analyzer = IosToolchain::ProjectAnalyzer.new(args[:
|
13
|
+
analyzer = IosToolchain::ProjectAnalyzer.new(args[:project_root])
|
14
14
|
bootstrapper = IosToolchain::ConfigBootstrapper.new(analyzer)
|
15
15
|
bootstrapper.bootstrap!
|
16
16
|
|
@@ -1,18 +1,18 @@
|
|
1
1
|
include IosToolchain::Helpers
|
2
2
|
|
3
3
|
namespace :git do
|
4
|
-
desc
|
4
|
+
desc 'Checks for uncommitted changes and aborts if any are found'
|
5
5
|
task :check_for_uncommitted_changes do
|
6
|
-
puts
|
6
|
+
puts 'Checking for uncommitted changes...'
|
7
7
|
if `git status -s`.chomp.length > 0
|
8
|
-
system(
|
9
|
-
bail(
|
8
|
+
system('git status')
|
9
|
+
bail('Uncommitted changes detected (maybe something got auto-corrected?). Please commit these and try again.')
|
10
10
|
end
|
11
|
-
puts
|
11
|
+
puts 'Done!'
|
12
12
|
end
|
13
13
|
|
14
|
-
desc
|
14
|
+
desc 'Pushes the current branch to origin'
|
15
15
|
task :push_origin do
|
16
|
-
system(
|
16
|
+
system('git push origin head') || bail
|
17
17
|
end
|
18
18
|
end
|
@@ -4,28 +4,28 @@ namespace :ios do
|
|
4
4
|
desc 'Cleans the build & resets simulator'
|
5
5
|
task :clean => [:'clean:build']
|
6
6
|
|
7
|
-
desc
|
7
|
+
desc 'Cleans the build'
|
8
8
|
namespace :clean do
|
9
9
|
task :build do
|
10
|
-
puts
|
10
|
+
puts 'Cleaning...'
|
11
11
|
|
12
12
|
clean_cmd = []
|
13
13
|
clean_cmd << 'xcodebuild clean'
|
14
14
|
clean_cmd << 'rm -rf build'
|
15
15
|
system(clean_cmd.join("\n"))
|
16
16
|
|
17
|
-
puts
|
17
|
+
puts 'Done!'
|
18
18
|
end
|
19
19
|
|
20
20
|
desc 'Resets the simulator'
|
21
21
|
task :simulator do
|
22
|
-
puts
|
22
|
+
puts 'Resetting simulator...'
|
23
23
|
|
24
24
|
system("osascript -e 'tell application \"iOS Simulator\" to quit'") &&
|
25
25
|
system("osascript -e 'tell application \"Simulator\" to quit'") &&
|
26
|
-
system(
|
26
|
+
system('xcrun simctl erase all')
|
27
27
|
|
28
|
-
puts
|
28
|
+
puts 'Done!'
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -1,25 +1,25 @@
|
|
1
1
|
namespace :ios do
|
2
2
|
namespace :carthage do
|
3
|
-
desc
|
3
|
+
desc 'updates our Carthage dependencies to the latest version'
|
4
4
|
task :update do
|
5
5
|
carthage_cmd = []
|
6
|
-
carthage_cmd <<
|
7
|
-
carthage_cmd <<
|
8
|
-
carthage_cmd <<
|
9
|
-
carthage_cmd <<
|
10
|
-
carthage_cmd = carthage_cmd.join(
|
6
|
+
carthage_cmd << 'carthage'
|
7
|
+
carthage_cmd << 'update'
|
8
|
+
carthage_cmd << '--platform ios'
|
9
|
+
carthage_cmd << '--no-use-binaries'
|
10
|
+
carthage_cmd = carthage_cmd.join(' ')
|
11
11
|
|
12
12
|
system(carthage_cmd)
|
13
13
|
end
|
14
14
|
|
15
|
-
desc
|
15
|
+
desc 'Fetches our Carthage dependencies to the locked in versions'
|
16
16
|
task :fetch do
|
17
17
|
carthage_cmd = []
|
18
|
-
carthage_cmd <<
|
19
|
-
carthage_cmd <<
|
20
|
-
carthage_cmd <<
|
21
|
-
carthage_cmd <<
|
22
|
-
carthage_cmd = carthage_cmd.join(
|
18
|
+
carthage_cmd << 'carthage'
|
19
|
+
carthage_cmd << 'bootstrap'
|
20
|
+
carthage_cmd << '--platform ios'
|
21
|
+
carthage_cmd << '--no-use-binaries'
|
22
|
+
carthage_cmd = carthage_cmd.join(' ')
|
23
23
|
|
24
24
|
system(carthage_cmd)
|
25
25
|
end
|
@@ -11,7 +11,7 @@ def build_specs_cmd(scheme, options={})
|
|
11
11
|
specs_cmd << "-destination platform=#{config.default_32bit_test_device}" unless options[:skip_32bit]
|
12
12
|
specs_cmd << "-destination platform=#{config.default_64bit_test_device}"
|
13
13
|
specs_cmd << '| bundle exec xcpretty'
|
14
|
-
specs_cmd
|
14
|
+
specs_cmd.join(' ')
|
15
15
|
end
|
16
16
|
|
17
17
|
def run_tests_or_bail(tests, args)
|
@@ -20,28 +20,28 @@ def run_tests_or_bail(tests, args)
|
|
20
20
|
Rake::Task['ios:clean:build'].reenable
|
21
21
|
Rake::Task['ios:clean:simulator'].reenable
|
22
22
|
tests.each do |target|
|
23
|
-
|
24
|
-
bail(
|
23
|
+
unless system(build_specs_cmd(target, skip_32bit: args[:skip_32bit]))
|
24
|
+
bail('Specs failure - please fix the failing specs and try again.')
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
namespace :ios do
|
30
|
-
desc
|
30
|
+
desc 'Run all the tests: unit and UI, 32bit and 64bit'
|
31
31
|
task :specs => ['specs:unit', 'specs:ui']
|
32
32
|
|
33
33
|
namespace :specs do
|
34
|
-
desc
|
34
|
+
desc 'Run 64bit unit tests only'
|
35
35
|
task :slim do
|
36
36
|
Rake::Task['specs:unit'].invoke(skip_32bit: true)
|
37
37
|
end
|
38
38
|
|
39
|
-
desc
|
39
|
+
desc 'Run the unit tests (optionally skip 32 bit devices)'
|
40
40
|
task :unit, [:skip_32bit] => ['ios:clean:build', 'ios:clean:simulator'] do |task, args|
|
41
41
|
run_tests_or_bail(config.test_targets, args)
|
42
42
|
end
|
43
43
|
|
44
|
-
desc
|
44
|
+
desc 'Run the UI tests (optionally skip 32 bit devices)'
|
45
45
|
task :ui, [:skip_32bit] => ['ios:clean:build', 'ios:clean:simulator'] do |task, args|
|
46
46
|
run_tests_or_bail(config.ui_test_targets, args)
|
47
47
|
end
|
@@ -3,13 +3,13 @@ require 'ios_toolchain/helpers'
|
|
3
3
|
include IosToolchain::Helpers
|
4
4
|
|
5
5
|
namespace :ios do
|
6
|
-
desc
|
6
|
+
desc 'Reports and attempts to tidy up common cleanliness problems with the codebase'
|
7
7
|
task :tidy => ['tidy:project_file', 'tidy:specs', 'tidy:whitespace', 'tidy:lint']
|
8
8
|
|
9
9
|
namespace :tidy do
|
10
|
-
desc
|
10
|
+
desc 'Unfocusses any focussed Quick specs'
|
11
11
|
task :specs do
|
12
|
-
puts
|
12
|
+
puts 'Unfocussing specs...'
|
13
13
|
|
14
14
|
find_focussed_files_cmd = []
|
15
15
|
find_focussed_files_cmd << 'grep -l -r -e'
|
@@ -26,39 +26,39 @@ namespace :ios do
|
|
26
26
|
unfocus_cmd << "-e 's/fdescribe(/describe(/g;'"
|
27
27
|
unfocus_cmd << "-e 's/fcontext(/context(/g;'"
|
28
28
|
unfocus_cmd << "\"#{file_with_focussed_specs}\""
|
29
|
-
unfocus_cmd = unfocus_cmd.join(
|
29
|
+
unfocus_cmd = unfocus_cmd.join(' ')
|
30
30
|
system(unfocus_cmd)
|
31
31
|
end
|
32
32
|
|
33
|
-
puts
|
33
|
+
puts 'Done!'
|
34
34
|
end
|
35
35
|
|
36
|
-
desc
|
36
|
+
desc 'Sorts the project file'
|
37
37
|
task :project_file do
|
38
|
-
puts
|
38
|
+
puts 'Sorting the project file...'
|
39
39
|
system("script/sort-Xcode-project-file #{config.project_file_path}")
|
40
|
-
puts
|
40
|
+
puts 'Done!'
|
41
41
|
end
|
42
42
|
|
43
|
-
desc
|
43
|
+
desc 'Removes trailing whitespace from code files'
|
44
44
|
task :whitespace do
|
45
45
|
file_extensions = %w{ h m swift }
|
46
46
|
search_pattern = file_extensions.map { |ext| "-name \"*.#{ext}\""}.join(' -o ')
|
47
|
-
puts
|
48
|
-
system("find #{config.app_targets.join(
|
49
|
-
puts
|
47
|
+
puts 'Removing trailing whitespace...'
|
48
|
+
system("find #{config.app_targets.join(' ')} #{config.test_targets.join(" ")} #{search_pattern} -exec sed -i '' -e's/[ ]*$//' \"{}\" \\;")
|
49
|
+
puts 'Done!'
|
50
50
|
end
|
51
51
|
|
52
|
-
desc
|
52
|
+
desc 'Runs swiftlint'
|
53
53
|
task :lint do
|
54
|
-
puts
|
55
|
-
|
56
|
-
bail(
|
54
|
+
puts 'Linting...'
|
55
|
+
unless system('which swiftlint')
|
56
|
+
bail('Swiftlint is not installed - please install via `brew install swiftlint`')
|
57
57
|
end
|
58
|
-
|
59
|
-
bail(
|
58
|
+
unless system('swiftlint lint --strict')
|
59
|
+
bail('Code hygeine problems were detected via swiftlint')
|
60
60
|
end
|
61
|
-
puts
|
61
|
+
puts 'Done!'
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
desc
|
2
|
+
desc 'Checks you if you need to do any cleanup of the code before you push'
|
3
3
|
task :validate do
|
4
4
|
Rake::Task['git:check_for_uncommitted_changes'].invoke
|
5
5
|
Rake::Task['ios:clean:build'].invoke
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ios_toolchain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dennis Schmidt
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|