fastlane-plugin-napp_notifications 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f2ca4f40bbce2810c8c4891f89925feea6e8d86cebd9ed2ce00f002b67607701
4
+ data.tar.gz: 2844b2d42ab96f0d9cf215f31bb91a0727e563c8e2558f16f90a7a2c1a6c9d98
5
+ SHA512:
6
+ metadata.gz: 809c14aa561686d3ab4657ed161f57d86c062dadbc2cda4fee46f08ff3e2706a7ca60707f2764bf114d0a2a1f0b64a6ddccdf81482dbfecf2d03a2d6937d1805
7
+ data.tar.gz: 2ba97e6f45fd79c99f87435a9b3a6af1c629e1fbf21643ac3efea369cdff2f9a352a2f9e843ce0268cbe0bbd27fbde59b887ef6e814ffe44c3578839dc9fb4d2
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Mads Møller <mm@napp.dk>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # Napp Notifications Fastlane Plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-napp_notifications)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-napp_notifications`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin napp_notifications
11
+ ```
12
+
13
+ ## About
14
+
15
+ Napp Notifications is a Push Notification service for Mobile apps. This plugin automates the creation of apps and keeping certificates.
16
+
17
+ ## Example
18
+
19
+ ```ruby
20
+ napp_notifications(
21
+ admin_api_key: "Napp Notifications API-KEY",
22
+ app_id: "Napp Notifications App Id",
23
+ bundle_id: "com.example.helloworld",
24
+ cert_p12: "Path to Apple .p12 file",
25
+ cert_password: "Password for .p12 file",
26
+ base_url: "URL to server (optional)"
27
+ )
28
+
29
+ ```
30
+ ## Issues and Feedback
31
+
32
+ For any other issues and feedback about this plugin, please submit it to this repository.
33
+
34
+ ## Troubleshooting
35
+
36
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
37
+
38
+ ## Using _fastlane_ Plugins
39
+
40
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
41
+
42
+ ## About _fastlane_
43
+
44
+ _fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/napp_notifications/version'
2
+
3
+ module Fastlane
4
+ module NappNotifications
5
+ # Return all .rb files inside the "actions" and "helper" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
+ end
9
+ end
10
+ end
11
+
12
+ # By default we want to import all available actions and helpers
13
+ # A plugin can contain any number of actions and plugins
14
+ Fastlane::NappNotifications.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,146 @@
1
+ require 'fastlane/action'
2
+
3
+ module Fastlane
4
+ module Actions
5
+ class NappNotificationsAction < Action
6
+ def self.run(params)
7
+ require 'base64'
8
+
9
+ # set the base url
10
+ base_url = "https://notifications.napp.dk"
11
+ if params[:base_url]
12
+ base_url = params[:base_url]
13
+ end
14
+
15
+ cert_p12 = params[:cert_p12]
16
+ cert_password = params[:cert_password]
17
+ app_id = params[:app_id]
18
+ admin_key = params[:admin_api_key]
19
+ bundle_id = params[:bundle_id]
20
+
21
+ connection = self.connection(base_url)
22
+
23
+ if !File.exist?(cert_p12)
24
+ UI.error("Certificate not found 🚫")
25
+ abort
26
+ end
27
+
28
+ # setting the payload
29
+ payload = {}
30
+ payload[:apns_bundle_id] = bundle_id
31
+
32
+ # pass the certificate
33
+ data = File.read(params[:cert_p12])
34
+ cert_p12 = Base64.encode64(data)
35
+ payload["certificate"] = cert_p12
36
+ payload["certificate_password"] = cert_password
37
+ payload["apns_bundle_id"] = bundle_id
38
+
39
+ response = connection.post do |req|
40
+ req.url("api/v1/apps/" + app_id + "/platform/ios")
41
+ req.headers['X-NAPP-PUSH-ADMIN-KEY'] = admin_key
42
+ req.headers['X-NAPP-PUSH-APP-ID'] = app_id
43
+ req.body = payload
44
+ end
45
+
46
+ case response.status
47
+ when 200...300
48
+ UI.message("✅ Successfully uploaded new Push Notification iOS certificate ✅")
49
+ else
50
+ UI.error("🚫 Error trying to create iOS platform: #{response.status} - #{response.body}")
51
+ end
52
+
53
+ end
54
+
55
+ def self.connection(base_url)
56
+ require 'faraday'
57
+ require 'faraday_middleware'
58
+
59
+ foptions = {
60
+ url: base_url
61
+ }
62
+ Faraday.new(foptions) do |builder|
63
+ #builder.request :multipart
64
+ builder.request :url_encoded
65
+ builder.response :json, content_type: /\bjson$/
66
+ builder.use FaradayMiddleware::FollowRedirects
67
+ builder.adapter :net_http
68
+ end
69
+ end
70
+
71
+ def self.description
72
+ "Napp Notifications"
73
+ end
74
+
75
+ def self.authors
76
+ ["Mads Møller"]
77
+ end
78
+
79
+ def self.return_value
80
+ # If your method provides a return value, you can describe here what it does
81
+ end
82
+
83
+ def self.details
84
+ # Optional:
85
+ "Napp Notifications"
86
+ end
87
+
88
+ def self.available_options
89
+ [
90
+ FastlaneCore::ConfigItem.new(key: :admin_api_key,
91
+ env_name: "NAPP_NOTIFICATIONS_ADMIN_KEY",
92
+ description: "Admin API Key",
93
+ optional: false,
94
+ type: String),
95
+ FastlaneCore::ConfigItem.new(key: :app_id,
96
+ env_name: "NAPP_NOTIFICATIONS_APP_ID",
97
+ optional: false,
98
+ description: "App id",
99
+ type: String),
100
+ FastlaneCore::ConfigItem.new(key: :cert_p12,
101
+ env_name: "NAPP_NOTIFICATIONS_P12_CERT_PATH",
102
+ optional: false,
103
+ description: "File path of the certificate .p12",
104
+ type: String),
105
+ FastlaneCore::ConfigItem.new(key: :cert_password,
106
+ env_name: "NAPP_NOTIFICATIONS_P12_CERT_PASSWORD",
107
+ optional: false,
108
+ description: ".p12 File path of the certificate",
109
+ type: String),
110
+ FastlaneCore::ConfigItem.new(key: :bundle_id,
111
+ env_name: "NAPP_NOTIFICATIONS_BUNDLE_ID",
112
+ optional: false,
113
+ description: "Bundle id of the app",
114
+ type: String),
115
+ FastlaneCore::ConfigItem.new(key: :base_url,
116
+ env_name: "NAPP_NOTIFICATIONS_BASE_URL",
117
+ optional: true,
118
+ type: String,
119
+ description: "Private cloud option")
120
+ ]
121
+ end
122
+
123
+ def self.is_supported?(platform)
124
+ [:ios].include?(platform)
125
+ end
126
+
127
+ def self.example_code
128
+ [
129
+ 'napp_notifications(
130
+ admin_api_key: "Napp Notifications API-KEY",
131
+ app_id: "Napp Notifications App Id",
132
+ bundle_id: "com.example.helloworld",
133
+ cert_p12: "Path to Apple .p12 file",
134
+ cert_password: "Password for .p12 file",
135
+ base_url: "URL to server (optional)"
136
+ )'
137
+ ]
138
+ end
139
+
140
+ def self.category
141
+ :push
142
+ end
143
+
144
+ end
145
+ end
146
+ end
@@ -0,0 +1,16 @@
1
+ require 'fastlane_core/ui/ui'
2
+
3
+ module Fastlane
4
+ UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
5
+
6
+ module Helper
7
+ class NappNotificationsHelper
8
+ # class methods that you define here become available in your action
9
+ # as `Helper::NappNotificationsHelper.your_method`
10
+ #
11
+ def self.show_message
12
+ UI.message("Hello from the napp_notifications plugin helper!")
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module NappNotifications
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,175 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-napp_notifications
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Mads Møller
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-04-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pry
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
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec_junit_formatter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 0.49.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 0.49.1
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-require_tools
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: fastlane
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: 2.89.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 2.89.0
139
+ description:
140
+ email: mm@napp.dk
141
+ executables: []
142
+ extensions: []
143
+ extra_rdoc_files: []
144
+ files:
145
+ - LICENSE
146
+ - README.md
147
+ - lib/fastlane/plugin/napp_notifications.rb
148
+ - lib/fastlane/plugin/napp_notifications/actions/napp_notifications_action.rb
149
+ - lib/fastlane/plugin/napp_notifications/helper/napp_notifications_helper.rb
150
+ - lib/fastlane/plugin/napp_notifications/version.rb
151
+ homepage: https://github.com/Napp/fastlane-plugin-napp_notifications
152
+ licenses:
153
+ - MIT
154
+ metadata: {}
155
+ post_install_message:
156
+ rdoc_options: []
157
+ require_paths:
158
+ - lib
159
+ required_ruby_version: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ version: '0'
164
+ required_rubygems_version: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ version: '0'
169
+ requirements: []
170
+ rubyforge_project:
171
+ rubygems_version: 2.7.6
172
+ signing_key:
173
+ specification_version: 4
174
+ summary: Napp Notifications
175
+ test_files: []