fastlane-plugin-changelog 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +75 -0
- data/lib/fastlane/plugin/changelog.rb +16 -0
- data/lib/fastlane/plugin/changelog/actions/changelog_action.rb +35 -0
- data/lib/fastlane/plugin/changelog/actions/read_changelog.rb +116 -0
- data/lib/fastlane/plugin/changelog/helper/changelog_helper.rb +12 -0
- data/lib/fastlane/plugin/changelog/version.rb +5 -0
- metadata +135 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 403f4a4eb9682c5266b064684cee9bd8229d6fa8
|
4
|
+
data.tar.gz: 791cb83f660b2d973251645b8ce15864d270f7e4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0648cc5b024200347b5e152c0eddbcd9acb72e4f6f0c981ac8d8e69bb867ce02a9ddeab78bff6364019779d2fb1fdf74befed8497be608b9eeeb8f92e958eb0b
|
7
|
+
data.tar.gz: c72e5212b39488c5a2742f5436045557a12507e0900016ff5cb9cd36823d4fe5f607ef2451761507ac70c076291ba2c434a4a1436508adcf55daf1ec4f37543c
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Pavel Procházka <pprochazka72@gmail.com>
|
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,75 @@
|
|
1
|
+
# changelog plugin
|
2
|
+
|
3
|
+
[![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-changelog)
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-changelog`, add it to your project by running:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
fastlane add_plugin changelog
|
11
|
+
```
|
12
|
+
|
13
|
+
## About changelog
|
14
|
+
|
15
|
+
This plugin is inspired and based on [Keep a CHANGELOG](http://keepachangelog.com/) project. [Keep a CHANGELOG](http://keepachangelog.com/) proposes a standardised format for keeping change log of your project repository in CHANGELOG.md file. This file contains a curated, chronologically ordered list of notable changes for each version of a project in human readable format.
|
16
|
+
|
17
|
+
Since [Keep a CHANGELOG](http://keepachangelog.com/) project proposes a well-defined structure with _sections_ (e.g.: `[Unreleased]`, `0.3.0]`) and _subsections_ (`Added`, `Changed`, `Deprecated`, `Removed`, `Fixed`, `Security`) it opens up an opportunity to automate reading from/writing to CHANGELOG.md with [`fastlane`](https://fastlane.tools).
|
18
|
+
|
19
|
+
## Getting started
|
20
|
+
1. `cd` to your project folder
|
21
|
+
2. `touch CHANGELOG.md`
|
22
|
+
3. open CHANGELOG.md in your favourite text editor
|
23
|
+
4. paste the following: `## [Unreleased]`
|
24
|
+
|
25
|
+
## Actions
|
26
|
+
|
27
|
+
### read_changelog
|
28
|
+
|
29
|
+
Reads the content of a section from your project's `CHANGELOG.md` file. `CHANGELOG.md` must follow structure proposed by [Keep a CHANGELOG](http://keepachangelog.com/) project.
|
30
|
+
|
31
|
+
``` ruby
|
32
|
+
read_changelog # Reads the "Unreleased" section from CHANGELOG.md in your project's folder
|
33
|
+
```
|
34
|
+
|
35
|
+
``` ruby
|
36
|
+
read_changelog(
|
37
|
+
changelog_path: './custom_folder/CHANGELOG.md', # Specify path to CHANGELOG.md
|
38
|
+
section_identifier: '[Unreleased]', # Specify what section to read
|
39
|
+
excluded_markdown_elements: '["###"]' # Specify which markdown elements should be excluded
|
40
|
+
)
|
41
|
+
```
|
42
|
+
|
43
|
+
Use the output of this action in conjunction with for example [`pilot`](https://github.com/fastlane/fastlane/tree/master/pilot#uploading-builds) to upload your change log to TestFlight or with [`github_release`](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md#github-releases) to create a new release on Github.
|
44
|
+
|
45
|
+
### write_changelog
|
46
|
+
*Coming soon*
|
47
|
+
|
48
|
+
|
49
|
+
## Example
|
50
|
+
As a developer you have to **remember to keep your CHANGELOG.md up-to-date** with whatever features, bug fixes etc. your repo contains and let [`fastlane`](https://fastlane.tools) to do the rest.
|
51
|
+
|
52
|
+
``` ruby
|
53
|
+
lane :beta do
|
54
|
+
gym
|
55
|
+
changelog = read_changelog
|
56
|
+
pilot(changelog: changelog)
|
57
|
+
# write_changelog
|
58
|
+
end
|
59
|
+
```
|
60
|
+
|
61
|
+
## Issues and Feedback
|
62
|
+
|
63
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
64
|
+
|
65
|
+
## Troubleshooting
|
66
|
+
|
67
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/PluginsTroubleshooting.md) doc in the main `fastlane` repo.
|
68
|
+
|
69
|
+
## Using `fastlane` Plugins
|
70
|
+
|
71
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Plugins.md).
|
72
|
+
|
73
|
+
## About `fastlane`
|
74
|
+
|
75
|
+
`fastlane` is the easiest way to automate building and releasing your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fastlane/plugin/changelog/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module Changelog
|
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::Changelog.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class ChangelogAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
UI.message("The changelog plugin is working!")
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.description
|
9
|
+
"Automate changes to your project CHANGELOG.md"
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.authors
|
13
|
+
["Pavel Prochazka"]
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.available_options
|
17
|
+
[
|
18
|
+
# FastlaneCore::ConfigItem.new(key: :your_option,
|
19
|
+
# env_name: "CHANGELOG_YOUR_OPTION",
|
20
|
+
# description: "A description of your option",
|
21
|
+
# optional: false,
|
22
|
+
# type: String)
|
23
|
+
]
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.is_supported?(platform)
|
27
|
+
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
28
|
+
# See: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
|
29
|
+
#
|
30
|
+
# [:ios, :mac, :android].include?(platform)
|
31
|
+
true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
module SharedValues
|
4
|
+
READ_CHANGELOG_SECTION_CONTENT = :READ_CHANGELOG_SECTION_CONTENT
|
5
|
+
end
|
6
|
+
|
7
|
+
class ReadChangelogAction < Action
|
8
|
+
|
9
|
+
def self.run(params)
|
10
|
+
changelog_path = params[:changelog_path] unless (params[:changelog_path].to_s.empty?)
|
11
|
+
UI.error("CHANGELOG.md at path '#{changelog_path}' does not exist") unless (File.exist?(changelog_path))
|
12
|
+
|
13
|
+
section_identifier = params[:section_identifier] unless (params[:section_identifier].to_s.empty?)
|
14
|
+
escaped_section_identifier = section_identifier[/\[(.*?)\]/,1]
|
15
|
+
|
16
|
+
excluded_markdown_elements = params[:excluded_markdown_elements]
|
17
|
+
|
18
|
+
UI.message "Starting to read #{section_identifier} section from '#{changelog_path}' "
|
19
|
+
|
20
|
+
section_content = ""
|
21
|
+
found_section = false
|
22
|
+
File.open(changelog_path, "r") do |file|
|
23
|
+
file.each_line do |line|
|
24
|
+
|
25
|
+
if found_section
|
26
|
+
break if line =~ /\#{2}\s?\[(.*?)\]/
|
27
|
+
if !excluded_markdown_elements.nil? && !excluded_markdown_elements.empty?
|
28
|
+
markdownless_line = remove_markdown(line, excluded_markdown_elements)
|
29
|
+
section_content.concat(markdownless_line)
|
30
|
+
else
|
31
|
+
section_content.concat(line)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
if line =~ /\#{2}\s?\[#{escaped_section_identifier}\]/
|
36
|
+
found_section = true
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
UI.error("Could not find #{section_identifier} section in your CHANGELOG.md") unless (!section_content.empty?)
|
43
|
+
|
44
|
+
UI.success("Finished reading #{section_identifier} section from '#{changelog_path}'") unless (section_content.empty?)
|
45
|
+
|
46
|
+
Actions.lane_context[SharedValues::READ_CHANGELOG_SECTION_CONTENT] = section_content
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.remove_markdown(line, excluded_markdown_elements)
|
50
|
+
markdownless_line = line
|
51
|
+
excluded_markdown_elements.each do |element|
|
52
|
+
if line =~ /^#{element}/
|
53
|
+
markdownless_line = markdownless_line.gsub(element.to_s, "")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
markdownless_line
|
58
|
+
end
|
59
|
+
|
60
|
+
#####################################################
|
61
|
+
# @!group Documentation
|
62
|
+
#####################################################
|
63
|
+
|
64
|
+
def self.description
|
65
|
+
"Reads content of a section from your project CHANGELOG.md file"
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.details
|
69
|
+
"This action is inspired by \"Keep a CHANGELOG\" project (see http://keepachangelog.com/). \"Keep a CHANGELOG\" introduces a structed CHANGELOG.md file,
|
70
|
+
which contains a curated, chronologically ordered list of notable changes for each version of a project. Use this action to read content of a section
|
71
|
+
from your project's CHANGELOG.md."
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.available_options
|
75
|
+
[
|
76
|
+
FastlaneCore::ConfigItem.new(key: :changelog_path,
|
77
|
+
env_name: "FL_READ_CHANGELOG_PATH_TO_CHANGELOG",
|
78
|
+
description: "The path to your project CHANGELOG.md",
|
79
|
+
is_string: true,
|
80
|
+
default_value: "./CHANGELOG.md",
|
81
|
+
optional: true),
|
82
|
+
FastlaneCore::ConfigItem.new(key: :section_identifier,
|
83
|
+
env_name: "FL_READ_CHANGELOG_SECTION_IDENTIFIER",
|
84
|
+
description: "The unique section identifier to read content of",
|
85
|
+
is_string: true,
|
86
|
+
default_value: "[Unreleased]",
|
87
|
+
optional: true,
|
88
|
+
verify_block: proc do |value|
|
89
|
+
UI.user_error!("Sections (##) in CHANGELOG format must be encapsulated in []") unless (value.start_with?("[") && value.end_with?("]"))
|
90
|
+
UI.user_error!("Sections (##) in CHANGELOG format cannot be empty") unless (!value[/\[(.*?)\]/,1].empty?)
|
91
|
+
end),
|
92
|
+
FastlaneCore::ConfigItem.new(key: :excluded_markdown_elements,
|
93
|
+
env_name: "FL_READ_CHANGELOG_EXCLUDED_MARKDOWN_ELEMENTS",
|
94
|
+
description: "Markdown elements you wish to exclude from the output",
|
95
|
+
type: Array,
|
96
|
+
default_value: ["###"],
|
97
|
+
optional: true)
|
98
|
+
]
|
99
|
+
end
|
100
|
+
|
101
|
+
def self.output
|
102
|
+
[
|
103
|
+
['READ_CHANGELOG_SECTION_CONTENT', 'Contains text from a section of your CHANGELOG.md file']
|
104
|
+
]
|
105
|
+
end
|
106
|
+
|
107
|
+
def self.authors
|
108
|
+
["pajapro"]
|
109
|
+
end
|
110
|
+
|
111
|
+
def self.is_supported?(platform)
|
112
|
+
true
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Helper
|
3
|
+
class ChangelogHelper
|
4
|
+
# class methods that you define here become available in your action
|
5
|
+
# as `Helper::ChangelogHelper.your_method`
|
6
|
+
#
|
7
|
+
def self.show_message
|
8
|
+
UI.message("Hello from the changelog plugin helper!")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-changelog
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Pavel Prochazka
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-06-25 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: rake
|
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: rubocop
|
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: fastlane
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.96.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.96.0
|
97
|
+
description:
|
98
|
+
email: pprochazka72@gmail.com
|
99
|
+
executables: []
|
100
|
+
extensions: []
|
101
|
+
extra_rdoc_files: []
|
102
|
+
files:
|
103
|
+
- lib/fastlane/plugin/changelog/actions/changelog_action.rb
|
104
|
+
- lib/fastlane/plugin/changelog/actions/read_changelog.rb
|
105
|
+
- lib/fastlane/plugin/changelog/helper/changelog_helper.rb
|
106
|
+
- lib/fastlane/plugin/changelog/version.rb
|
107
|
+
- lib/fastlane/plugin/changelog.rb
|
108
|
+
- README.md
|
109
|
+
- LICENSE
|
110
|
+
homepage: https://github.com/pajapro/fastlane-plugin-changelog
|
111
|
+
licenses:
|
112
|
+
- MIT
|
113
|
+
metadata: {}
|
114
|
+
post_install_message:
|
115
|
+
rdoc_options: []
|
116
|
+
require_paths:
|
117
|
+
- lib
|
118
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - '>='
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
requirements: []
|
129
|
+
rubyforge_project:
|
130
|
+
rubygems_version: 2.0.14.1
|
131
|
+
signing_key:
|
132
|
+
specification_version: 4
|
133
|
+
summary: Automate changes to your project CHANGELOG.md
|
134
|
+
test_files: []
|
135
|
+
has_rdoc:
|