flutter_rb 1.2.2 → 1.2.3
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 +4 -4
- data/bin/cli.rb +148 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec74e4a22e3c03a2ac5b9febb602b419b92bb19e1574b4da9aad4456f0051de1
|
4
|
+
data.tar.gz: 3c4febcc88f4a79c469276b5a445c794937837b63b2cbc490a644d994ba9ab16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8fb36b1d3e4c05f610dd486842d992b8345a3894bfc818e6beb62e0c93de2dd6116cfd153df098acc70f61c0efaac91e1a00da7a1428dc940014a7e3a7e4055
|
7
|
+
data.tar.gz: a2e659962f72aa5fd98510e4c434a35f4680db6ced9c7b60ef4dabdb6c944d57ce424a1089e06ae61df089c387579df039c4ce24118d6649c73699b22c5ce073
|
data/bin/cli.rb
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry/cli'
|
4
|
+
require 'rubygems'
|
5
|
+
require 'yaml'
|
6
|
+
|
7
|
+
module CLI
|
8
|
+
# Module for all CLI commands.
|
9
|
+
module Commands
|
10
|
+
extend Dry::CLI::Registry
|
11
|
+
|
12
|
+
# This class represents the inspect command for the CLI.
|
13
|
+
# It inherits from Dry::CLI::Command and provides functionality to inspect Dart/Flutter projects.
|
14
|
+
class Inspect < ::Dry::CLI::Command
|
15
|
+
# Description of the command.
|
16
|
+
# This will be displayed when the user runs `flutter-rb help inspect`.
|
17
|
+
desc 'Inspects Dart/Flutter project'
|
18
|
+
|
19
|
+
# Option for specifying the path to the Dart/Flutter project.
|
20
|
+
# If not provided, the current working directory will be used.
|
21
|
+
option :path,
|
22
|
+
default: '',
|
23
|
+
desc: 'Path to Dart/Flutter project. If empty, flutter-rb uses current path'
|
24
|
+
|
25
|
+
# Option for specifying the report system format.
|
26
|
+
# If not provided, no report will be generated.
|
27
|
+
option :report,
|
28
|
+
default: '',
|
29
|
+
values: ['', 'checkstyle'],
|
30
|
+
desc: "Report system format. If empty, flutter-rb won't generate report"
|
31
|
+
|
32
|
+
# The main method of the command.
|
33
|
+
# This method is called when the user runs `flutter-rb inspect`.
|
34
|
+
#
|
35
|
+
# Parameters:
|
36
|
+
# - options: A hash containing the command-line options.
|
37
|
+
#
|
38
|
+
# Returns:
|
39
|
+
# nil: This method does not return any value. It only performs an action.
|
40
|
+
def call(**options)
|
41
|
+
# Create a new instance of FlutterRb::FlutterRb.
|
42
|
+
flutter_rb = FlutterRb::FlutterRb.new
|
43
|
+
|
44
|
+
# Fetch the path and report options from the command-line options.
|
45
|
+
path = options.fetch(:path)
|
46
|
+
report = options.fetch(:report)
|
47
|
+
|
48
|
+
# Start the inspection process with the provided path and report option.
|
49
|
+
flutter_rb.start(
|
50
|
+
path.empty? ? ::Dir.pwd : path,
|
51
|
+
report == options.fetch(:report)
|
52
|
+
)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# This class represents the version command for the CLI.
|
57
|
+
# It inherits from Dry::CLI::Command and provides functionality to print the current version of flutter-rb.
|
58
|
+
class Version < ::Dry::CLI::Command
|
59
|
+
# Description of the command.
|
60
|
+
# This will be displayed when the user runs `flutter-rb help version`.
|
61
|
+
desc 'Prints using version of flutter-rb'
|
62
|
+
|
63
|
+
# The main method of the command.
|
64
|
+
# This method is called when the user runs `flutter-rb version`.
|
65
|
+
#
|
66
|
+
# Returns:
|
67
|
+
# nil: This method does not return any value. It only prints the version to the console.
|
68
|
+
def call
|
69
|
+
# Load the flutter-rb gemspec file to get the version.
|
70
|
+
# The gemspec file contains metadata about the gem.
|
71
|
+
spec = Gem::Specification.load('flutter_rb.gemspec')
|
72
|
+
|
73
|
+
# Print the version to the console.
|
74
|
+
puts spec.version
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# This class represents the author command for the CLI.
|
79
|
+
# It inherits from Dry::CLI::Command and provides functionality to print the author of flutter-rb.
|
80
|
+
class Author < ::Dry::CLI::Command
|
81
|
+
# Description of the command.
|
82
|
+
# This will be displayed when the user runs `flutter-rb help author`.
|
83
|
+
desc 'Prints the author of flutter-rb'
|
84
|
+
|
85
|
+
# The main method of the command.
|
86
|
+
# This method is called when the user runs `flutter-rb author`.
|
87
|
+
#
|
88
|
+
# Returns:
|
89
|
+
# nil: This method does not return any value. It only prints the author's information to the console.
|
90
|
+
def call
|
91
|
+
# Load the flutter-rb gemspec file to get the author's information.
|
92
|
+
# The gemspec file contains metadata about the gem.
|
93
|
+
spec = Gem::Specification.load('flutter_rb.gemspec')
|
94
|
+
|
95
|
+
# Print the author's information to the console.
|
96
|
+
puts "Authors: #{spec.authors.join(', ').strip}"
|
97
|
+
puts "Email: #{spec.email}"
|
98
|
+
puts "Homepage: #{spec.homepage}"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
# This class represents the config command for the CLI.
|
103
|
+
# It inherits from Dry::CLI::Command and provides functionality to create a configuration file.
|
104
|
+
class Config < ::Dry::CLI::Command
|
105
|
+
# Description of the command.
|
106
|
+
# This will be displayed when the user runs `flutter-rb help config`.
|
107
|
+
desc 'Creates a config file'
|
108
|
+
|
109
|
+
# The main method of the command.
|
110
|
+
# This method is called when the user runs `flutter-rb config`.
|
111
|
+
#
|
112
|
+
# Returns:
|
113
|
+
# nil: This method does not return any value. It only creates a configuration file.
|
114
|
+
def call
|
115
|
+
# Write an empty string to a file named '.flutter-rb.yaml' in the current directory.
|
116
|
+
# This will create a new configuration file.
|
117
|
+
File.write('.flutter-rb.yaml', '')
|
118
|
+
|
119
|
+
# Print a success message to the console.
|
120
|
+
puts 'Config file created!'
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
register 'inspect', Inspect.new, aliases: ['i']
|
125
|
+
register 'version', Version.new, aliases: ['v']
|
126
|
+
register 'author', Author.new, aliases: ['a']
|
127
|
+
register 'config', Config.new, aliases: ['c']
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
# rubocop:disable Layout/LineLength
|
132
|
+
#
|
133
|
+
if ::ARGV.empty?
|
134
|
+
puts '⚠️ WARNING ⚠️'.colorize(:yellow)
|
135
|
+
puts '👉 You are using legacy CLI for flutter-rb. To migrate to new CLI, you need to read documentation by following link: https://github.com/flutter-rb/flutter-rb/'
|
136
|
+
puts '👉 This message are showing only for versions that supports legacy CLI.'
|
137
|
+
puts '👉 You will need to upgrade your build setup for new CLI because old version will be removed in future versions of flutter-rb.'
|
138
|
+
puts '👉 If you have any questions, feel free to open an issue in our repository by following link: https://github.com/flutter-rb/flutter-rb/issues/new'
|
139
|
+
puts "\n"
|
140
|
+
|
141
|
+
flutter_rb = FlutterRb::FlutterRb.new
|
142
|
+
|
143
|
+
flutter_rb.start(::Dir.pwd, true)
|
144
|
+
else
|
145
|
+
::Dry::CLI.new(::CLI::Commands).call
|
146
|
+
end
|
147
|
+
|
148
|
+
# rubocop:enable Layout/LineLength
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flutter_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Artem Fomchenkov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoapods
|
@@ -146,6 +146,7 @@ extra_rdoc_files:
|
|
146
146
|
files:
|
147
147
|
- LICENSE
|
148
148
|
- README.md
|
149
|
+
- bin/cli.rb
|
149
150
|
- bin/frb
|
150
151
|
- lib/checkstyle_report/checkstyle_report.rb
|
151
152
|
- lib/flutter_rb.rb
|