motion-deploygate 0.1

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.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +44 -0
  3. data/lib/motion-deploygate.rb +89 -0
  4. metadata +60 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ad8833287e543a39fc67fa62e128a3fb29994186
4
+ data.tar.gz: 52e06ac86c160f26a4a5a4af07e022fd60b667a8
5
+ SHA512:
6
+ metadata.gz: 305077f08a5da009542d32f146bad4eed8476d79d22fbaed0f245c2cb77a1779123de008578ae5843168c7d40aa99780bba9c7c84696e9302103eafb84991f67
7
+ data.tar.gz: 2131e17d2be34593db93eb47284ca2ab398bb97012c16d6c55dca710cb679fe40536e843fb489dad0e650b6112aacb4da211ef06faca4e1e8779aef2eb5bcf23
@@ -0,0 +1,44 @@
1
+ # motion-deploygate
2
+
3
+ DeployGate integration for RubyMotion projects
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'motion-deploygate'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install motion-deploygate
18
+
19
+ ## Usage
20
+
21
+ 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
+
23
+ 2. Configure the DeployGate SDK in your `Rakefile`. Set up `user_id`, `api_key`, `user_infomation` and `sdk` variables as following.
24
+
25
+ ```ruby
26
+ Motion::Project::App.setup do |app|
27
+ ...
28
+ app.deploygate.user_id = '<user_id>'
29
+ app.deploygate.api_key = '<api_key>'
30
+ app.deploygate.user_infomation = true # or false
31
+ app.deploygate.sdk = 'vendor/DeployGateSDK.framework'
32
+ ...
33
+ end
34
+ ```
35
+
36
+ Finally, run `rake archive` when deploy your app. Then, upload `./build/iPhoneOS-XXXX/your_app.ipa` to DeployGate.
37
+
38
+ ## Contributing
39
+
40
+ 1. Fork it
41
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
42
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
43
+ 4. Push to the branch (`git push origin my-new-feature`)
44
+ 5. Create new Pull Request
@@ -0,0 +1,89 @@
1
+ # encoding: utf-8
2
+
3
+ unless defined?(Motion::Project::Config)
4
+ raise "This file must be required within a RubyMotion project Rakefile."
5
+ end
6
+
7
+ class DeployGateConfig
8
+ def initialize(config)
9
+ @config = config
10
+ @user_infomation = false
11
+ end
12
+
13
+ def user_id=(id)
14
+ @user_id = id
15
+ end
16
+
17
+ def api_key=(key)
18
+ @api_key = key
19
+ end
20
+
21
+ def user_infomation=(bool)
22
+ @user_infomation = bool
23
+ end
24
+
25
+ def sdk=(sdk)
26
+ @sdk = sdk
27
+ @config.vendor_project(
28
+ sdk,
29
+ :static,
30
+ :products => ['DeployGateSDK'],
31
+ :headers_dir => 'Headers'
32
+ )
33
+ @config.frameworks << 'SystemConfiguration'
34
+ create_launcher
35
+ apply_patch
36
+ end
37
+
38
+ private
39
+
40
+ def create_launcher
41
+ return unless @user_id && @api_key
42
+
43
+ launcher_code = <<EOF
44
+ # This file is automatically generated. Do not edit.
45
+
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
+ EOF
50
+ launcher_file = './app/deploygate_launcher.rb'
51
+ if !File.exist?(launcher_file) or File.read(launcher_file) != launcher_code
52
+ File.open(launcher_file, 'w') { |io| io.write(launcher_code) }
53
+ end
54
+ @config.files.unshift(launcher_file)
55
+ end
56
+
57
+ def apply_patch
58
+ Dir.glob(File.join(@sdk, "Headers") + "/*.h") do |file|
59
+ file = File.expand_path(file)
60
+ data = File.read(file)
61
+ new_data = []
62
+ data.each_line do |line|
63
+ # comment out "@property(nonatomic) DeployGateSDKOption options;" line
64
+ if line.strip == "@property(nonatomic) DeployGateSDKOption options;"
65
+ new_data << "// #{line}"
66
+ else
67
+ new_data << line
68
+ end
69
+ end
70
+
71
+ new_data = new_data.join
72
+ if data != new_data
73
+ File.open(file, "w") do |io|
74
+ io.write new_data
75
+ end
76
+ end
77
+ end
78
+ end
79
+
80
+ end
81
+
82
+ module Motion; module Project; class Config
83
+ variable :deploygate
84
+
85
+ def deploygate
86
+ @deploygate ||= DeployGateConfig.new(self)
87
+ end
88
+
89
+ end; end; end
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: motion-deploygate
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Watson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: DeployGate integration for RubyMotion projects
28
+ email:
29
+ - watson1978@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - README.md
35
+ - lib/motion-deploygate.rb
36
+ homepage: https://github.com/Watson1978/motion-deploygate
37
+ licenses:
38
+ - MIT
39
+ metadata: {}
40
+ post_install_message:
41
+ rdoc_options: []
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ requirements: []
55
+ rubyforge_project:
56
+ rubygems_version: 2.2.2
57
+ signing_key:
58
+ specification_version: 4
59
+ summary: DeployGate integration for RubyMotion projects
60
+ test_files: []