flr 1.0.0 → 1.1.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
  SHA256:
3
- metadata.gz: edfe0b5dab4b4dda94c17168b8178f80a0903ccb989f498253dca53041b4d751
4
- data.tar.gz: 9e83742e89792aeba9f52a0b68e793afa633c0bc84261a1deb3aff8741ed08c2
3
+ metadata.gz: 1c066c1bf53372cfb42446a4478e319c4251e2dd6d9c30267135588cadee209f
4
+ data.tar.gz: da3036ab6a3452fe35d05321ee068ca8059f88e64d878f249bfaf230ddada681
5
5
  SHA512:
6
- metadata.gz: 722245bb8985fe6c2d29116d4cc8b3f8434a21aea05af0acbfcf6e2c62cf9ed1236a2ceea57c389a74f54b39c6f9699bddd631701bb45eff7d6e6a13a186c705
7
- data.tar.gz: a8a4136d3e6146eca5f81488ae8adbb3a6307f2bbfa7d952ddebd8ed81f9358ed81d5b87cd652445676bfa47fbfd89305c483b0cccd5c1e6ebb9ee8ee7a079ca
6
+ metadata.gz: 98e30fa23cae12986881c75b7fc15d6ec7fa2b423d74fd1bc7ba5549f882ff0194211f202867aa30acd3ce81253b70d3d73718022cc3ed9b082e14c8f4cb47d7
7
+ data.tar.gz: 2d6cbb7417a21c448860f02bdb41c494d37a05108515542638e0bb6ca36677fc52cfb58e19a132bb2642c2d0b2591eae28ccc77290e817fb506b0046143d217e
@@ -1,4 +1,10 @@
1
+ ## 1.1.0
2
+
3
+ - Improve generate-capability to support nonstandard image resource structure
4
+ - Add recommend-capability to display the recommended flutter resource structure
5
+
1
6
  ## 1.0.0
7
+
2
8
  - Support for processing font assets ( `.ttf`, `.otf`, `.ttc`)
3
9
  - Improve robustness
4
10
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- flr (1.0.0)
4
+ flr (1.1.0)
5
5
  bundler (~> 2.0, >= 2.0.2)
6
6
  listen (~> 3.0, >= 3.2.1)
7
7
  thor (~> 1.0, >= 1.0.1)
data/lib/flr.rb CHANGED
@@ -64,8 +64,16 @@ More details see https://github.com/Fly-Mix/flr-cli
64
64
  def run_command
65
65
  options[:auto] ? Command.start_monitor : Command.generate
66
66
  end
67
-
68
67
  map 'run' => :run_command
69
68
 
69
+ desc "recommend", "Display the recommended flutter resource structure"
70
+ long_desc <<-LONGDESC
71
+ Display the good flutter resource structure which is recommended by Flr.
72
+
73
+ LONGDESC
74
+ def recommend
75
+ Command.display_recommended_flutter_resource_structure
76
+ end
77
+
70
78
  end
71
79
  end
@@ -27,12 +27,68 @@ module Flr
27
27
  # Listen Class Instance
28
28
  @@listener = nil
29
29
 
30
- # show the version of flr
30
+ # display the version of flr
31
31
  def self.version
32
32
  version_desc = "Flr version #{Flr::VERSION}\nCoreLogic version #{Flr::CORE_VERSION}"
33
33
  puts(version_desc)
34
34
  end
35
35
 
36
+ # display recommended flutter resource structure
37
+ def self.display_recommended_flutter_resource_structure
38
+ message = <<-MESSAGE
39
+ Flr recommends the following flutter resource structure:
40
+
41
+ flutter_project_root_dir
42
+ ├── build
43
+ │ ├── ..
44
+ ├── lib
45
+ │ ├── assets
46
+ │ │ ├── \#{module}-images #{"// image resources root directory of a moudle".red}
47
+ │ │ │ ├── \#{main_image_asset}
48
+ │ │ │ ├── \#{variant-dir} #{"// image resources root directory of a variant".red}
49
+ │ │ │ │ ├── \#{image_asset_variant}
50
+ │ │ │ │
51
+ │ │ ├── home-images #{"// image resources root directory of home module".red}
52
+ │ │ │ ├── home_icon.png
53
+ │ │ │ ├── home_badge.svg
54
+ │ │ │ ├── 3.0x #{"// image resources root directory of a 3.0x-ratio-variant".red}
55
+ │ │ │ │ ├── home_icon.png
56
+ │ │ │ │
57
+ │ │ ├── texts #{"// text resources root directory".red}
58
+ │ │ │ │ #{"// (you can also break it down further by module)".red}
59
+ │ │ │ └── test.json
60
+ │ │ │ └── test.yaml
61
+ │ │ │ │
62
+ │ │ ├── fonts #{"// font resources root directory of all font-family".red}
63
+ │ │ │ ├── \#{font-family} #{"// font resources root directory of a font-family".red}
64
+ │ │ │ │ ├── \#{font-family}-\#{font_weight_or_style}.ttf
65
+ │ │ │ │
66
+ │ │ │ ├── Amiri #{"// font resources root directory of Amiri font-family".red}
67
+ │ │ │ │ ├── Amiri-Regular.ttf
68
+ │ │ │ │ ├── Amiri-Bold.ttf
69
+ │ │ │ │ ├── Amiri-Italic.ttf
70
+ │ │ │ │ ├── Amiri-BoldItalic.ttf
71
+ │ ├── ..
72
+
73
+ #{"[*]: Then config the resource directories that need to be scanned as follows:".tips_style}
74
+
75
+ #{"flr:".tips_style}
76
+ #{"core_version: #{Flr::CORE_VERSION}".tips_style}
77
+ #{"dartfmt_line_length: #{Flr::DARTFMT_LINE_LENGTH}".tips_style}
78
+ #{"# config the image and text resource directories that need to be scanned".tips_style}
79
+ #{"assets:".tips_style}
80
+ #{"- lib/assets/moduleX-images".tips_style}
81
+ #{"- lib/assets/home-images".tips_style}
82
+ #{"- lib/assets/texts".tips_style}
83
+ #{"# config the font resource directories that need to be scanned".tips_style}
84
+ #{"fonts:".tips_style}
85
+ #{"- lib/assets/fonts".tips_style}
86
+
87
+ MESSAGE
88
+
89
+ puts(message)
90
+ end
91
+
36
92
  # get the right version of r_dart_library package based on flutter's version
37
93
  # to get more detail, see https://github.com/YK-Unit/r_dart_library#dependency-relationship-table
38
94
  def self.get_r_dart_library_version
@@ -169,6 +225,10 @@ module Flr
169
225
  # ----- Step-4 End -----
170
226
 
171
227
  puts("[√]: init done !!!")
228
+
229
+ puts("")
230
+ puts("[*]: if you want to know how to make a good resource structure for your flutter project, please run \"flr recommend\" ".tips_style)
231
+
172
232
  end
173
233
 
174
234
  # 扫描资源目录,自动为资源添加声明到 pubspec.yaml 和生成 r.g.dart
@@ -221,8 +281,10 @@ module Flr
221
281
 
222
282
  if flr_core_version != Flr::CORE_VERSION
223
283
  message = <<-MESSAGE
224
- #{"[!]: warning, the core logic version of the configured Flr tool is #{flr_core_version}, while the core logic version of the currently used Flr tool is #{Flr::CORE_VERSION}".warning_style}
284
+ #{"[!]: warning, the \"core_version\"(CoreLogic version) of the configured Flr tool is #{flr_core_version}, while the \"core_version\"(CoreLogic version) of the currently used Flr tool is #{Flr::CORE_VERSION}".warning_style}
225
285
  #{"[*]: to fix it, you should make sure that the core logic version of the Flr tool you are currently using is consistent with the configuration".tips_style}
286
+ #{"[*]: to get the value of \"core_version\"(CoreLogic version), just run \"flr version\"".tips_style}
287
+
226
288
  MESSAGE
227
289
 
228
290
  warning_messages.push(message)
@@ -105,7 +105,8 @@ module Flr
105
105
 
106
106
  # find_image_files(resource_dir) -> image_file_result_tuple
107
107
  #
108
- # 扫描指定的资源目录和其第1级子目录,查找所有图片文件
108
+ # v1.0.0: 扫描指定的资源目录和其第1级子目录,查找所有图片文件
109
+ # v1.1.0: 放开图片资源扫描目录层级限制,以支持不标准的资源组织目录结构
109
110
  # 返回图片文件结果二元组 image_file_result_tuple
110
111
  # image_file_result_tuple = [legal_image_file_array, illegal_image_file_array]
111
112
  #
@@ -123,7 +124,8 @@ module Flr
123
124
  pattern_file_types = Flr::IMAGE_FILE_TYPES.join(",")
124
125
  # dir/*{.png.,.jpg} : 查找当前目录的指定类型文件
125
126
  # dir/*/*{.png.,.jpg}: 查找当前目录的第1级子目录的指定类型文件
126
- Dir.glob(["#{resource_dir}/*{#{pattern_file_types}}", "#{resource_dir}/*/*{#{pattern_file_types}}"]).each do |file|
127
+ # dir/**/*{.png.,.jpg}: 查找当前目录和其所有子目录的指定类型文件
128
+ Dir.glob(["#{resource_dir}/**/*{#{pattern_file_types}}"]).each do |file|
127
129
  if is_legal_resource_file?(file)
128
130
  legal_image_file_array.push(file)
129
131
  else
@@ -1,6 +1,6 @@
1
1
  module Flr
2
2
  # 工具版本号
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
 
5
5
  # 核心逻辑版本号
6
6
  CORE_VERSION = "1.0.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - York
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-29 00:00:00.000000000 Z
11
+ date: 2020-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler