flr 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: edfe0b5dab4b4dda94c17168b8178f80a0903ccb989f498253dca53041b4d751
4
+ data.tar.gz: 9e83742e89792aeba9f52a0b68e793afa633c0bc84261a1deb3aff8741ed08c2
5
+ SHA512:
6
+ metadata.gz: 722245bb8985fe6c2d29116d4cc8b3f8434a21aea05af0acbfcf6e2c62cf9ed1236a2ceea57c389a74f54b39c6f9699bddd631701bb45eff7d6e6a13a186c705
7
+ data.tar.gz: a8a4136d3e6146eca5f81488ae8adbb3a6307f2bbfa7d952ddebd8ed81f9358ed81d5b87cd652445676bfa47fbfd89305c483b0cccd5c1e6ebb9ee8ee7a079ca
data/.gitignore ADDED
@@ -0,0 +1,39 @@
1
+ # General
2
+ *.swp
3
+ *.swo
4
+ *.rbo
5
+ *.gem
6
+ .DS_Store
7
+ .rbenv-version
8
+ .rbx/
9
+ /concatenated.*
10
+
11
+ # Yardoc
12
+ /.yardoc
13
+ /_yardoc/
14
+ /coverage/
15
+ /doc/
16
+ /pkg/
17
+
18
+ # Specs
19
+ /spec/reports/
20
+ /tmp/
21
+
22
+ # RVM files
23
+ /.rvmrc
24
+ /.ruby-version
25
+ /.ruby-gemset
26
+
27
+ # Bundler files
28
+ /.bundle
29
+
30
+ # rspec failure tracking
31
+ .rspec_status
32
+
33
+ # IDEs
34
+ .idea/
35
+
36
+ # Local Pubspec Tests
37
+ pubspec.yaml
38
+ pubspec.lock
39
+ .packages
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.3
7
+ before_install: gem install bundler -v 1.17.2
data/CHANGELOG.md ADDED
@@ -0,0 +1,40 @@
1
+ ## 1.0.0
2
+ - Support for processing font assets ( `.ttf`, `.otf`, `.ttc`)
3
+ - Improve robustness
4
+
5
+ ## 0.2.2
6
+
7
+ - improve robustness
8
+ - fix bug
9
+
10
+ ## 0.2.1
11
+
12
+ - optimize flr help command
13
+ - fix bad info in flr.gemspec
14
+
15
+ ## 0.2.0 - BREAKING CHANGES
16
+
17
+ - modify the way the Flr configuration is stored: discard the flrfile.yaml file and write the configuration to the pubspec.yaml file
18
+ - `flr generate` and `flr monitor` are combined into `flr run [--auto]`
19
+ - generate `r.g.dart` instead of `R.dart`
20
+ - new `R` class:
21
+ - discards `R_X` code struct, and uses `R.x` code struct
22
+ - unifies the access way of all types asset resources: using the asset resource ID function, such as `R.image.test()`, `R.svg.test(width: 100, height: 100)`, `R.text.test_json()`
23
+ - provides `AssetResource` class to acces the asset metadata, such as `assetName`, `packageName`, `fileBasename`
24
+ - increase the range of legal character sets : `0-9`, `A-Z`, `a-z`, `_`, `+`, `-`, `.`, `·`, `!`, `@`, `&`, `$`, `¥`
25
+ - colored terminal output
26
+
27
+ ## 0.1.13
28
+
29
+ - `flr generate` supports checking and outputtting assets with bad filename
30
+ - fix bug
31
+
32
+ ## 0.1.12
33
+
34
+ - support auto service that automatically specify assets in `pubspec.yaml` and generate `R.dart` file, which can be triggered manually or by monitoring asset changes
35
+ - support for processing image assets ( `.png`, `.jpg`, `.jpeg`, `.gif`, `.webp`, `.icon`, `.bmp`, `.wbmp`, `.svg` )
36
+ - support for processing text assets ( `.txt`, `.json`, `.yaml`, `.xml` )
37
+ - support for processing [image asset variants](https://flutter.dev/docs/development/ui/assets-and-images#asset-variants)
38
+ - support for processing asset which’s filename is bad:
39
+ - filename has illegal character (such as `blank`, `~`, `@`, `#` ) which is outside the range of valid characters (`0-9`, `A-Z`, `a-z`, `_`, `$`)
40
+ - filename begins with a number or character `_` or character`$`
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at yorkzhang520@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
@@ -0,0 +1,25 @@
1
+ ## Flr Cli Deployment Check List
2
+
3
+ 1. 确定Deployment的版本号:X.Y.Z
4
+ 1. 编辑`lib/flr/version.rb`,更新`VERSION`:
5
+
6
+ ```ruby
7
+ module Flr
8
+ VERSION = "X.Y.Z"
9
+ ...
10
+ end
11
+ ```
12
+ 1. 更新CHANGELOG.md
13
+ 1. 在项目根目录下运行脚本更新Gemfile:`bundle exec ./bin/flr`
14
+ 1. 提交当前变更到git
15
+ 1. 在项目根目录下运行脚本打包Gem:`gem build flr.gemspec`
16
+ 1. 本地安装Flr进行测试:`sudo gem install flr-x.y.z.gem`
17
+ 1. 若无问题,则发布Flr到RubyGems市场
18
+
19
+ ## Publish Flr Cli
20
+
21
+ 1. 在项目根目录下运行脚本发布Flr:`gem push flr-x.y.z.gem`
22
+
23
+ ## Other
24
+
25
+ 1. 从RubyGems市场下架指定版本的Flr:`gem yank flr -v x.y.z`
@@ -0,0 +1,42 @@
1
+
2
+ 注意:录制前,请先还原pubspec.yaml
3
+ ---------------------------------------------
4
+
5
+ Flr Usage Example
6
+
7
+ ---------------------------------------------
8
+
9
+ 1. Run `flr init`
10
+
11
+ ---------------------------------------------
12
+
13
+ 2. Edit pubspec.yaml
14
+ to configure the resource directory paths
15
+
16
+ ---------------------------------------------
17
+
18
+ 3. Run `flr run`
19
+
20
+ ---------------------------------------------
21
+
22
+ One More Thing:
23
+
24
+ If you want Flr to auto generate when you change Flutter asssets,
25
+
26
+ you can Run `flr run --auto` to launch a monitoring service.
27
+
28
+ For example:
29
+
30
+ ---------------------------------------------
31
+
32
+ 1. Run `flr run --auto`
33
+
34
+ ---------------------------------------------
35
+
36
+ 2. Add a new asset:
37
+ 163.com.yaml
38
+
39
+ ---------------------------------------------
40
+
41
+ 3. Press `Ctrl-C`
42
+ to terminate the monitoring service if you want
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in flr.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,28 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ flr (1.0.0)
5
+ bundler (~> 2.0, >= 2.0.2)
6
+ listen (~> 3.0, >= 3.2.1)
7
+ thor (~> 1.0, >= 1.0.1)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ ffi (1.12.1)
13
+ listen (3.2.1)
14
+ rb-fsevent (~> 0.10, >= 0.10.3)
15
+ rb-inotify (~> 0.9, >= 0.9.10)
16
+ rb-fsevent (0.10.3)
17
+ rb-inotify (0.10.1)
18
+ ffi (~> 1.0)
19
+ thor (1.0.1)
20
+
21
+ PLATFORMS
22
+ ruby
23
+
24
+ DEPENDENCIES
25
+ flr!
26
+
27
+ BUNDLED WITH
28
+ 2.0.2
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 York
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
13
+ all 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
21
+ THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/flr ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "flr"
5
+
6
+ Flr::CLI.start(ARGV)
data/flr.gemspec ADDED
@@ -0,0 +1,47 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "flr/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "flr"
8
+ spec.version = Flr::VERSION
9
+ spec.authors = ["York"]
10
+ spec.email = ["yorkzhang520@gmail.com"]
11
+
12
+ spec.summary = "Flr(Flutter-R): A Flutter Resource Manager CLI TooL."
13
+ spec.description = "Flr(Flutter-R): A Flutter Resource Manager CLI TooL, which can help flutter developer to auto specify assets in pubspec.yaml and generate r.g.dart file after he changes the flutter project assets."
14
+ spec.homepage = "https://github.com/Fly-Mix/flr-cli"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ # spec.metadata["allowed_push_host"] = "https://rubygems.org"
21
+
22
+ spec.metadata["homepage_uri"] = spec.homepage
23
+ spec.metadata["source_code_uri"] = spec.homepage
24
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
25
+ else
26
+ raise "RubyGems 2.0 or newer is required to protect against " \
27
+ "public gem pushes."
28
+ end
29
+
30
+ # Specify which files should be added to the gem when it is released.
31
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
32
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
33
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|README)}) }
34
+ end
35
+
36
+ spec.bindir = "bin"
37
+ spec.executables = ["flr"]
38
+ spec.require_paths = ["lib"]
39
+
40
+ # spec.add_development_dependency "rake", "~> 10.0"
41
+ # spec.add_development_dependency "rspec", "~> 3.0"
42
+
43
+ spec.add_runtime_dependency "bundler", "~> 2.0", '>= 2.0.2'
44
+ spec.add_runtime_dependency "thor", "~> 1.0", '>= 1.0.1'
45
+ spec.add_runtime_dependency "listen", "~> 3.0", '>= 3.2.1'
46
+
47
+ end
data/lib/flr.rb ADDED
@@ -0,0 +1,71 @@
1
+ require 'thor'
2
+ require 'flr/version'
3
+ require 'flr/command'
4
+ require 'flr/string_extensions'
5
+
6
+ module Flr
7
+
8
+ class CLI < Thor
9
+
10
+ def self.help(shell, subcommand = false, display_introduction = true)
11
+ introduction = <<-MESSAGE
12
+ A Flutter Resource Manager CLI TooL, which can help flutter developer to auto specify assets in pubspec.yaml and generate r.g.dart file after he changes the flutter project assets.
13
+ More details see https://github.com/Fly-Mix/flr-cli
14
+
15
+ MESSAGE
16
+ if display_introduction
17
+ puts(introduction)
18
+ end
19
+ super(shell,subcommand)
20
+ end
21
+
22
+ def self.exit_on_failure?
23
+ puts("")
24
+ help(CLI::Base.shell.new, false, false)
25
+ true
26
+ end
27
+
28
+ desc "version", "Display version"
29
+ long_desc <<-LONGDESC
30
+ Display the version of Flr.
31
+
32
+ LONGDESC
33
+ def version
34
+ Command.version
35
+ end
36
+ map %w[-v --version] => :version
37
+
38
+ desc "init", "Add flr configuration and dependency \"r_dart_library\" into pubspec.yaml"
39
+ long_desc <<-LONGDESC
40
+ Add flr configuration
41
+ and dependency \"r_dart_library\"(https://github.com/YK-Unit/r_dart_library) into pubspec.yaml.
42
+
43
+ LONGDESC
44
+ def init
45
+ Command.init
46
+ end
47
+
48
+ desc "run [--auto]", "Scan assets, specify scanned assets in pubspec.yaml, generate \"r.g.dart\""
49
+ long_desc <<-LONGDESC
50
+
51
+ #{"With no option".bold}, #{"Flr".bold} will scan the asset directories configured in `pubspec.yaml`,
52
+ then specify scanned assets in pubspec.yaml,
53
+ and generate "r.g.dart" file.
54
+
55
+ #{"With".bold} #{"--auto".red.bold} #{"option".bold}, #{"Flr".bold} will launch a monitoring service that continuously monitors asset directories configured in pubspec.yaml.
56
+ If the service detects any asset changes, #{"Flr".bold} will automatically scan the asset directories,
57
+ then specify scanned assets in pubspec.yaml,
58
+ and generate "r.g.dart" file.
59
+
60
+ You can terminate the monitoring service by manually pressing #{"\"Ctrl-C\"".bold} if it exists.
61
+
62
+ LONGDESC
63
+ option :auto, :type => :boolean
64
+ def run_command
65
+ options[:auto] ? Command.start_monitor : Command.generate
66
+ end
67
+
68
+ map 'run' => :run_command
69
+
70
+ end
71
+ end