motion-deploygate 0.4.2 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f8c410dc5fc3f250fab0f1c502a5afe5f78a67f
4
- data.tar.gz: 116dd2195bc95a7e6066ccfb28d920e5f28ff5c9
3
+ metadata.gz: 154c55d0693b0199d5138ead2bddb2d9570455c6
4
+ data.tar.gz: 0cb1b10b078456c7a6eccf85343c94a218acf750
5
5
  SHA512:
6
- metadata.gz: 6e5f486f0a26f498a9515e556989f4c423103101f1530a3f6ef3733610c1691c6ab329d427a4ec2dfd8bf677b942ec6855363a25650e2e9bbb70d47d84c1db34
7
- data.tar.gz: 9a094c87c42aaf2fd561cf7390474f46e09cc91414b6c0a3d8264fc84f6c1083f16881c0b51567c152d0ed01683a525c3239c1138af1326f523d825bf42517e5
6
+ metadata.gz: b80aea438d5beae116ce65d44f75fa1b86813c559a9002acf8a59c4da721e937d7413446a34c9bc043e84ff62339bbcc273ca0fd69e9b3c955393fd7859efd4f
7
+ data.tar.gz: 75e9db073d27844881f8973d795b97f2267c2f265c8f1eef3aba5c7c9c582cb5dceece2b97afe8bb27343b2a0d6cead4e17bd49fdf515a15e1c61efcf334783c
data/README.md CHANGED
@@ -18,6 +18,8 @@ Or install it yourself as:
18
18
 
19
19
  ## Setup
20
20
 
21
+ ### iOS
22
+
21
23
  1. Download the DeployGate SDK for iOS from https://deploygate.com/docs/ios_sdk and unpack it. Then, copy `DeployGateSDK.framework` into `vendor` directory of your RubyMotion project. Create the `vendor` directory if it does not exist.
22
24
 
23
25
  2. Configure the DeployGate SDK in your `Rakefile`. Set up `user_id`, `api_key` and `sdk` variables as following.
@@ -34,7 +36,7 @@ Motion::Project::App.setup do |app|
34
36
  end
35
37
  ```
36
38
 
37
- ### User authentication
39
+ #### User authentication
38
40
 
39
41
  If you would enable this feature, the testers can receive a notification when you will submit a new version to DeployGate.
40
42
  Set up `user_infomation` and `url_scheme` variables to use the user authentication in your `Rakefile`.
@@ -65,6 +67,23 @@ class AppDelegate
65
67
  end
66
68
  ```
67
69
 
70
+ ### Android
71
+
72
+ Now, it can't use the feature of DeployGate Android SDK (see [#2](https://github.com/Watson1978/motion-deploygate/issues/2)).
73
+
74
+ 1. Configure in order to submit app to DeployGate in your `Rakefile`. Set up `user_id` variables as following.
75
+
76
+ ```ruby
77
+ Motion::Project::App.setup do |app|
78
+ ...
79
+ app.development do
80
+ app.deploygate.user_id = '<user_id>'
81
+ end
82
+ ...
83
+ end
84
+ ```
85
+
86
+
68
87
  ## Usage
69
88
 
70
89
  ### Submit your app to DeployGate
@@ -76,7 +95,7 @@ end
76
95
 
77
96
  The `message` parameter is optional, and its content will be used as the description of submission.
78
97
 
79
- ### Symbolicate a crashlog
98
+ ### Symbolicate a crashlog (iOS only)
80
99
 
81
100
  Download a crashlog from DeployGate then run the following command to symbolicate a crashlog.
82
101
 
@@ -0,0 +1,12 @@
1
+ module DeployGateAndroid
2
+ def user_id=(id)
3
+ @user_id = id
4
+ end
5
+
6
+ def sdk=(sdk)
7
+ @sdk = sdk
8
+ @config.vendor_project(
9
+ :jar => sdk
10
+ )
11
+ end
12
+ end
@@ -0,0 +1,90 @@
1
+ module DeployGateIOS
2
+ def user_id=(id)
3
+ @user_id = id
4
+ end
5
+
6
+ def api_key=(key)
7
+ @api_key = key
8
+ end
9
+
10
+ def user_infomation=(bool)
11
+ @user_infomation = bool
12
+ end
13
+ alias :user_information= :user_infomation=
14
+
15
+ def url_scheme=(scheme)
16
+ @config.info_plist['CFBundleURLTypes'] = [
17
+ {
18
+ 'CFBundleURLName' => @config.identifier,
19
+ 'CFBundleURLSchemes' => [scheme]
20
+ }
21
+ ]
22
+ end
23
+
24
+ def sdk=(sdk)
25
+ @sdk = sdk
26
+ @config.vendor_project(
27
+ sdk,
28
+ :static,
29
+ :products => ['DeployGateSDK'],
30
+ :headers_dir => 'Headers'
31
+ )
32
+ @config.frameworks << 'SystemConfiguration'
33
+ create_launcher
34
+ apply_patch
35
+ end
36
+
37
+ private
38
+
39
+ def create_launcher
40
+ return unless @user_id && @api_key
41
+
42
+ launcher_code = <<EOF
43
+ # This file is automatically generated. Do not edit.
44
+
45
+ if Object.const_defined?('DeployGateSDK') and !UIDevice.currentDevice.model.include?('Simulator')
46
+ NSNotificationCenter.defaultCenter.addObserverForName(UIApplicationDidFinishLaunchingNotification, object:nil, queue:nil, usingBlock:lambda do |notification|
47
+ DeployGateSDK.sharedInstance.launchApplicationWithAuthor('#{@user_id}', key:'#{@api_key}', userInfomationEnabled:#{@user_infomation})
48
+ end)
49
+
50
+ class #{@config.delegate_class}
51
+ unless #{@config.delegate_class}.method_defined?("application:openURL:sourceApplication:annotation:")
52
+ def application(application, openURL:url, sourceApplication:sourceApplication, annotation:annotation)
53
+ return DeployGateSDK.sharedInstance.handleOpenUrl(url, sourceApplication:sourceApplication, annotation:annotation)
54
+ end
55
+ end
56
+ end
57
+
58
+ end
59
+ EOF
60
+ launcher_file = './app/deploygate_launcher.rb'
61
+ if !File.exist?(launcher_file) or File.read(launcher_file) != launcher_code
62
+ File.open(launcher_file, 'w') { |io| io.write(launcher_code) }
63
+ end
64
+ @config.files.unshift(launcher_file)
65
+ end
66
+
67
+ def apply_patch
68
+ Dir.glob(File.join(@sdk, "Headers") + "/*.h") do |file|
69
+ file = File.expand_path(file)
70
+ data = File.read(file)
71
+ new_data = []
72
+ data.each_line do |line|
73
+ # replace "typedef enum" declaration to avoid http://hipbyte.myjetbrains.com/youtrack/issue/RM-479
74
+ if line.strip == "typedef enum DeployGateSDKOption : NSUInteger {"
75
+ new_data << "typedef enum DeployGateSDKOption {\n"
76
+ else
77
+ new_data << line
78
+ end
79
+ end
80
+
81
+ new_data = new_data.join
82
+ if data != new_data
83
+ File.open(file, "w") do |io|
84
+ io.write new_data
85
+ end
86
+ end
87
+ end
88
+ end
89
+
90
+ end
@@ -4,102 +4,29 @@ unless defined?(Motion::Project::Config)
4
4
  raise "This file must be required within a RubyMotion project Rakefile."
5
5
  end
6
6
 
7
+ require_relative 'util'
8
+ require_relative 'ios'
9
+ require_relative 'android'
10
+
11
+ if MotionDeployGate.android?
12
+ require_relative 'rake/android'
13
+ else
14
+ require_relative 'rake/ios'
15
+ end
16
+
7
17
  class DeployGateConfig
8
18
  attr_reader :user_id
9
19
 
20
+ if MotionDeployGate.android?
21
+ include DeployGateAndroid
22
+ else
23
+ include DeployGateIOS
24
+ end
25
+
10
26
  def initialize(config)
11
27
  @config = config
12
28
  @user_infomation = false
13
29
  end
14
-
15
- def user_id=(id)
16
- @user_id = id
17
- end
18
-
19
- def api_key=(key)
20
- @api_key = key
21
- end
22
-
23
- def user_infomation=(bool)
24
- @user_infomation = bool
25
- end
26
- alias :user_information= :user_infomation=
27
-
28
- def url_scheme=(scheme)
29
- @config.info_plist['CFBundleURLTypes'] = [
30
- {
31
- 'CFBundleURLName' => @config.identifier,
32
- 'CFBundleURLSchemes' => [scheme]
33
- }
34
- ]
35
- end
36
-
37
- def sdk=(sdk)
38
- @sdk = sdk
39
- @config.vendor_project(
40
- sdk,
41
- :static,
42
- :products => ['DeployGateSDK'],
43
- :headers_dir => 'Headers'
44
- )
45
- @config.frameworks << 'SystemConfiguration'
46
- create_launcher
47
- apply_patch
48
- end
49
-
50
- private
51
-
52
- def create_launcher
53
- return unless @user_id && @api_key
54
-
55
- launcher_code = <<EOF
56
- # This file is automatically generated. Do not edit.
57
-
58
- if Object.const_defined?('DeployGateSDK') and !UIDevice.currentDevice.model.include?('Simulator')
59
- NSNotificationCenter.defaultCenter.addObserverForName(UIApplicationDidFinishLaunchingNotification, object:nil, queue:nil, usingBlock:lambda do |notification|
60
- DeployGateSDK.sharedInstance.launchApplicationWithAuthor('#{@user_id}', key:'#{@api_key}', userInfomationEnabled:#{@user_infomation})
61
- end)
62
-
63
- class #{@config.delegate_class}
64
- unless #{@config.delegate_class}.method_defined?("application:openURL:sourceApplication:annotation:")
65
- def application(application, openURL:url, sourceApplication:sourceApplication, annotation:annotation)
66
- return DeployGateSDK.sharedInstance.handleOpenUrl(url, sourceApplication:sourceApplication, annotation:annotation)
67
- end
68
- end
69
- end
70
-
71
- end
72
- EOF
73
- launcher_file = './app/deploygate_launcher.rb'
74
- if !File.exist?(launcher_file) or File.read(launcher_file) != launcher_code
75
- File.open(launcher_file, 'w') { |io| io.write(launcher_code) }
76
- end
77
- @config.files.unshift(launcher_file)
78
- end
79
-
80
- def apply_patch
81
- Dir.glob(File.join(@sdk, "Headers") + "/*.h") do |file|
82
- file = File.expand_path(file)
83
- data = File.read(file)
84
- new_data = []
85
- data.each_line do |line|
86
- # replace "typedef enum" declaration to avoid http://hipbyte.myjetbrains.com/youtrack/issue/RM-479
87
- if line.strip == "typedef enum DeployGateSDKOption : NSUInteger {"
88
- new_data << "typedef enum DeployGateSDKOption {\n"
89
- else
90
- new_data << line
91
- end
92
- end
93
-
94
- new_data = new_data.join
95
- if data != new_data
96
- File.open(file, "w") do |io|
97
- io.write new_data
98
- end
99
- end
100
- end
101
- end
102
-
103
30
  end
104
31
 
105
32
  module Motion; module Project; class Config
@@ -110,29 +37,3 @@ module Motion; module Project; class Config
110
37
  end
111
38
 
112
39
  end; end; end
113
-
114
- namespace :deploygate do
115
- desc "Submit an archive to DeployGate"
116
- task :submit do
117
- config = App.config
118
-
119
- Rake::Task["archive"].invoke
120
- App.info "DeployGate", "Submit #{config.name}.ipa to DeployGate"
121
- app_path = "build/iPhoneOS-#{config.deployment_target}-#{config.build_mode.to_s.capitalize}/#{config.name}.ipa"
122
- message = ENV['message'] ? "-m \"#{ENV['message']}\"" : ""
123
- sh "dgate push #{config.deploygate.user_id} \"#{app_path}\" #{message}"
124
- end
125
-
126
- desc "Symbolicate a crash log"
127
- task :symbolicate do
128
- config = App.config
129
- crashlog_path = File.expand_path(ENV['file'] || "")
130
- if ENV['file'].to_s == "" || !File.exist?(crashlog_path)
131
- App.fail "Usage: \"rake deploygate:symbolicate file=file_path_to_crashlog\""
132
- end
133
-
134
- symbolicatecrash = "#{config.xcode_dir}/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash"
135
- dsym_path = App.config.app_bundle_dsym('iPhoneOS')
136
- sh "DEVELOPER_DIR=#{config.xcode_dir} #{symbolicatecrash} \"#{crashlog_path}\" \"#{dsym_path}\""
137
- end
138
- end
@@ -0,0 +1,12 @@
1
+ namespace :deploygate do
2
+ desc "Submit an archive to DeployGate"
3
+ task :submit do
4
+ config = App.config
5
+
6
+ Rake::Task["build"].invoke
7
+ App.info "DeployGate", "Submit #{config.name}.apk to DeployGate"
8
+ app_path = "build/#{config.build_mode.to_s.capitalize}-#{config.api_version}/#{config.name}.apk"
9
+ message = ENV['message'] ? "-m \"#{ENV['message']}\"" : ""
10
+ sh "dgate push #{config.deploygate.user_id} \"#{app_path}\" #{message}"
11
+ end
12
+ end
@@ -0,0 +1,25 @@
1
+ namespace :deploygate do
2
+ desc "Submit an archive to DeployGate"
3
+ task :submit do
4
+ config = App.config
5
+
6
+ Rake::Task["archive"].invoke
7
+ App.info "DeployGate", "Submit #{config.name}.ipa to DeployGate"
8
+ app_path = "build/iPhoneOS-#{config.deployment_target}-#{config.build_mode.to_s.capitalize}/#{config.name}.ipa"
9
+ message = ENV['message'] ? "-m \"#{ENV['message']}\"" : ""
10
+ sh "dgate push #{config.deploygate.user_id} \"#{app_path}\" #{message}"
11
+ end
12
+
13
+ desc "Symbolicate a crash log"
14
+ task :symbolicate do
15
+ config = App.config
16
+ crashlog_path = File.expand_path(ENV['file'] || "")
17
+ if ENV['file'].to_s == "" || !File.exist?(crashlog_path)
18
+ App.fail "Usage: \"rake deploygate:symbolicate file=file_path_to_crashlog\""
19
+ end
20
+
21
+ symbolicatecrash = "#{config.xcode_dir}/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash"
22
+ dsym_path = App.config.app_bundle_dsym('iPhoneOS')
23
+ sh "DEVELOPER_DIR=#{config.xcode_dir} #{symbolicatecrash} \"#{crashlog_path}\" \"#{dsym_path}\""
24
+ end
25
+ end
@@ -0,0 +1,11 @@
1
+ module MotionDeployGate
2
+ module_function
3
+
4
+ def platform
5
+ Motion::Project::App.respond_to?(:template) ? Motion::Project::App.template : :ios
6
+ end
7
+
8
+ def android?
9
+ platform == :android
10
+ end
11
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-deploygate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: '0.5'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Watson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-15 00:00:00.000000000 Z
11
+ date: 2015-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: DeployGate integration for RubyMotion projects
41
+ description: DeployGate integration for RubyMotion iOS/Android projects
42
42
  email:
43
43
  - watson1978@gmail.com
44
44
  executables: []
@@ -46,7 +46,12 @@ extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
48
  - README.md
49
+ - lib/android.rb
50
+ - lib/ios.rb
49
51
  - lib/motion-deploygate.rb
52
+ - lib/rake/android.rb
53
+ - lib/rake/ios.rb
54
+ - lib/util.rb
50
55
  homepage: https://github.com/Watson1978/motion-deploygate
51
56
  licenses:
52
57
  - MIT
@@ -70,5 +75,5 @@ rubyforge_project:
70
75
  rubygems_version: 2.4.5
71
76
  signing_key:
72
77
  specification_version: 4
73
- summary: DeployGate integration for RubyMotion projects
78
+ summary: DeployGate integration for RubyMotion iOS/Android projects
74
79
  test_files: []