flutter_rb 0.8.2 → 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 +4 -4
- data/LICENSE +20 -20
- data/README.md +144 -144
- data/bin/frb +19 -19
- data/lib/checkstyle_report/checkstyle_report.rb +90 -90
- data/lib/flutter_rb/checks/check.rb +24 -24
- data/lib/flutter_rb/checks/plugin_directories_check.rb +33 -33
- data/lib/flutter_rb/checks/plugin_gradle_check.rb +57 -57
- data/lib/flutter_rb/checks/plugin_podspec_check.rb +109 -109
- data/lib/flutter_rb/checks/plugin_pubspec_check.rb +152 -152
- data/lib/flutter_rb/config/flutter_rb_config.rb +16 -16
- data/lib/flutter_rb/config/flutter_rb_config_initializer.rb +56 -56
- data/lib/flutter_rb/project/project.rb +53 -53
- data/lib/flutter_rb/project/specs/android/android_folder.rb +13 -13
- data/lib/flutter_rb/project/specs/android/gradle.rb +27 -27
- data/lib/flutter_rb/project/specs/flutter/dev_dependency.rb +11 -11
- data/lib/flutter_rb/project/specs/flutter/platform_plugin.rb +18 -18
- data/lib/flutter_rb/project/specs/flutter/pubspec.rb +69 -69
- data/lib/flutter_rb/project/specs/flutter/pubspec_info.rb +20 -20
- data/lib/flutter_rb/project/specs/ios/ios_folder.rb +14 -14
- data/lib/flutter_rb/project/specs/ios/podspec.rb +40 -40
- data/lib/flutter_rb/report/check_report.rb +47 -47
- data/lib/flutter_rb.rb +95 -93
- metadata +7 -35
@@ -1,152 +1,152 @@
|
|
1
|
-
require_relative 'check'
|
2
|
-
require_relative '../report/check_report'
|
3
|
-
|
4
|
-
module FlutterRb
|
5
|
-
# Base class for all info parameters in Flutter plugin pubspec.yaml file
|
6
|
-
class PluginPubspecCheck < Check
|
7
|
-
def name
|
8
|
-
"PluginPubspec#{pubspec_parameter.capitalize}Check"
|
9
|
-
end
|
10
|
-
|
11
|
-
def pubspec_parameter
|
12
|
-
raise
|
13
|
-
end
|
14
|
-
|
15
|
-
def summary
|
16
|
-
"Validate Flutter plugin's #{pubspec_parameter} in pubspec.yaml"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# Check Flutter plugin name in podspec file. Exists or not
|
21
|
-
class PluginPubspecNameCheck < PluginPubspecCheck
|
22
|
-
def pubspec_parameter
|
23
|
-
'name'
|
24
|
-
end
|
25
|
-
|
26
|
-
def check(project)
|
27
|
-
pubspec = project.pubspec
|
28
|
-
CheckReport.new(
|
29
|
-
name,
|
30
|
-
pubspec.pubspec_info.name.nil? ? CheckReportStatus::ERROR : CheckReportStatus::NORMAL,
|
31
|
-
description,
|
32
|
-
pubspec.path
|
33
|
-
)
|
34
|
-
end
|
35
|
-
|
36
|
-
def description
|
37
|
-
'Check plugin name in pubspec file'
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
# Check Flutter plugin description in pubspec file. Exists or not
|
42
|
-
class PluginPubspecDescriptionCheck < PluginPubspecCheck
|
43
|
-
def pubspec_parameter
|
44
|
-
'description'
|
45
|
-
end
|
46
|
-
|
47
|
-
def check(project)
|
48
|
-
pubspec = project.pubspec
|
49
|
-
CheckReport.new(
|
50
|
-
name,
|
51
|
-
pubspec.pubspec_info.description.nil? ? CheckReportStatus::WARNING : CheckReportStatus::NORMAL,
|
52
|
-
description,
|
53
|
-
pubspec.path
|
54
|
-
)
|
55
|
-
end
|
56
|
-
|
57
|
-
def description
|
58
|
-
'Check plugin description in pubspec file'
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
# Check Flutter plugin version in pubspec file. Exists or not
|
63
|
-
class PluginPubspecVersionCheck < PluginPubspecCheck
|
64
|
-
def pubspec_parameter
|
65
|
-
'version'
|
66
|
-
end
|
67
|
-
|
68
|
-
def check(project)
|
69
|
-
pubspec = project.pubspec
|
70
|
-
CheckReport.new(
|
71
|
-
name,
|
72
|
-
pubspec.pubspec_info.version.nil? ? CheckReportStatus::ERROR : CheckReportStatus::NORMAL,
|
73
|
-
description,
|
74
|
-
pubspec.path
|
75
|
-
)
|
76
|
-
end
|
77
|
-
|
78
|
-
def description
|
79
|
-
'Check plugin version in pubspec'
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
# Check Flutter plugin author in pubspec file. Exists or not
|
84
|
-
class PluginPubspecAuthorCheck < PluginPubspecCheck
|
85
|
-
def pubspec_parameter
|
86
|
-
'author'
|
87
|
-
end
|
88
|
-
|
89
|
-
def check(project)
|
90
|
-
pubspec = project.pubspec
|
91
|
-
CheckReport.new(
|
92
|
-
name,
|
93
|
-
pubspec.pubspec_info.author.nil? ? CheckReportStatus::NORMAL : CheckReportStatus::WARNING,
|
94
|
-
description,
|
95
|
-
pubspec.path
|
96
|
-
)
|
97
|
-
end
|
98
|
-
|
99
|
-
def description
|
100
|
-
'Check plugin author in pubspec'
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
# Check Flutter plugin homepage in pubspec file. Exists or not
|
105
|
-
class PluginPubspecHomepageCheck < PluginPubspecCheck
|
106
|
-
def pubspec_parameter
|
107
|
-
'homepage'
|
108
|
-
end
|
109
|
-
|
110
|
-
def check(project)
|
111
|
-
pubspec = project.pubspec
|
112
|
-
CheckReport.new(
|
113
|
-
name,
|
114
|
-
pubspec.pubspec_info.homepage.nil? ? CheckReportStatus::ERROR : CheckReportStatus::NORMAL,
|
115
|
-
description,
|
116
|
-
pubspec.path
|
117
|
-
)
|
118
|
-
end
|
119
|
-
|
120
|
-
def description
|
121
|
-
'Check plugin homepage in pubspec'
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
# Check Flutter plugin Effective Dart depencency in pubspec file. Exists or not
|
126
|
-
class PluginPubspecEffectiveDartCheck < Check
|
127
|
-
def name
|
128
|
-
'PluginPubspecEffectiveDartCheck'
|
129
|
-
end
|
130
|
-
|
131
|
-
def summary
|
132
|
-
'Validate Flutter plugin\'s Effective Dart rules implementation in pubspec.yaml'
|
133
|
-
end
|
134
|
-
|
135
|
-
def check(project)
|
136
|
-
pubspec = project.pubspec
|
137
|
-
effective_dart = pubspec.dev_dependencies&.detect do |dev_dependency|
|
138
|
-
dev_dependency.name == 'effective_dart'
|
139
|
-
end
|
140
|
-
CheckReport.new(
|
141
|
-
name,
|
142
|
-
effective_dart.nil? ? CheckReportStatus::ERROR : CheckReportStatus::NORMAL,
|
143
|
-
description,
|
144
|
-
pubspec.path
|
145
|
-
)
|
146
|
-
end
|
147
|
-
|
148
|
-
def description
|
149
|
-
'Check Flutter plugin Effective Dart depencency in pubspec file'
|
150
|
-
end
|
151
|
-
end
|
152
|
-
end
|
1
|
+
require_relative 'check'
|
2
|
+
require_relative '../report/check_report'
|
3
|
+
|
4
|
+
module FlutterRb
|
5
|
+
# Base class for all info parameters in Flutter plugin pubspec.yaml file
|
6
|
+
class PluginPubspecCheck < Check
|
7
|
+
def name
|
8
|
+
"PluginPubspec#{pubspec_parameter.capitalize}Check"
|
9
|
+
end
|
10
|
+
|
11
|
+
def pubspec_parameter
|
12
|
+
raise UNIMPLEMENTED_ERROR
|
13
|
+
end
|
14
|
+
|
15
|
+
def summary
|
16
|
+
"Validate Flutter plugin's #{pubspec_parameter} in pubspec.yaml"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Check Flutter plugin name in podspec file. Exists or not
|
21
|
+
class PluginPubspecNameCheck < PluginPubspecCheck
|
22
|
+
def pubspec_parameter
|
23
|
+
'name'
|
24
|
+
end
|
25
|
+
|
26
|
+
def check(project)
|
27
|
+
pubspec = project.pubspec
|
28
|
+
CheckReport.new(
|
29
|
+
name,
|
30
|
+
pubspec.pubspec_info.name.nil? ? CheckReportStatus::ERROR : CheckReportStatus::NORMAL,
|
31
|
+
description,
|
32
|
+
pubspec.path
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
def description
|
37
|
+
'Check plugin name in pubspec file'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Check Flutter plugin description in pubspec file. Exists or not
|
42
|
+
class PluginPubspecDescriptionCheck < PluginPubspecCheck
|
43
|
+
def pubspec_parameter
|
44
|
+
'description'
|
45
|
+
end
|
46
|
+
|
47
|
+
def check(project)
|
48
|
+
pubspec = project.pubspec
|
49
|
+
CheckReport.new(
|
50
|
+
name,
|
51
|
+
pubspec.pubspec_info.description.nil? ? CheckReportStatus::WARNING : CheckReportStatus::NORMAL,
|
52
|
+
description,
|
53
|
+
pubspec.path
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
def description
|
58
|
+
'Check plugin description in pubspec file'
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Check Flutter plugin version in pubspec file. Exists or not
|
63
|
+
class PluginPubspecVersionCheck < PluginPubspecCheck
|
64
|
+
def pubspec_parameter
|
65
|
+
'version'
|
66
|
+
end
|
67
|
+
|
68
|
+
def check(project)
|
69
|
+
pubspec = project.pubspec
|
70
|
+
CheckReport.new(
|
71
|
+
name,
|
72
|
+
pubspec.pubspec_info.version.nil? ? CheckReportStatus::ERROR : CheckReportStatus::NORMAL,
|
73
|
+
description,
|
74
|
+
pubspec.path
|
75
|
+
)
|
76
|
+
end
|
77
|
+
|
78
|
+
def description
|
79
|
+
'Check plugin version in pubspec'
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Check Flutter plugin author in pubspec file. Exists or not
|
84
|
+
class PluginPubspecAuthorCheck < PluginPubspecCheck
|
85
|
+
def pubspec_parameter
|
86
|
+
'author'
|
87
|
+
end
|
88
|
+
|
89
|
+
def check(project)
|
90
|
+
pubspec = project.pubspec
|
91
|
+
CheckReport.new(
|
92
|
+
name,
|
93
|
+
pubspec.pubspec_info.author.nil? ? CheckReportStatus::NORMAL : CheckReportStatus::WARNING,
|
94
|
+
description,
|
95
|
+
pubspec.path
|
96
|
+
)
|
97
|
+
end
|
98
|
+
|
99
|
+
def description
|
100
|
+
'Check plugin author in pubspec'
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# Check Flutter plugin homepage in pubspec file. Exists or not
|
105
|
+
class PluginPubspecHomepageCheck < PluginPubspecCheck
|
106
|
+
def pubspec_parameter
|
107
|
+
'homepage'
|
108
|
+
end
|
109
|
+
|
110
|
+
def check(project)
|
111
|
+
pubspec = project.pubspec
|
112
|
+
CheckReport.new(
|
113
|
+
name,
|
114
|
+
pubspec.pubspec_info.homepage.nil? ? CheckReportStatus::ERROR : CheckReportStatus::NORMAL,
|
115
|
+
description,
|
116
|
+
pubspec.path
|
117
|
+
)
|
118
|
+
end
|
119
|
+
|
120
|
+
def description
|
121
|
+
'Check plugin homepage in pubspec'
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
# Check Flutter plugin Effective Dart depencency in pubspec file. Exists or not
|
126
|
+
class PluginPubspecEffectiveDartCheck < Check
|
127
|
+
def name
|
128
|
+
'PluginPubspecEffectiveDartCheck'
|
129
|
+
end
|
130
|
+
|
131
|
+
def summary
|
132
|
+
'Validate Flutter plugin\'s Effective Dart rules implementation in pubspec.yaml'
|
133
|
+
end
|
134
|
+
|
135
|
+
def check(project)
|
136
|
+
pubspec = project.pubspec
|
137
|
+
effective_dart = pubspec.dev_dependencies&.detect do |dev_dependency|
|
138
|
+
dev_dependency.name == 'effective_dart'
|
139
|
+
end
|
140
|
+
CheckReport.new(
|
141
|
+
name,
|
142
|
+
effective_dart.nil? ? CheckReportStatus::ERROR : CheckReportStatus::NORMAL,
|
143
|
+
description,
|
144
|
+
pubspec.path
|
145
|
+
)
|
146
|
+
end
|
147
|
+
|
148
|
+
def description
|
149
|
+
'Check Flutter plugin Effective Dart depencency in pubspec file'
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
module FlutterRb
|
2
|
-
# FlutterRb configuration representation from config in Flutter plugin
|
3
|
-
class FlutterRbConfig
|
4
|
-
def initialize(
|
5
|
-
flutter_checks,
|
6
|
-
android_checks,
|
7
|
-
ios_checks
|
8
|
-
)
|
9
|
-
@flutter_checks = flutter_checks
|
10
|
-
@android_checks = android_checks
|
11
|
-
@ios_checks = ios_checks
|
12
|
-
end
|
13
|
-
|
14
|
-
attr_accessor :flutter_checks, :android_checks, :ios_checks
|
15
|
-
end
|
16
|
-
end
|
1
|
+
module FlutterRb
|
2
|
+
# FlutterRb configuration representation from config in Flutter plugin
|
3
|
+
class FlutterRbConfig
|
4
|
+
def initialize(
|
5
|
+
flutter_checks,
|
6
|
+
android_checks,
|
7
|
+
ios_checks
|
8
|
+
)
|
9
|
+
@flutter_checks = flutter_checks
|
10
|
+
@android_checks = android_checks
|
11
|
+
@ios_checks = ios_checks
|
12
|
+
end
|
13
|
+
|
14
|
+
attr_accessor :flutter_checks, :android_checks, :ios_checks
|
15
|
+
end
|
16
|
+
end
|
@@ -1,56 +1,56 @@
|
|
1
|
-
require_relative './flutter_rb_config'
|
2
|
-
require_relative '../checks/plugin_directories_check'
|
3
|
-
|
4
|
-
require 'yaml'
|
5
|
-
|
6
|
-
module FlutterRb
|
7
|
-
# Class that initialize configuration
|
8
|
-
class FlutterRbConfigInitializer
|
9
|
-
FLUTTER_CHECKS = [
|
10
|
-
PluginDirectoriesCheck.new,
|
11
|
-
PluginPubspecNameCheck.new,
|
12
|
-
PluginPubspecDescriptionCheck.new,
|
13
|
-
PluginPubspecVersionCheck.new,
|
14
|
-
PluginPubspecAuthorCheck.new,
|
15
|
-
PluginPubspecHomepageCheck.new,
|
16
|
-
PluginPubspecEffectiveDartCheck.new
|
17
|
-
].freeze
|
18
|
-
|
19
|
-
ANDROID_CHECKS = [
|
20
|
-
PluginGradleAndroidPackageCheck.new,
|
21
|
-
PluginGradleVersionCheck.new
|
22
|
-
].freeze
|
23
|
-
|
24
|
-
IOS_CHECKS = [
|
25
|
-
PluginPodspecNameCheck.new,
|
26
|
-
PluginPodspecVersionCheck.new,
|
27
|
-
PluginPodspecAuthorsCheck.new,
|
28
|
-
PluginPodspecSourceCheck.new
|
29
|
-
].freeze
|
30
|
-
|
31
|
-
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity, Layout/LineLength
|
32
|
-
def parse(path)
|
33
|
-
config = YAML.load_file(path)['include']
|
34
|
-
flutter_checks = []
|
35
|
-
flutter_checks += config['flutter'].map { |check| Object.const_get("FlutterRb::#{check}").new } unless config['flutter'].nil?
|
36
|
-
android_checks = []
|
37
|
-
android_checks += config['android'].map { |check| Object.const_get("FlutterRb::#{check}").new } unless config['android'].nil?
|
38
|
-
ios_checks = []
|
39
|
-
ios_checks += config['ios'].map { |check| Object.const_get("FlutterRb::#{check}").new } unless config['ios'].nil?
|
40
|
-
FlutterRbConfig.new(
|
41
|
-
flutter_checks.empty? ? FLUTTER_CHECKS : flutter_checks,
|
42
|
-
android_checks.empty? ? ANDROID_CHECKS : android_checks,
|
43
|
-
ios_checks.empty? ? IOS_CHECKS : ios_checks
|
44
|
-
)
|
45
|
-
end
|
46
|
-
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity, Layout/LineLength
|
47
|
-
|
48
|
-
def default
|
49
|
-
FlutterRbConfig.new(
|
50
|
-
FLUTTER_CHECKS,
|
51
|
-
ANDROID_CHECKS,
|
52
|
-
IOS_CHECKS
|
53
|
-
)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
1
|
+
require_relative './flutter_rb_config'
|
2
|
+
require_relative '../checks/plugin_directories_check'
|
3
|
+
|
4
|
+
require 'yaml'
|
5
|
+
|
6
|
+
module FlutterRb
|
7
|
+
# Class that initialize configuration
|
8
|
+
class FlutterRbConfigInitializer
|
9
|
+
FLUTTER_CHECKS = [
|
10
|
+
PluginDirectoriesCheck.new,
|
11
|
+
PluginPubspecNameCheck.new,
|
12
|
+
PluginPubspecDescriptionCheck.new,
|
13
|
+
PluginPubspecVersionCheck.new,
|
14
|
+
PluginPubspecAuthorCheck.new,
|
15
|
+
PluginPubspecHomepageCheck.new,
|
16
|
+
PluginPubspecEffectiveDartCheck.new
|
17
|
+
].freeze
|
18
|
+
|
19
|
+
ANDROID_CHECKS = [
|
20
|
+
PluginGradleAndroidPackageCheck.new,
|
21
|
+
PluginGradleVersionCheck.new
|
22
|
+
].freeze
|
23
|
+
|
24
|
+
IOS_CHECKS = [
|
25
|
+
PluginPodspecNameCheck.new,
|
26
|
+
PluginPodspecVersionCheck.new,
|
27
|
+
PluginPodspecAuthorsCheck.new,
|
28
|
+
PluginPodspecSourceCheck.new
|
29
|
+
].freeze
|
30
|
+
|
31
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity, Layout/LineLength
|
32
|
+
def parse(path)
|
33
|
+
config = YAML.load_file(path)['include']
|
34
|
+
flutter_checks = []
|
35
|
+
flutter_checks += config['flutter'].map { |check| Object.const_get("FlutterRb::#{check}").new } unless config['flutter'].nil?
|
36
|
+
android_checks = []
|
37
|
+
android_checks += config['android'].map { |check| Object.const_get("FlutterRb::#{check}").new } unless config['android'].nil?
|
38
|
+
ios_checks = []
|
39
|
+
ios_checks += config['ios'].map { |check| Object.const_get("FlutterRb::#{check}").new } unless config['ios'].nil?
|
40
|
+
FlutterRbConfig.new(
|
41
|
+
flutter_checks.empty? ? FLUTTER_CHECKS : flutter_checks,
|
42
|
+
android_checks.empty? ? ANDROID_CHECKS : android_checks,
|
43
|
+
ios_checks.empty? ? IOS_CHECKS : ios_checks
|
44
|
+
)
|
45
|
+
end
|
46
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity, Layout/LineLength
|
47
|
+
|
48
|
+
def default
|
49
|
+
FlutterRbConfig.new(
|
50
|
+
FLUTTER_CHECKS,
|
51
|
+
ANDROID_CHECKS,
|
52
|
+
IOS_CHECKS
|
53
|
+
)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -1,53 +1,53 @@
|
|
1
|
-
require_relative './specs/flutter/pubspec'
|
2
|
-
require_relative './specs/flutter/dev_dependency'
|
3
|
-
require_relative './specs/flutter/platform_plugin'
|
4
|
-
require_relative './specs/android/android_folder'
|
5
|
-
require_relative './specs/android/gradle'
|
6
|
-
require_relative './specs/ios/ios_folder'
|
7
|
-
|
8
|
-
require 'yaml'
|
9
|
-
|
10
|
-
module FlutterRb
|
11
|
-
# Project representation
|
12
|
-
class Project
|
13
|
-
def initialize(
|
14
|
-
path,
|
15
|
-
pubspec,
|
16
|
-
android_folder,
|
17
|
-
ios_folder
|
18
|
-
)
|
19
|
-
@path = path
|
20
|
-
@pubspec = pubspec
|
21
|
-
@android_folder = android_folder
|
22
|
-
@ios_folder = ios_folder
|
23
|
-
end
|
24
|
-
|
25
|
-
attr_accessor :path, :pubspec, :android_folder, :ios_folder
|
26
|
-
end
|
27
|
-
|
28
|
-
# Flutter plugin project parser
|
29
|
-
class ProjectParser
|
30
|
-
def initialize(path)
|
31
|
-
@path = path
|
32
|
-
end
|
33
|
-
|
34
|
-
def project
|
35
|
-
File.exist?("#{@path}/pubspec.yaml") ? parse_project : nil
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
def parse_project
|
41
|
-
pubspec_path = "#{@path}/pubspec.yaml"
|
42
|
-
android_path = "#{@path}/android"
|
43
|
-
ios_path = "#{@path}/ios"
|
44
|
-
pubspec = PubspecParser.new(pubspec_path, YAML.load_file(pubspec_path)).parse
|
45
|
-
Project.new(
|
46
|
-
@path,
|
47
|
-
pubspec,
|
48
|
-
File.exist?(android_path) ? AndroidFolder.new(android_path) : nil,
|
49
|
-
File.exist?(ios_path) ? IOSFolder.new(ios_path, pubspec) : nil
|
50
|
-
)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
1
|
+
require_relative './specs/flutter/pubspec'
|
2
|
+
require_relative './specs/flutter/dev_dependency'
|
3
|
+
require_relative './specs/flutter/platform_plugin'
|
4
|
+
require_relative './specs/android/android_folder'
|
5
|
+
require_relative './specs/android/gradle'
|
6
|
+
require_relative './specs/ios/ios_folder'
|
7
|
+
|
8
|
+
require 'yaml'
|
9
|
+
|
10
|
+
module FlutterRb
|
11
|
+
# Project representation
|
12
|
+
class Project
|
13
|
+
def initialize(
|
14
|
+
path,
|
15
|
+
pubspec,
|
16
|
+
android_folder,
|
17
|
+
ios_folder
|
18
|
+
)
|
19
|
+
@path = path
|
20
|
+
@pubspec = pubspec
|
21
|
+
@android_folder = android_folder
|
22
|
+
@ios_folder = ios_folder
|
23
|
+
end
|
24
|
+
|
25
|
+
attr_accessor :path, :pubspec, :android_folder, :ios_folder
|
26
|
+
end
|
27
|
+
|
28
|
+
# Flutter plugin project parser
|
29
|
+
class ProjectParser
|
30
|
+
def initialize(path)
|
31
|
+
@path = path
|
32
|
+
end
|
33
|
+
|
34
|
+
def project
|
35
|
+
File.exist?("#{@path}/pubspec.yaml") ? parse_project : nil
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def parse_project
|
41
|
+
pubspec_path = "#{@path}/pubspec.yaml"
|
42
|
+
android_path = "#{@path}/android"
|
43
|
+
ios_path = "#{@path}/ios"
|
44
|
+
pubspec = PubspecParser.new(pubspec_path, YAML.load_file(pubspec_path)).parse
|
45
|
+
Project.new(
|
46
|
+
@path,
|
47
|
+
pubspec,
|
48
|
+
File.exist?(android_path) ? AndroidFolder.new(android_path) : nil,
|
49
|
+
File.exist?(ios_path) ? IOSFolder.new(ios_path, pubspec) : nil
|
50
|
+
)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
require_relative './gradle'
|
2
|
-
|
3
|
-
module FlutterRb
|
4
|
-
# Android project representation
|
5
|
-
class AndroidFolder
|
6
|
-
def initialize(path)
|
7
|
-
@path = path
|
8
|
-
@gradle = GradleParser.new(@path).parse
|
9
|
-
end
|
10
|
-
|
11
|
-
attr_reader :path, :gradle
|
12
|
-
end
|
13
|
-
end
|
1
|
+
require_relative './gradle'
|
2
|
+
|
3
|
+
module FlutterRb
|
4
|
+
# Android project representation
|
5
|
+
class AndroidFolder
|
6
|
+
def initialize(path)
|
7
|
+
@path = path
|
8
|
+
@gradle = GradleParser.new(@path).parse
|
9
|
+
end
|
10
|
+
|
11
|
+
attr_reader :path, :gradle
|
12
|
+
end
|
13
|
+
end
|
@@ -1,27 +1,27 @@
|
|
1
|
-
require 'json'
|
2
|
-
|
3
|
-
module FlutterRb
|
4
|
-
# Gradle representation
|
5
|
-
class Gradle
|
6
|
-
def initialize(path, version)
|
7
|
-
@path = path
|
8
|
-
@version = version
|
9
|
-
end
|
10
|
-
|
11
|
-
attr_reader :path, :version
|
12
|
-
end
|
13
|
-
|
14
|
-
# Gradle parser
|
15
|
-
class GradleParser
|
16
|
-
def initialize(path)
|
17
|
-
@path = path
|
18
|
-
end
|
19
|
-
|
20
|
-
def parse
|
21
|
-
`gradle -p #{@path} -q prepareInfo`
|
22
|
-
info_file = File.read "#{@path}/flutter_rb_gradle_plugin_output.json"
|
23
|
-
info = JSON.parse info_file
|
24
|
-
Gradle.new(@path, info['version'])
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module FlutterRb
|
4
|
+
# Gradle representation
|
5
|
+
class Gradle
|
6
|
+
def initialize(path, version)
|
7
|
+
@path = path
|
8
|
+
@version = version
|
9
|
+
end
|
10
|
+
|
11
|
+
attr_reader :path, :version
|
12
|
+
end
|
13
|
+
|
14
|
+
# Gradle parser
|
15
|
+
class GradleParser
|
16
|
+
def initialize(path)
|
17
|
+
@path = path
|
18
|
+
end
|
19
|
+
|
20
|
+
def parse
|
21
|
+
`gradle -p #{@path} -q prepareInfo`
|
22
|
+
info_file = File.read "#{@path}/flutter_rb_gradle_plugin_output.json"
|
23
|
+
info = JSON.parse info_file
|
24
|
+
Gradle.new(@path, info['version'])
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
module FlutterRb
|
2
|
-
# Dev dependency, contains name and version
|
3
|
-
class DevDependency
|
4
|
-
def initialize(name, version)
|
5
|
-
@name = name
|
6
|
-
@version = version
|
7
|
-
end
|
8
|
-
|
9
|
-
attr_reader :name, :version
|
10
|
-
end
|
11
|
-
end
|
1
|
+
module FlutterRb
|
2
|
+
# Dev dependency, contains name and version
|
3
|
+
class DevDependency
|
4
|
+
def initialize(name, version)
|
5
|
+
@name = name
|
6
|
+
@version = version
|
7
|
+
end
|
8
|
+
|
9
|
+
attr_reader :name, :version
|
10
|
+
end
|
11
|
+
end
|