fastlane-plugin-clang_format 1.0.0
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.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +50 -0
- data/lib/fastlane/plugin/clang_format.rb +16 -0
- data/lib/fastlane/plugin/clang_format/actions/clang_format_action.rb +91 -0
- data/lib/fastlane/plugin/clang_format/actions/run_clang_format.rb +81 -0
- data/lib/fastlane/plugin/clang_format/version.rb +5 -0
- metadata +188 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cd8fc84fc7900b6e559b7baf0182a6e5fe93bb0e11658409c99a810699f01674
|
4
|
+
data.tar.gz: 9e59c937a5d29fa73cd9e95de455971b04933dd3bcee763694d00b1aae51100e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 835903e4b00cc1c3d8d6be0f0f1b0ea582c112616b1bd63a598c3955387986e3ea0cbee820d52fd74601178504cba4c4a4bab3eac26138cb8dddb38fc5b9c6a7
|
7
|
+
data.tar.gz: c56c393508780f4df73acd9e7293b54ba4cf6ef24667e7ce96e8010589b1e09364666bc47fc23332bb441ca4bb2fdb3432b483ab9b333dd7665734382bcaca71
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Meniga <mobile.dev@meniga.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,50 @@
|
|
1
|
+
# clang_format plugin
|
2
|
+
|
3
|
+
[](https://rubygems.org/gems/fastlane-plugin-clang_format)
|
4
|
+
[](https://github.com/meniga/fastlane-plugin-clang_format)
|
5
|
+
[](https://codecov.io/gh/meniga/fastlane-plugin-clang_format)
|
6
|
+
|
7
|
+
## Getting Started
|
8
|
+
|
9
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-clang_format`, add it to your project by running:
|
10
|
+
|
11
|
+
```bash
|
12
|
+
fastlane add_plugin clang_format
|
13
|
+
```
|
14
|
+
|
15
|
+
## About clang_format
|
16
|
+
|
17
|
+
Format your C/C++/Java/JavaScript/Objective-C/Protobuf/C code with clang-format
|
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` or `bundle exec fastlane format`.
|
22
|
+
|
23
|
+
## Run tests for this plugin
|
24
|
+
|
25
|
+
To run both the tests, and code style validation, run
|
26
|
+
|
27
|
+
```
|
28
|
+
rake
|
29
|
+
```
|
30
|
+
|
31
|
+
To automatically fix many of the styling issues, use
|
32
|
+
```
|
33
|
+
rubocop -a
|
34
|
+
```
|
35
|
+
|
36
|
+
## Issues and Feedback
|
37
|
+
|
38
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
39
|
+
|
40
|
+
## Troubleshooting
|
41
|
+
|
42
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
43
|
+
|
44
|
+
## Using _fastlane_ Plugins
|
45
|
+
|
46
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
47
|
+
|
48
|
+
## About _fastlane_
|
49
|
+
|
50
|
+
_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/clang_format/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module ClangFormat
|
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::ClangFormat.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'fastlane'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module Actions
|
5
|
+
class ClangFormatAction < Action
|
6
|
+
def self.run(params)
|
7
|
+
clang_format_path = params[:clang_format_path]
|
8
|
+
clang_format_path ||= 'clang-format'
|
9
|
+
|
10
|
+
cmd = []
|
11
|
+
cmd << clang_format_path
|
12
|
+
inplace = params[:inplace]
|
13
|
+
cmd << "-i" if inplace
|
14
|
+
style = params[:style]
|
15
|
+
cmd << "--style=#{style}" if style
|
16
|
+
cmd << "--verbose" if params[:verbose]
|
17
|
+
files = params[:files]
|
18
|
+
Array(files).each do |file|
|
19
|
+
cmd << file
|
20
|
+
end
|
21
|
+
Actions.sh(cmd.join(' '))
|
22
|
+
UI.success('Everything is formatted correctly now! 💪')
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.description
|
26
|
+
"A tool to format C/C++/Java/JavaScript/Objective-C/Protobuf/C"
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.details
|
30
|
+
[
|
31
|
+
'If no arguments are specified, it formats the code from standard input',
|
32
|
+
'and writes the result to the standard output.',
|
33
|
+
'If :files are given, it reformats the files. If :inplace is specified',
|
34
|
+
'together with :files, the files are edited in-place. Otherwise, the',
|
35
|
+
'result is written to the standard output'
|
36
|
+
].join(' ')
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.available_options
|
40
|
+
[
|
41
|
+
FastlaneCore::ConfigItem.new(key: :clang_format_path,
|
42
|
+
env_name: 'FL_CLANG_FORMAT_PATH',
|
43
|
+
description: 'Path to clang-format if you want use it from specific path',
|
44
|
+
optional: true,
|
45
|
+
type: String),
|
46
|
+
FastlaneCore::ConfigItem.new(key: :inplace,
|
47
|
+
env_name: 'FL_CLANG_FORMAT_INPLACE',
|
48
|
+
description: 'Inplace edit :files, if specified',
|
49
|
+
optional: true,
|
50
|
+
default_value: false,
|
51
|
+
type: Boolean),
|
52
|
+
FastlaneCore::ConfigItem.new(key: :style,
|
53
|
+
env_name: 'FL_CLANG_FORMAT_STYLE',
|
54
|
+
description: [
|
55
|
+
'Coding style, currently supports:',
|
56
|
+
'LLVM, Google, Chromium, Mozilla, WebKit.',
|
57
|
+
'Use style:file to load style configuration from',
|
58
|
+
'.clang-format file located in one of the parent',
|
59
|
+
'directories of the source file (or current',
|
60
|
+
'directory for stdin).',
|
61
|
+
'Use style:"{key: value, ...}" to set specific',
|
62
|
+
'parameters, e.g.:',
|
63
|
+
'style:"{BasedOnStyle: llvm, IndentWidth: 8}"'
|
64
|
+
].join(' '),
|
65
|
+
optional: true,
|
66
|
+
default_value: true,
|
67
|
+
type: String),
|
68
|
+
FastlaneCore::ConfigItem.new(key: :verbose,
|
69
|
+
env_name: 'FL_CLANG_FORMAT_VERBOSE',
|
70
|
+
description: 'If true, shows the list of processed files',
|
71
|
+
optional: true,
|
72
|
+
default_value: false,
|
73
|
+
type: Boolean),
|
74
|
+
FastlaneCore::ConfigItem.new(key: :files,
|
75
|
+
env_name: 'FL_CLANG_FORMAT_FILES',
|
76
|
+
description: 'Array of files to check formatting',
|
77
|
+
optional: false,
|
78
|
+
type: Array)
|
79
|
+
]
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.authors
|
83
|
+
["Marcin Stepnowski"]
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.is_supported?(platform)
|
87
|
+
true
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'fastlane'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module Actions
|
5
|
+
class RunClangFormatAction < Action
|
6
|
+
def self.run(params)
|
7
|
+
script_path = params[:script_path]
|
8
|
+
script_path ||= Dir['run-clang-format.py'].first
|
9
|
+
UI.user_error!('run-clang-format.py not found, add file or pass path to it') if script_path.to_s.empty?
|
10
|
+
|
11
|
+
cmd = []
|
12
|
+
cmd << script_path
|
13
|
+
extensions = params[:extensions]
|
14
|
+
cmd << "--extensions" if extensions
|
15
|
+
cmd << extensions if extensions
|
16
|
+
clang_format_executable = params[:executable]
|
17
|
+
cmd << "--clang-format-executable" if clang_format_executable
|
18
|
+
cmd << clang_format_executable if clang_format_executable
|
19
|
+
cmd << '-r' if params[:recursive]
|
20
|
+
paths = params[:paths]
|
21
|
+
Array(paths).each do |path|
|
22
|
+
cmd << path
|
23
|
+
end
|
24
|
+
Actions.sh(Shellwords.join(cmd))
|
25
|
+
UI.success('Everything is formatted correctly, all good! 💪')
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.description
|
29
|
+
'Run clang format python script: https://github.com/Sarcasm/run-clang-format'
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.details
|
33
|
+
[
|
34
|
+
'A wrapper script around clang-format, suitable for linting multiple files and',
|
35
|
+
'to use for continuous integration. This is an alternative API for the clang-format',
|
36
|
+
'command line. It runs over multiple files and directories in parallel.',
|
37
|
+
'A diff output is produced and a sensible exit code is returned.'
|
38
|
+
].join(' ')
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.available_options
|
42
|
+
[
|
43
|
+
FastlaneCore::ConfigItem.new(key: :script_path,
|
44
|
+
env_name: 'FL_RUN_CLANG_FORMAT_SCRIPT_PATH',
|
45
|
+
description: 'Optional, you must specify the path to run-clang-format.py if it is not in the project root directory',
|
46
|
+
optional: true,
|
47
|
+
type: String),
|
48
|
+
FastlaneCore::ConfigItem.new(key: :extensions,
|
49
|
+
env_name: 'FL_RUN_CLANG_FORMAT_EXTENSIONS',
|
50
|
+
description: 'Comma separated list of file extensions (default: c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx)',
|
51
|
+
optional: true,
|
52
|
+
type: String),
|
53
|
+
FastlaneCore::ConfigItem.new(key: :recursive,
|
54
|
+
env_name: 'FL_RUN_CLANG_FORMAT_RECURSIVE',
|
55
|
+
description: 'Run recursively over directories',
|
56
|
+
optional: true,
|
57
|
+
default_value: true,
|
58
|
+
type: Boolean),
|
59
|
+
FastlaneCore::ConfigItem.new(key: :paths,
|
60
|
+
env_name: 'FL_RUN_CLANG_FORMAT_PATHS',
|
61
|
+
description: 'Array of path to check formatting',
|
62
|
+
optional: false,
|
63
|
+
type: Array),
|
64
|
+
FastlaneCore::ConfigItem.new(key: :executable,
|
65
|
+
env_name: 'FL_RUN_CLANG_FORMAT_EXECUTABLE',
|
66
|
+
description: 'Path to the clang-format executable',
|
67
|
+
optional: false,
|
68
|
+
type: String)
|
69
|
+
]
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.is_supported?(_platform)
|
73
|
+
true
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.authors
|
77
|
+
["Marcin Stepnowski"]
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
metadata
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-clang_format
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Meniga
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-03-16 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.142.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.142.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: codecov
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
description:
|
154
|
+
email: mobile.dev@meniga.com
|
155
|
+
executables: []
|
156
|
+
extensions: []
|
157
|
+
extra_rdoc_files: []
|
158
|
+
files:
|
159
|
+
- LICENSE
|
160
|
+
- README.md
|
161
|
+
- lib/fastlane/plugin/clang_format.rb
|
162
|
+
- lib/fastlane/plugin/clang_format/actions/clang_format_action.rb
|
163
|
+
- lib/fastlane/plugin/clang_format/actions/run_clang_format.rb
|
164
|
+
- lib/fastlane/plugin/clang_format/version.rb
|
165
|
+
homepage: https://github.com/meniga/fastlane-plugin-clang_format
|
166
|
+
licenses:
|
167
|
+
- MIT
|
168
|
+
metadata: {}
|
169
|
+
post_install_message:
|
170
|
+
rdoc_options: []
|
171
|
+
require_paths:
|
172
|
+
- lib
|
173
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
174
|
+
requirements:
|
175
|
+
- - ">="
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '0'
|
178
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
183
|
+
requirements: []
|
184
|
+
rubygems_version: 3.0.6
|
185
|
+
signing_key:
|
186
|
+
specification_version: 4
|
187
|
+
summary: Format your C/C++/Java/JavaScript/Objective-C/Protobuf/C code with clang-format
|
188
|
+
test_files: []
|