fastlane-plugin-number_of_swift_lines 0.1.0 → 0.2.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '080c728e50a90f2ee634cc5314706462f9c08035'
|
4
|
+
data.tar.gz: 0f8b91ece89e7e50780d97c95953c57fe09546f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c468309674d66286b657263b2622f2ba1f98b8212eabe39ce55eb194d95545826a4aaf6eb4e0064552451194893b12132f128477eb6ef60148889016eaf565a6
|
7
|
+
data.tar.gz: d0e75e7b95268cb7919c93d3bb6938de7e743d402bf80a2125f56b943186a07e28d5a70836a72b88a085498c1096716f2dbc81404701f4c978fa0d5c2d7b0162
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@ fastlane add_plugin number_of_swift_lines
|
|
12
12
|
|
13
13
|
## About number_of_swift_lines
|
14
14
|
|
15
|
-
Outputs the total number of swift
|
15
|
+
Outputs the total number of lines of swift code, number of swift files, and a list of the most largest swift files.
|
16
16
|
|
17
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
18
|
|
@@ -1,46 +1,96 @@
|
|
1
1
|
module Fastlane
|
2
2
|
module Actions
|
3
|
+
module SharedValues
|
4
|
+
NUMBER_OF_SWIFT_LINES_IN_LARGEST_FILES = :NUMBER_OF_SWIFT_LINES_IN_LARGEST_FILES
|
5
|
+
NUMBER_OF_SWIFT_FILES = :NUMBER_OF_SWIFT_FILES
|
6
|
+
NUMBER_OF_SWIFT_LINES = :NUMBER_OF_SWIFT_LINES
|
7
|
+
end
|
8
|
+
|
3
9
|
class NumberOfSwiftLinesAction < Action
|
4
10
|
def self.run(params)
|
5
11
|
require 'artii'
|
6
|
-
|
7
|
-
|
12
|
+
|
13
|
+
number_of_largest_files = params[:largest_files_cap]
|
14
|
+
show_ascii = params[:enable_ascii_art]
|
15
|
+
exclude_regex = params[:files_exclude_regex]
|
16
|
+
|
17
|
+
current_dir = Dir.pwd
|
18
|
+
swift_files = `find #{current_dir} -name \"*.swift\" | egrep -v \"#{exclude_regex}\"`
|
19
|
+
if swift_files.empty?
|
20
|
+
UI.error("No swift files found :(")
|
8
21
|
exit 1
|
9
22
|
end
|
10
23
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
24
|
+
number_of_files = `echo '#{swift_files}' | wc -l | awk '{print $1}'`
|
25
|
+
number_of_lines = `echo '#{swift_files}' | xargs wc -l | tail -1 | awk '{print $1}'`
|
26
|
+
largest_files = `echo '#{swift_files}' | xargs wc -l | sort -n | tail -'#{number_of_largest_files.to_s}' | head -'#{(number_of_largest_files-1).to_s}'`
|
27
|
+
number_of_lines_largest_file = `echo '#{swift_files}' | xargs wc -l | sort -n | tail -2 | head -1 | awk '{print $1}'`
|
28
|
+
|
29
|
+
ascii_message = ""
|
30
|
+
if show_ascii == true then
|
31
|
+
a = Artii::Base.new :font => 'univers'
|
32
|
+
ascii_message = a.asciify(number_of_lines_largest_file)
|
33
|
+
ascii_message += a.asciify(number_of_files)
|
34
|
+
ascii_message += a.asciify(number_of_lines)
|
35
|
+
end
|
36
|
+
|
37
|
+
UI.message("\n\n" + "The " + number_of_largest_files.to_s + " largest files in ascending order:\n\n" + largest_files \
|
38
|
+
+ "\n\nNumber of lines in the largest swift file:\t" + number_of_lines_largest_file \
|
39
|
+
+ "Total number of swift files:\t\t\t" + number_of_files \
|
40
|
+
+ "Total number of swift lines of code:\t\t" + number_of_lines + "\n"\
|
41
|
+
+ ascii_message)
|
42
|
+
|
43
|
+
Actions.lane_context[SharedValues::NUMBER_OF_SWIFT_LINES_IN_LARGEST_FILES] = number_of_lines_largest_file
|
44
|
+
Actions.lane_context[SharedValues::NUMBER_OF_SWIFT_FILES] = number_of_files
|
45
|
+
Actions.lane_context[SharedValues::NUMBER_OF_SWIFT_LINES] = number_of_lines
|
46
|
+
|
17
47
|
end
|
18
48
|
|
19
49
|
def self.description
|
20
|
-
"Outputs the total number of swift
|
50
|
+
"Outputs the total number of lines of swift code, number of swift files, and a list of the largest swift files."
|
21
51
|
end
|
22
52
|
|
23
53
|
def self.authors
|
24
|
-
["
|
54
|
+
["@BinaryDennis"]
|
25
55
|
end
|
26
56
|
|
27
57
|
def self.return_value
|
28
58
|
# If your method provides a return value, you can describe here what it does
|
59
|
+
[
|
60
|
+
['NUMBER_OF_SWIFT_LINES_IN_LARGEST_FILES', 'The number of lines in the largets swift file'],
|
61
|
+
['NUMBER_OF_SWIFT_FILES', 'The total number of swift files'],
|
62
|
+
['NUMBER_OF_SWIFT_LINES', 'The total number of swift lines in all swift files']
|
63
|
+
]
|
29
64
|
end
|
30
65
|
|
31
66
|
def self.details
|
32
67
|
# Optional:
|
33
|
-
"Using ASCII art to output the total number of code lines written in Swift, excluding all the lines used in unit & UI tests"
|
68
|
+
"Using ASCII art to output the total number of code lines written in Swift, excluding all the lines used in unit & UI tests. But also outputs the total number of swift files and a list of the largest swift files."
|
34
69
|
end
|
35
70
|
|
36
71
|
def self.available_options
|
37
72
|
[
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
73
|
+
FastlaneCore::ConfigItem.new(key: :largest_files_cap,
|
74
|
+
env_name: "LARGEST_FILES_CAP",
|
75
|
+
description: "Determines how many files to list, when showing the largets files",
|
76
|
+
optional: true,
|
77
|
+
default_value: 10,
|
78
|
+
type: Integer),
|
79
|
+
|
80
|
+
FastlaneCore::ConfigItem.new(key: :enable_ascii_art,
|
81
|
+
env_name: "ENABLE_ASCII_ART",
|
82
|
+
description: "If enabled, shows the total number of swift lines in ASCII art",
|
83
|
+
optional: true,
|
84
|
+
default_value: true,
|
85
|
+
type: [TrueClass, FalseClass]),
|
86
|
+
|
87
|
+
FastlaneCore::ConfigItem.new(key: :files_exclude_regex,
|
88
|
+
env_name: "FILES_EXCLUDE_REGEX",
|
89
|
+
description: "Regex string used with grep to exclude files from the list of all swift files",
|
90
|
+
optional: true,
|
91
|
+
default_value: "(/Tests|/Pods|/Frameworks|/Carthage)",
|
92
|
+
type: String)
|
93
|
+
]
|
44
94
|
end
|
45
95
|
|
46
96
|
def self.is_supported?(platform)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-number_of_swift_lines
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dennis Charmington
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: artii
|
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
168
|
version: '0'
|
169
169
|
requirements: []
|
170
170
|
rubyforge_project:
|
171
|
-
rubygems_version: 2.
|
171
|
+
rubygems_version: 2.5.2
|
172
172
|
signing_key:
|
173
173
|
specification_version: 4
|
174
174
|
summary: Outputs the total number of swift lines
|