makr 1.0.0

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: 076c7dd63463df48c5389c5b1410b96993b7f6ce
4
+ data.tar.gz: 21974afdd058960c3e5513710aa6b2b5ff9f6c98
5
+ SHA512:
6
+ metadata.gz: 0d75c0026787d08e9d4c807a13f722fbffdd543375778179f37abcbbaded7581febe7afdb7014dfb41b6856245b6fbdbdc5139394a102502ee60bef1f7c0783b
7
+ data.tar.gz: eda93626955a6411aa784277c34fbc09b30f504e640072cd3406c1d51acb4f6df84a48a1f52dfe135197a28a699af87a84398bd5156e24f455ec3a6da9f4dec1
data/bin/makr ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'erb'
4
+ require 'yaml'
5
+
6
+ if !File.exist?('config.yaml')
7
+ puts 'No config.yaml found- outputting config.yaml template'
8
+
9
+ config = IO.read("#{Gem.datadir('makr')}/config.yaml")
10
+ File.open('config.yaml', 'w') do |f|
11
+ f.write config
12
+ end
13
+
14
+ puts 'config.yaml created, please edit and run again.'
15
+ abort
16
+ end
17
+
18
+ puts 'Reading config.yaml'
19
+ config = YAML.load_file("config.yaml")
20
+ template = IO.read("#{Gem.datadir('makr')}/Makefile.erb")
21
+
22
+ puts 'Generating Makefile'
23
+ makefile_string = ERB.new(template, nil, '-').result(binding)
24
+
25
+ puts 'Writing Makefile'
26
+ File.open("Makefile", "w") do |f|
27
+ f.write makefile_string
28
+ end
29
+
30
+ puts 'Done'
@@ -0,0 +1,129 @@
1
+ # Path for built products
2
+ ARTIFACTS_PATH = artifacts
3
+
4
+ # Path for dSYMs
5
+ DSYMS_PATH = $(ARTIFACTS_PATH)/dsyms
6
+
7
+ # Path for built archives
8
+ ARCHIVES_PATH = $(ARTIFACTS_PATH)/archives
9
+
10
+ # Path for built IPAs
11
+ IPAS_PATH = $(ARTIFACTS_PATH)/ipas
12
+
13
+ # Provisioning profiles dir
14
+ PROFILES_DIR = $(CURDIR)/profiles
15
+
16
+ # Temporary build dir
17
+ TEMP_DIR = $(CURDIR)/tmp
18
+
19
+ # Build environment vars
20
+ CONFIGURATION_BUILD_DIR = $(TEMP_DIR)/configuration
21
+
22
+ BUILD_ENV_OPTIONS = SHARED_PRECOMPS_DIR="$(TEMP_DIR)/precomps" \
23
+ TARGET_TEMP_DIR="$(TEMP_DIR)/target/" \
24
+ CONFIGURATION_BUILD_DIR="$(CONFIGURATION_BUILD_DIR)"
25
+
26
+ # Archives
27
+ ARCHIVES = <% config["archives"].each do |archive| %>$(ARCHIVES_PATH)/<%= archive["name"] %>.xcarchive <% end %>
28
+
29
+ # IPAs
30
+ IPAS = <% config["archives"].each do |archive| -%>
31
+ <% archive["ipas"].each do |ipa| -%>
32
+ $(IPAS_PATH)/<%= ipa["name"] %>.ipa <% end -%><% end -%>
33
+
34
+ # Get current version
35
+ CURRENT_VERSION=$(shell agvtool what-version -terse)
36
+
37
+ # If build number if defined and it's different than the current build number
38
+ # add update-version step to be used for all target
39
+ ifdef BUILD_NUMBER
40
+ UPDATE_VERSION = update-version
41
+ else
42
+ UPDATE_VERSION=
43
+ endif
44
+
45
+ # Updates project version if needed and generates all IPAs
46
+ all: $(UPDATE_VERSION) $(IPAS)
47
+
48
+ # Create profiles directory
49
+ $(PROFILES_DIR):
50
+ mkdir $@
51
+
52
+ # Install provisioning profiles
53
+ install-profiles: $(PROFILES_DIR)
54
+ rsync -av ./profiles/ ~/Library/MobileDevice/Provisioning\ Profiles/
55
+
56
+ # Updates project version using agvtool
57
+ update-version:
58
+ agvtool new-version -all $(CURRENT_VERSION).$(BUILD_NUMBER)
59
+
60
+ <% config["archives"].each do |archive| -%>
61
+ # Create <%=archive["name"]%>.xcarchive
62
+ $(ARCHIVES_PATH)/<%=archive["name"]%>.xcarchive:
63
+ xcodebuild archive $(BUILD_ENV_OPTIONS) \
64
+ -scheme "<%=archive["scheme"]%>" \
65
+ <% if archive["workspace"] -%>-workspace "<%= archive["workspace"] %>.xcworkspace" \
66
+ <% end -%>
67
+ <% if archive["project"] -%>-project "<%= archive["project"] %>.xcodeproj" \
68
+ <% end -%>
69
+ -configuration "<%=archive["configuration"]%>" \
70
+ -archivePath $@
71
+ mkdir -p "$(DSYMS_PATH)/<%=archive["name"]%>"
72
+ cp -r "$(CONFIGURATION_BUILD_DIR)/"*".dSYM" "$(DSYMS_PATH)/<%=archive["name"]%>/"
73
+ rm -rf $(TEMP_DIR)
74
+
75
+ <% archive["ipas"].each do |ipa| -%>
76
+ # Create <%=ipa["name"]%>.ipa
77
+ $(IPAS_PATH)/<%=ipa["name"]%>.ipa: $(IPAS_PATH) $(ARCHIVES_PATH)/<%=archive["name"]%>.xcarchive
78
+ xcodebuild -exportArchive \
79
+ -exportFormat IPA \
80
+ -exportProvisioningProfile "<%=ipa["profile"]%>" \
81
+ -archivePath "$(ARCHIVES_PATH)/<%=archive["name"]%>.xcarchive" \
82
+ -exportPath "$@"
83
+
84
+ <% if ipa["distributions"] != nil -%>
85
+ <% ipa["distributions"].each do |distribution| -%>
86
+ <% if distribution["type"] == "testflight" -%>
87
+ # Upload <%=ipa["name"]%>.ipa to <%=distribution["type"]%>
88
+ distribute-<%= distribution["name"] %>:
89
+ curl http://testflightapp.com/api/builds.json \
90
+ -F file=@'$(IPAS_PATH)/<%= ipa["name"] %>.ipa' \
91
+ -F api_token='<%= distribution["api-token"] %>' \
92
+ -F notes='<%= distribution["notes"] %>' \
93
+ -F team_token='<%= distribution["team-token"] %>' \
94
+ -F notify='<%= distribution["notify"].to_s %>' \
95
+ -F distribution_lists='<%= distribution["distribution-list"] %>'
96
+
97
+ <% end -%>
98
+ <% end -%>
99
+ <% end -%>
100
+ <% end -%>
101
+ <% end -%>
102
+ # Path to built IPAs
103
+ $(IPAS_PATH):
104
+ mkdir -p $(IPAS_PATH)
105
+
106
+ # Run all distribution tasks
107
+ distribute-all: <% config["archives"].each do |archive| -%>
108
+ <% archive["ipas"].each do |ipa| -%>
109
+ <% if ipa["distributions"] != nil -%>
110
+ <% ipa["distributions"].each do |distribution| -%>
111
+ distribute-<%= distribution["name"] -%>
112
+ <% end -%>
113
+ <% end -%>
114
+ <% end -%>
115
+ <% end -%>
116
+
117
+
118
+ <% if config["tests"] != nil -%>
119
+ <% config["tests"].each do |test| -%>
120
+ # Test <%= test["name"] %>
121
+ test-<%= test["name"] %>:
122
+ xcodebuild test <% if test["workspace"] -%>-workspace "<%= test["workspace"] %>.xcworkspace"<% end %><% if test["project"] -%>-project "<%= test["project"] %>.xcodeproj"<% end %> -scheme "<%= test["scheme"] %>" -destination platform="<%= test["platform"] %>",OS="<%= test["os"] %>",name="<%= test["device"] %>"
123
+ <% end -%>
124
+ <% end -%>
125
+
126
+ # Clean artifacts and temp directories
127
+ clean:
128
+ rm -rf $(ARTIFACTS_PATH)
129
+ rm -rf $(TEMP_DIR)
@@ -0,0 +1,29 @@
1
+ ---
2
+ tests: # List of all tests
3
+ -
4
+ name: "my-name" # Name of test. Run with make test-my-name.
5
+ project: "project" # Name of project. Use this OR workspace.
6
+ workspace: "workspace" # Name of workspace. Use this OR project.
7
+ scheme: "scheme" # Scheme to use during test. Make sure it's shared.
8
+ platform: "platform" # Platform to use for test. e.g. iOS Simulator.
9
+ os: "os" # OS to use for test. e.g. 8.1.
10
+ device: "device" # Device to use for test. e.g. iPad 2.
11
+ archives: # List of all archives.
12
+ -
13
+ name: "my-name" # Name of archive. Run with make artifacts/archives/my-name.xcarchive
14
+ scheme: "scheme" # Scheme to use during archive. Make sure it's shared.
15
+ configuration: "configuration" # Configuration to use during archive.
16
+ project: "project-name" # Name of project. Use this OR workspace.
17
+ workspace: "workspace-name" # Name of workspace. Use this OR project.
18
+ ipas: # List of all ipas to generate from parent archive
19
+ -
20
+ name: "my-name" # Name of ipa. Run with make artifacts/ipas/my-name.ipa
21
+ profile: "profile-name" # Provisioning profile to use when exporting ipa.
22
+ distributions: # List of all distributions for the parent ipa
23
+ -
24
+ type: "testflight" # Distribution type. testflight is currently the only option.
25
+ name: "my-name" # Distribution name. Run with make distribute my-name
26
+ team-token: "team-token" # Testflight team token.
27
+ api-token: "api-token" # Testflight API token.
28
+ distribution-list: "list" # Testflight distribution list.
29
+ notes: "New build!" # Release notes
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: makr
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Carter
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-21 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Makr reads the config.yaml file in the current directory to generate
14
+ a Makefile capable of building, testing, and distributing Xcode projects and workspaces.
15
+ email: andrew.carter@willowtreeapps.com
16
+ executables:
17
+ - makr
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - data/makr/Makefile.erb
22
+ - data/makr/config.yaml
23
+ - bin/makr
24
+ homepage: https://github.com/willowtreeapps/Makr
25
+ licenses:
26
+ - MIT
27
+ metadata: {}
28
+ post_install_message:
29
+ rdoc_options: []
30
+ require_paths:
31
+ - lib
32
+ required_ruby_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - '>='
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ requirements: []
43
+ rubyforge_project:
44
+ rubygems_version: 2.0.14
45
+ signing_key:
46
+ specification_version: 4
47
+ summary: A tool to generate a Makefile that builds, tests, and distributes Xcode projects
48
+ or workspaces.
49
+ test_files: []