fastlane-plugin-raven 0.1.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
+ SHA1:
3
+ metadata.gz: 8523eb97d8bf6aa3a23d6385276908c52463ee5f
4
+ data.tar.gz: 4dcfbf71338b1b2e221b979c4d1c35aac4006a44
5
+ SHA512:
6
+ metadata.gz: 55e851c0f23e6ffd5da301bdc31ae4f6dfea3c28f614381380a824ba78bdd9022476579f0b52f28623d9459e19f37c485a9b3fe0414abff48c062de4c5dca597
7
+ data.tar.gz: 4f26b853a8dd24e2c23f8bf14bd1c214772e04292ed41e66a4ed113096e17554b4fe1780349b3bb190e928a2dc7a3b66f1b5284cbf01ce850ce4df4bfd378771
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Marten Klitzke <me@mortik.xyz>
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,52 @@
1
+ # raven plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-raven)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-raven`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin raven
11
+ ```
12
+
13
+ ## About raven
14
+
15
+ Plugin to manage Releases and upload JS Sourcemaps
16
+
17
+ **Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
18
+
19
+ ## Example
20
+
21
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
22
+
23
+ **Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
24
+
25
+ ## Run tests for this plugin
26
+
27
+ To run both the tests, and code style validation, run
28
+
29
+ ```
30
+ rake
31
+ ```
32
+
33
+ To automatically fix many of the styling issues, use
34
+ ```
35
+ rubocop -a
36
+ ```
37
+
38
+ ## Issues and Feedback
39
+
40
+ For any other issues and feedback about this plugin, please submit it to this repository.
41
+
42
+ ## Troubleshooting
43
+
44
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
45
+
46
+ ## Using `fastlane` Plugins
47
+
48
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
49
+
50
+ ## About `fastlane`
51
+
52
+ `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/raven/version'
2
+
3
+ module Fastlane
4
+ module Raven
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::Raven.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,86 @@
1
+ require "sentry"
2
+
3
+ module Fastlane
4
+ module Actions
5
+ class RavenAction < Action
6
+ def self.run(params)
7
+ client = Sentry::Client.new(params[:token], "#{params[:organization]}/#{params[:project]}")
8
+ UI.message("Creating new Release")
9
+ response = client.create_release(params[:version])
10
+ if response.response_code == 200
11
+ UI.message("Release already exists..")
12
+ elsif response.response_code == 201
13
+ UI.success("Created new Release for Version: #{params[:version]}")
14
+ else
15
+ UI.user_error!("Failed to lookup/create a new Release")
16
+ end
17
+ UI.message("Uploading Sourcemaps")
18
+
19
+ if client.upload_sourcemaps(params[:version], params[:sourcemaps])
20
+ UI.success("Uploaded all Sourcemaps for Version: #{params[:version]}")
21
+ else
22
+ UI.user_error!("Failed to upload Sourcemaps for Version: #{params[:version]}")
23
+ end
24
+ end
25
+
26
+ def self.description
27
+ "Create new Sentry/Raven Release and Upload Sourcemaps"
28
+ end
29
+
30
+ def self.authors
31
+ ["Marten Klitzke"]
32
+ end
33
+
34
+ def self.return_value
35
+ # If your method provides a return value, you can describe here what it does
36
+ end
37
+
38
+ def self.details
39
+ end
40
+
41
+ def self.available_options
42
+ [
43
+ FastlaneCore::ConfigItem.new(
44
+ key: :token,
45
+ env_name: "RAVEN_SENTRY_TOKEN",
46
+ description: "A valid Sentry API Token",
47
+ optional: false,
48
+ type: String
49
+ ),
50
+ FastlaneCore::ConfigItem.new(
51
+ key: :organization,
52
+ env_name: "RAVEN_SENTRY_ORG",
53
+ description: "Your Sentry Organization name",
54
+ optional: false,
55
+ type: String
56
+ ),
57
+ FastlaneCore::ConfigItem.new(
58
+ key: :project,
59
+ env_name: "RAVEN_SENTRY_PROJECT",
60
+ description: "Your Sentry Project name",
61
+ optional: false,
62
+ type: String
63
+ ),
64
+ FastlaneCore::ConfigItem.new(
65
+ key: :version,
66
+ env_name: "RAVEN_SENTRY_VERSION",
67
+ description: "The Version of the new Release",
68
+ optional: false,
69
+ type: String
70
+ ),
71
+ FastlaneCore::ConfigItem.new(
72
+ key: :sourcemaps,
73
+ env_name: "RAVEN_SENTRY_SOURCEMAPS",
74
+ description: "Path to the Sourcemaps",
75
+ optional: false,
76
+ type: Array
77
+ )
78
+ ]
79
+ end
80
+
81
+ def self.is_supported?(platform)
82
+ true
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module Raven
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
data/lib/sentry.rb ADDED
@@ -0,0 +1,4 @@
1
+ require "sentry/client"
2
+
3
+ module Sentry
4
+ end
@@ -0,0 +1,48 @@
1
+ require "typhoeus"
2
+
3
+ module Sentry
4
+ class Client
5
+ attr_accessor :base_url, :token, :slug
6
+
7
+ def initialize(token, slug)
8
+ self.token = token
9
+ self.slug = slug
10
+ self.base_url = "https://sentry.io/api/0/projects/"
11
+ end
12
+
13
+ def create_release(version)
14
+ response = Typhoeus.get(
15
+ "#{base_url}/#{slug}/releases/#{version}/",
16
+ headers: {
17
+ "Authorization" => "Bearer #{token}",
18
+ "Content-Type" => "application/json"
19
+ }
20
+ )
21
+ if response.response_code == 200
22
+ # Release already present, skipping...
23
+ return response
24
+ end
25
+
26
+ Typhoeus.post(
27
+ "#{base_url}/#{slug}/releases/",
28
+ headers: {
29
+ "Authorization" => "Bearer #{token}",
30
+ "Content-Type" => "application/json"
31
+ },
32
+ body: JSON.dump({ version: version })
33
+ )
34
+ end
35
+
36
+ def upload_sourcemaps(version, sourcemaps)
37
+ sourcemaps.each do |sourcemap|
38
+ response = Typhoeus.post(
39
+ "#{base_url}/#{slug}/releases/#{version}/files/",
40
+ headers: { "Authorization" => "Bearer #{token}" },
41
+ body: { file: File.open(sourcemap, "r") }
42
+ )
43
+ return false unless response.response_code == 201
44
+ end
45
+ true
46
+ end
47
+ end
48
+ end
metadata ADDED
@@ -0,0 +1,160 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-raven
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Marten Klitzke
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-03-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: typhoeus
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.0.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: pry
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rspec
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rake
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rubocop
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ - !ruby/object:Gem::Dependency
104
+ name: fastlane
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '2.23'
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 2.23.0
113
+ type: :development
114
+ prerelease: false
115
+ version_requirements: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: '2.23'
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: 2.23.0
123
+ description:
124
+ email: me@mortik.xyz
125
+ executables: []
126
+ extensions: []
127
+ extra_rdoc_files: []
128
+ files:
129
+ - LICENSE
130
+ - README.md
131
+ - lib/fastlane/plugin/raven.rb
132
+ - lib/fastlane/plugin/raven/actions/raven_action.rb
133
+ - lib/fastlane/plugin/raven/version.rb
134
+ - lib/sentry.rb
135
+ - lib/sentry/client.rb
136
+ homepage: https://github.com/mortik/fastlane-plugin-raven
137
+ licenses:
138
+ - MIT
139
+ metadata: {}
140
+ post_install_message:
141
+ rdoc_options: []
142
+ require_paths:
143
+ - lib
144
+ required_ruby_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ required_rubygems_version: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ requirements: []
155
+ rubyforge_project:
156
+ rubygems_version: 2.5.1
157
+ signing_key:
158
+ specification_version: 4
159
+ summary: Plugin to manage Releases and upload JS Sourcemaps
160
+ test_files: []