Skip to content

Commit

Permalink
[fastlane] Updated development and platform ios
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffrey Rogiers committed Jun 2, 2020
1 parent e158112 commit 06586a4
Show file tree
Hide file tree
Showing 5 changed files with 326 additions and 106 deletions.
131 changes: 25 additions & 106 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,137 +1,56 @@
# bugsnap-iOS
## [fastlane match](https://docs.fastlane.tools/actions/match/)

An iOS Library enabling users to report bugs directly from their mobile device.
This repository contains all your certificates and provisioning profiles needed to build and sign your applications. They are encrypted using OpenSSL via a passphrase.

# Integration
**Important:** Make sure this repository is set to private and only your team members have access to this repo.

## Source Code Integration
Do not modify this file, as it gets overwritten every time you run _match_.

### CocoaPods
### Installation

**BugSnap** can be integrated with **CocoaPods**. In order to get familiar with **CocoaPods** take a look [here](https://cocoapods.org/). On your **Podfile** you need to add the **Pod** for **BugSnap**:
Make sure you have the latest version of the Xcode command line tools installed:

```
pod 'BugSnap', :git => 'https://github.com/GrioSF/bugsnap-iOS.git'
xcode-select --install
```

If you're using **SSH** you can change the line above for the following:
Install _fastlane_ using

```
pod 'BugSnap', :git => '[email protected]:GrioSF/bugsnap-iOS.git'
[sudo] gem install fastlane -NV
```

For testing the framework as a development POD you can download the repo and use the following sintax:

```
pod ‘BugSnap’, :path => ‘~/path-where-you-downloaded-the-repo/bug-snap-ios’
```

*Note*: We'll update when the pod is public.

## Enabling the Shake Gesture and JIRA Integration
or alternatively using `brew cask install fastlane`

After you integrate the source code of the framework **bugsnap** you only need to setup your own parameters for connecting to JIRA and enable the shake gesture detection. In order to do that, you need to add the folllowing lines (it's preferrable in the AppDelegate):
### Usage

```swift
import BugSnap
Navigate to your project folder and run

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

...
// Enable the shake gesture through UIApplication extension
UIApplication.shared.enableShakeGestureSnap()
...
}
```

For configuring your connection with JIRA there're a few ways to achieve it:

1) Hard coding the connection URL and provide the credentials at runtime with the login form presented when you try to upload a ticket to JIRA:

```swift
import BugSnap
...

// At the application delegate
// Configure your server here
JIRARestAPI.sharedInstance.serverURL = URL(string:"#put your jira server here")

// When the form appears, provide you user/API Token for JIRA
...
fastlane match appstore
```

2) Hard coding the connection URL and the credentials in your source code. The API Key is generated in [JIRA API Tokens](https://id.atlassian.com/manage/api-tokens)

```swift
import BugSnap
...
// At the application delegate
// Configure your server here
JIRARestAPI.sharedInstance.serverURL = URL(string:"#put your jira server here")
// Setup your credentails here
JIRARestAPI.sharedInstance.setupConnection(userName: "#your user email for JIRA", apiToken: "#Your API Key")
```

3) Use the Info.plist file for your build and setup the following lines (as strings):

fastlane match adhoc
```
JIRA.URL = '#Your JIRA server'
JIRA.User = '#Your JIRA email for authentication'
JIRA.APIKey = '#Your JIRA API Token key'
```

Once you setup these keys in the Info.plist, you need to instruct the library to load them from there; achieving this is easy with the following line:

```swift
import BugSnap

...
// At the application delegate
do {
try JIRARestAPI.sharedInstance.loadConnectionParameters()
}
catch{
print("Error while configuring JIRA connection \(error)")
}
...
fastlane match development
```

In any case you'll be prompted with the user name/ api token to confirm the credentials and it will try to ping the projects names (fetching only one) in order to verify everything was successfully setup.

## Enabling Log Capture

BugSnap has a feature for **redirecting** the **stderr** to files allowing the target App to attach the last two log files to the issue created in **JIRA**. In order to enable such feature you only have to make the following call in your AppDelegate:

```swift
import BugSnap

...
UIApplication.shared.redirectLogging()
...
```
fastlane match enterprise
```

Such call will have default parameters for the Log files monitoring and creationg. The API exposed allows to set the approximate file size in kilobytes and the maximum number of files that should reside in the **Logs** directory. In any case, if you wan to download the **sandbox** filesystem with **Xcode** you'll find the log files in the **Caches** subdirectory in the **sandbox** file system. When started the redirection, **BugSnap** will create a new file and will redirect the **stderr** to such file. The benefit of this feature is that statements with **NSLog** will go to these files, so no code change will be required and you can log as required in order to debug your app. Furthermore, **BugSnap** will also monitor the filesystem under the **Logs** directory to allow a maximum number of files. The **Swift** declaration for the method in the UIApplication extension is:
For more information open [fastlane match git repo](https://docs.fastlane.tools/actions/match/)

```swift
@objc func redirectLogging( maxFileSize : UInt = 1024 , maxFiles : UInt = 5) {
...
}
```
### Content

So by default **BugSnap** will have files of approximately 1 MegaByte and a maximum number of five of these files. Since in each run a new file is created, the test run will contain just the latest log data generated by your app. To minimize the amount of information sent to **JIRA** only the last two files are attached as a single **Log** file.
#### certs

If you want to handle the data of these **Log** files in your app, you can do so with an API exposed by **BugSnap** allowing to gather a single **Data** object with the contents (in order) of the last **n** log files with the **UIApplication** extension provided:
This directory contains all your certificates with their private keys

```swift
@objc static func lastLogs( numFiles : UInt = 2) -> Data? {
...
}
```
This method is exactly the same method used to gather log data and upload it to **JIRA** as an attachment to the issue created.
#### profiles

This directory contains all provisioning profiles

# DEMO App Version Management
------------------------------------

Version management is done via fastlane. Please check the project specific [fastlane commands](fastlane/README.md) for more details.
For more information open [fastlane match git repo](https://docs.fastlane.tools/actions/match/)
33 changes: 33 additions & 0 deletions certs/development/9QQP9P34K2.cer
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
U2FsdGVkX19U8fR8h7X8hPNu9YnBhGuB83Vm0pC0vmBMP6AxLajRITMZaMVN
gt3eIBILnstuZmNPaVy1q0KfWBagEV8R/+i8vnumckuLGL7LMd7q2p4VMo2C
8fJdVE8sbb/EL/lCxfEMSfppOTRJlsXqjPQ0KS/+YtKXIZb8Ts3e74QDhMQE
yz8J0PLvg4B1W4r/mbssAExuAaLg3idqo5zV/R0jrl9qByu33lRJuFrJQDVP
qRPdcLQGhLq2I88jiG6gZYVKQTmmfAsEBo2EsRLLKYuNvLl4Y58QxPJe6PLP
BaqFqi36DBDzvG/x5pwj0FG45toIIvmigoTkh86gQEyZTFye4W+j04xCVaYh
HhqLJcNqzHrh0Xzl2FVXOTNaQSZahAyE742x/hGywL4O3RbsYlKhvqGP3Q0H
97uG/9VlvFEHKbe1uoORu2EQWROmjAvSqxkM/K0YGS9hKm3qB47w1PlCDBV1
tx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1BssF00dxjmBTGS1vg0T5p8xvhFEUJv
fqtGCu0imACMZMlX7oG2ZQndFJwSlQIZ0vU0uExcUF/wRUhz1OdpmK08Zn/R
fdUf58fJo80Rk/pU+cmatXUv9vlY0s+ujnonteKTBLf0kERlv7jLhZu2kGZX
9KB7FatzmR+6vM/gtc8ZnygX3/SKw4aTF7lbZnxgfnzfSForUW/JqpKqpbu6
wQuI5fmXEcMbTXOOVuwLMOzau8Z8KRP1oAQNSXIF5EO1Tu42ilE4DJCFV3XU
Bk8nLMQBGHduFBiBA7QhrY9E1jbe9/xL69zBcioffkeuc9knwYFs/PUPTRdI
PRz0CDx1q0DgQTjBA3KyuuyavQM8NtvTjUQfjeJ/AJh6q2f2lTSBsbo4Ujxm
VOr84MkUDQ32auhvAKn9HA==
38 changes: 38 additions & 0 deletions certs/development/9QQP9P34K2.p12
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
U2FsdGVkX18Kze0sJjqCMPOoNjggduwfWzKSyCXC9UlKESsw4riXIyNcJ65H
E0tTABRkR7M+0+U4gBuIq6HPEsu+ox/vLovltQ6LJ4s0UwRHEHRcwwdu1vJu
3TKmqB7Vq+UR/OzaLz9gRh/Ptcysy57HPO/hP6Ff7RLtiDN1ersEQllCERGm
Px8WLwxDnP5ombo+0wuS9yNURgrfO07nkY3/HPaDZlZKDyQSJfCwx0zqyj1P
LLdbu/ZqUoWFdev0BiRcZSISXk+XE0XCDbxCHxyl+vz6a156TFL0qv0w7Wsx
ZxKo0oC17t4zSQdWv1Ecmae5cPagPZvafbdcve85bMhjfS63+VI29/fvkyBz
718nF47WUKnEsMCHhUjkQX2Djg6XKKRypi5eziUhxVnFSA3XAjiTq6Ggm08W
Spq8u2AIEjyFATrHp2M8w7REqwj0cE3z3e6AdBhqSIS1ah7ib5zii3LD6hiQ
rQSSSO1c0QCLdOeVpAyiNK8PafoulSKXk1Z0dT+m/naeHt3go/NyRdMgjl0Y
NsB7t24JJbo3qP2G81K5xPp+Z+N7+Ov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pKrtf2UeXBkbGjpdIAuMjptvv4X3Woh6+h4SUnQxs4n8f0aWOBdQgT
bcyR7tFkj7dTy7RchfRXg8LhY9xHDNE46zvsxdY1bMkhW3idFrptxnWhZszy
+2PCbYCPsKb98WQcAZKvqsWe/7bXBYTZ/PNtGynuSZH00p520V4D0GyM9qNL
kdcgMQxJ6V33TDEYfYMMNCfifYcttkML2wNyPgrjrpoTM4D8HVz1qqdhbKYk
xjQdBfIWLZxE/eTVCfuPQb2ehiudNjvQyavUbZFU3x3moW/qySnchBGwdq0Y
blVDEg9Q36KzLVfI/55RTeoW4Sa+ZR1if1LvfzjQIC4tpyAwgjcEEI3uDCFT
J3N8xarUq4ZyWVFYJ1R7WC0ItG3vz4l+I4kBiGriV3m2gPQaah5cKnn1EL6O
cSrkp5Vuu4Wj0SeL+tmvQ0LSFi0KVQYxboyWICpgKi1z5t9Q3Gv4/kYd74DV
N8EsfAd/15rBZkY48jDrYXqRD8M8yVZSEhkFM9XZnipNT+f4nVsjrCc1j1ZE
NF6qw3qUiIX5mc1EO3yCE0HOa6WTsJdJy9vmWpeKquoQNCFWFt0q06fCWuoR
yO9Nl79JeCNnJAymR9FAhg1FiGiD7uX9l84qPfwjVw==
1 change: 1 addition & 0 deletions match_version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.127.1
Loading

0 comments on commit 06586a4

Please sign in to comment.