mt_tool 0.1.5 → 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/Gemfile +6 -1
- data/README.md +69 -16
- data/Rakefile +14 -1
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/mt_tool/commands.rb +43 -36
- data/lib/mt_tool/module/module.rb +1 -1
- data/lib/mt_tool/module/template/swift/Interactor.swift +1 -1
- data/lib/mt_tool/version.rb +1 -1
- data/mt_tool.gemspec +23 -28
- metadata +72 -165
- data/.MTModuleFilesConfig.yml +0 -5
- data/.idea/.gitignore +0 -8
- data/.idea/misc.xml +0 -4
- data/.idea/modules.xml +0 -8
- data/.idea/mt_tool.iml +0 -95
- data/.idea/sonarlint/issuestore/4/7/4745e92ab1b53af3e65026337909045741e13bea +0 -0
- data/.idea/sonarlint/issuestore/5/2/5283f86f6adbda087dceb47c69b64e141dfb1e93 +0 -0
- data/.idea/sonarlint/issuestore/7/0/70213f721c971c9a12d0f46060f7ee2a087b4a96 +0 -0
- data/.idea/sonarlint/issuestore/b/5/b53eec12e0ab8df9876dbc7fe65915bb985c4f72 +0 -0
- data/.idea/sonarlint/issuestore/e/8/e84cc700d4480c1d3ca7dcc158063e40a25cee12 +0 -0
- data/.idea/sonarlint/issuestore/f/8/f80e2edcdaf9ddf9362d26f7fa5d19df422f29c7 +0 -0
- data/.idea/sonarlint/issuestore/index.pb +0 -13
- data/.idea/vcs.xml +0 -7
- data/Gemfile.lock +0 -138
- data/img/69786f8e2a527b8c26f2c1311e230e5f.webp.png +0 -0
- data/img/SCR-20240619-msnz.png +0 -0
- data/lib/mt_tool/module/template/objc/Bundle.h +0 -21
- data/lib/mt_tool/module/template/objc/Bundle.m +0 -28
- data/lib/mt_tool/module/template/objc/CategoryHeader.h +0 -15
- data/lib/mt_tool/module/template/objc/PrefixHeader.pch +0 -36
- data/lib/mt_tool/module/template/objc/RouterDefine.h +0 -14
- data/lib/mt_tool/module/template/objc/RouterRegister.h +0 -16
- data/lib/mt_tool/module/template/objc/RouterRegister.m +0 -33
- data/lib/mt_tool/module/template/objc/ServiceProtocol.h +0 -15
- data/lib/mt_tool/module/template/objc/ServiceRegister.h +0 -16
- data/lib/mt_tool/module/template/objc/ServiceRegister.m +0 -25
- data/lib/mt_tool/module/template/objc/ToolsHeader.h +0 -13
- data/lib/mt_tool/module/template/objc/VendorHeader.h +0 -13
- data/lib/mt_tool/module/template/objc/demo/DemoViewController.h +0 -17
- data/lib/mt_tool/module/template/objc/demo/DemoViewController.m +0 -28
- data/lib/mt_tool/module/template/objc/demo/DemoViewModel.h +0 -14
- data/lib/mt_tool/module/template/objc/demo/DemoViewModel.m +0 -19
- data/lib/mt_tool/oc_model/main.rb +0 -112
- data/lib/mt_tool/oc_model/oc_model.rb +0 -235
- data/lib/mt_tool/oc_model/sample.json +0 -11
- data/lib/mt_tool/short_hand/objc_generate_from_shorthand.rb +0 -182
- data/lib/mt_tool/short_hand/objc_header.mustache +0 -41
- data/lib/mt_tool/short_hand/objc_implementation.mustache +0 -99
- data/lib/mt_tool/short_hand/objc_shorthand.rb +0 -64
- data/sig/mt_tool.rbs +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2671c087892b569fe4925329354c5211b46cc409879167a4a20e6e3b7548380a
|
4
|
+
data.tar.gz: 2999d07e97a347e65513bb01c9e1a8ca675c36c71a26b2581d4f7cb5cdc01db6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3caa9622bf7aec720a073aa9d24322adb8744a6451936ed931b25c3cfa25f543392627b1414fb439c978bc799c65c08201615e1e61919c3b5a2d05721aedf772
|
7
|
+
data.tar.gz: 4afa9862815131168293066842634a4435de43ca46da56c9399b5fc952ae10ce01005d0c3d7ff458437ca519f870b99dcfa02712e04905efe40746838c846964
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,40 +1,93 @@
|
|
1
1
|
# MtTool
|
2
2
|
|
3
|
-
|
3
|
+
A Ruby gem for generating VIPER architecture modules for iOS projects. Supports both Swift and Objective-C.
|
4
4
|
|
5
5
|
<img src="img/69786f8e2a527b8c26f2c1311e230e5f.webp.png" alt="Module File Generator" height="150" width="150">
|
6
6
|
|
7
|
+
## Features
|
7
8
|
|
8
|
-
|
9
|
+
- Generate complete VIPER module structure
|
10
|
+
- Support for both Swift and Objective-C
|
11
|
+
- Customizable templates
|
12
|
+
- Command-line interface
|
13
|
+
- Detailed logging for debugging
|
9
14
|
|
10
|
-
##
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
Add this line to your application's Gemfile:
|
11
18
|
|
12
|
-
|
19
|
+
```ruby
|
20
|
+
gem 'mt_tool'
|
21
|
+
```
|
13
22
|
|
14
|
-
|
23
|
+
And then execute:
|
24
|
+
```bash
|
25
|
+
$ bundle install
|
26
|
+
```
|
15
27
|
|
16
|
-
|
28
|
+
Or install it yourself as:
|
29
|
+
```bash
|
30
|
+
$ gem install mt_tool
|
31
|
+
```
|
17
32
|
|
18
|
-
##
|
33
|
+
## Usage
|
19
34
|
|
20
|
-
|
35
|
+
### Generating a VIPER Module
|
21
36
|
|
22
|
-
|
37
|
+
```bash
|
38
|
+
# Generate a VIPER module
|
39
|
+
mt_tool vmod -n ModuleName -a "Author Name" -p ./path/to/module
|
40
|
+
|
41
|
+
# Example
|
42
|
+
mt_tool vmod -n HomeScreen -a "Tom Liu" -p ./Modules
|
43
|
+
```
|
23
44
|
|
24
|
-
|
45
|
+
### Command Options
|
25
46
|
|
26
|
-
|
47
|
+
- `-n, --name`: Module name (required)
|
48
|
+
- `-a, --author`: Author name (required)
|
49
|
+
- `-p, --path`: Target path for generation (required)
|
27
50
|
|
28
|
-
|
51
|
+
### Generated Structure
|
29
52
|
|
30
|
-
|
53
|
+
```
|
54
|
+
ModuleName/
|
55
|
+
├── ModuleNameEntity.swift
|
56
|
+
├── ModuleNameInteractor.swift
|
57
|
+
├── ModuleNamePresenter.swift
|
58
|
+
├── ModuleNameRouter.swift
|
59
|
+
└── ModuleNameViewController.swift
|
60
|
+
```
|
31
61
|
|
32
62
|
## Development
|
33
63
|
|
34
|
-
After checking out the repo, run `
|
64
|
+
After checking out the repo, run `bundle install` to install dependencies.
|
35
65
|
|
36
|
-
To
|
66
|
+
To run the test suite:
|
67
|
+
```bash
|
68
|
+
bundle exec rake test
|
69
|
+
```
|
70
|
+
|
71
|
+
To install this gem onto your local machine:
|
72
|
+
```bash
|
73
|
+
bundle exec rake install
|
74
|
+
```
|
37
75
|
|
38
76
|
## Contributing
|
39
77
|
|
40
|
-
|
78
|
+
1. Fork it
|
79
|
+
2. Create your feature branch (`git checkout -b feature/my-new-feature`)
|
80
|
+
3. Add tests for your changes
|
81
|
+
4. Make your changes
|
82
|
+
5. Run the tests (`bundle exec rake test`)
|
83
|
+
6. Commit your changes (`git commit -am 'Add some feature'`)
|
84
|
+
7. Push to the branch (`git push origin feature/my-new-feature`)
|
85
|
+
8. Create new Pull Request
|
86
|
+
|
87
|
+
## License
|
88
|
+
|
89
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
90
|
+
|
91
|
+
## Code of Conduct
|
92
|
+
|
93
|
+
Everyone interacting in the MtTool project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/lylelh/mt_tool/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
CHANGED
@@ -1,4 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "bundler/gem_tasks"
|
4
|
-
|
4
|
+
require "rspec/core/rake_task"
|
5
|
+
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
|
8
|
+
task :clean do
|
9
|
+
FileUtils.rm_rf('pkg')
|
10
|
+
FileUtils.rm_rf('test_output')
|
11
|
+
end
|
12
|
+
|
13
|
+
task :build => :clean
|
14
|
+
|
15
|
+
task :test => [:clean, :spec]
|
16
|
+
|
17
|
+
task :default => :test
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "mt_tool"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/mt_tool/commands.rb
CHANGED
@@ -1,50 +1,57 @@
|
|
1
|
-
|
2
1
|
require 'thor'
|
3
2
|
require 'mt_tool/module/module'
|
4
|
-
require '
|
3
|
+
require 'logger'
|
5
4
|
|
6
5
|
module MtTool
|
7
6
|
class CLI < Thor
|
8
7
|
include Thor::Actions
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
def initialize(*args)
|
10
|
+
super
|
11
|
+
@logger = Logger.new(STDOUT)
|
12
|
+
@logger.level = Logger::DEBUG
|
13
|
+
@logger.formatter = proc do |severity, datetime, progname, msg|
|
14
|
+
"[#{severity}][#{datetime.strftime('%Y-%m-%d %H:%M:%S.%L')}] #{msg}\n"
|
15
|
+
end
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
def create(path = nil)
|
22
|
-
Module.new(self .args,self .options ).create(path)
|
23
|
-
|
18
|
+
def self.exit_on_failure?
|
19
|
+
true
|
24
20
|
end
|
25
21
|
|
26
|
-
|
27
|
-
|
28
|
-
method_option :
|
29
|
-
|
30
|
-
|
22
|
+
desc 'vmod', '生成viper模块文件'
|
23
|
+
method_option :name, aliases: '-n', desc: 'Module name', required: true
|
24
|
+
method_option :author, aliases: '-a', desc: 'Author name', required: true
|
25
|
+
method_option :path, aliases: '-p', desc: 'Target path', required: true
|
26
|
+
def vmod
|
27
|
+
name = options[:name]
|
28
|
+
author = options[:author]
|
29
|
+
path = options[:path]
|
30
|
+
|
31
|
+
@logger.debug "====== VIPER Module Generation Started ======"
|
32
|
+
@logger.debug "Command Parameters:"
|
33
|
+
@logger.debug " - Module name: #{name}"
|
34
|
+
@logger.debug " - Author: #{author}"
|
35
|
+
@logger.debug " - Path: #{path}"
|
36
|
+
@logger.debug "Thor Options: #{options.inspect}"
|
37
|
+
@logger.debug "Thor Arguments: #{args.inspect}"
|
38
|
+
|
39
|
+
begin
|
40
|
+
@logger.debug "Creating new Module instance..."
|
41
|
+
module_instance = Module.new(self.args, self.options)
|
42
|
+
|
43
|
+
@logger.debug "Calling create_viper_module..."
|
44
|
+
module_instance.create_viper_module(path, name, "swift", "", author)
|
45
|
+
|
46
|
+
@logger.info "Successfully generated VIPER module: #{name}"
|
47
|
+
@logger.debug "====== VIPER Module Generation Completed ======"
|
48
|
+
rescue => e
|
49
|
+
@logger.error "Failed to generate VIPER module: #{e.message}"
|
50
|
+
@logger.debug "Error backtrace:"
|
51
|
+
@logger.debug e.backtrace.join("\n")
|
52
|
+
@logger.debug "====== VIPER Module Generation Failed ======"
|
53
|
+
raise e
|
54
|
+
end
|
31
55
|
end
|
32
|
-
|
33
|
-
desc 'model_class <prefix> <class name > <json file path> <output path>', '根据json文件生成模型类'
|
34
|
-
method_option :create, aliases: '-c'
|
35
|
-
def model_class(prefix,name, path ,output_path)
|
36
|
-
OcModel.new(self .args,self .options ).create(prefix,name ,path,output_path)
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
desc 'qt_model_class <prefix> <class name > <json file path> <output path>', '使用quicktype根据json文件生成模型类'
|
41
|
-
method_option :create, aliases: '-c'
|
42
|
-
def qt_model_class(prefix,name, path ,output_path)
|
43
|
-
OcModel.new(self .args,self .options ).qt_create(prefix,name ,path,output_path)
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
|
48
|
-
|
49
56
|
end
|
50
57
|
end
|
@@ -121,7 +121,7 @@ module MtTool
|
|
121
121
|
def prepare_folder
|
122
122
|
host_a = 'yeah'
|
123
123
|
host_b = 'ka'
|
124
|
-
template_repo_url = "
|
124
|
+
template_repo_url = "https://github.com/lyleLH/tom-pod-template"
|
125
125
|
system("git clone #{template_repo_url} #{@final_path}")
|
126
126
|
|
127
127
|
# FileUtils.remove_dir(@final_path, true)
|
data/lib/mt_tool/version.rb
CHANGED
data/mt_tool.gemspec
CHANGED
@@ -13,39 +13,34 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.required_ruby_version = ">= 2.6.0"
|
14
14
|
spec.metadata["homepage_uri"] = spec.homepage
|
15
15
|
spec.metadata["source_code_uri"] = "https://github.com/lyleLH/mt_tool"
|
16
|
+
spec.license = "MIT"
|
16
17
|
|
17
18
|
# Specify which files should be added to the gem when it is released.
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
spec.files = Dir[
|
20
|
+
"lib/**/*",
|
21
|
+
"bin/*",
|
22
|
+
"*.gemspec",
|
23
|
+
"README.md",
|
24
|
+
"Gemfile",
|
25
|
+
"Rakefile"
|
26
|
+
]
|
24
27
|
spec.bindir = "bin"
|
25
|
-
# spec.executables = spec.files.grep(%r{\Abin/}) { |f| File.basename(f) }
|
26
28
|
spec.executables << 'mt_tool'
|
27
29
|
spec.require_paths = ["lib"]
|
28
30
|
|
31
|
+
# Runtime dependencies
|
32
|
+
spec.add_dependency 'thor', '~> 1.2'
|
33
|
+
spec.add_dependency 'xcodeproj', '~> 1.22'
|
34
|
+
spec.add_dependency 'colored', '~> 1.2'
|
35
|
+
spec.add_dependency 'colored2', '~> 3.1'
|
36
|
+
spec.add_dependency 'pathname', '~> 0.2'
|
37
|
+
spec.add_dependency 'mustache', '~> 1.1'
|
38
|
+
spec.add_dependency 'activesupport', '~> 7.0'
|
29
39
|
|
30
|
-
#
|
31
|
-
|
32
|
-
spec.add_development_dependency '
|
33
|
-
spec.add_development_dependency '
|
34
|
-
spec.add_development_dependency '
|
35
|
-
spec.add_development_dependency '
|
36
|
-
spec.add_development_dependency 'rspec', '~> 3.2'
|
37
|
-
spec.add_development_dependency 'xcodeproj'
|
38
|
-
spec.add_development_dependency 'cocoapods'
|
39
|
-
spec.add_development_dependency 'cocoapods-core'
|
40
|
-
|
41
|
-
spec.add_dependency 'bundler'
|
42
|
-
spec.add_dependency 'thor'
|
43
|
-
spec.add_dependency 'xcodeproj'
|
44
|
-
spec.add_dependency 'colored'
|
45
|
-
spec.add_dependency 'colored2'
|
46
|
-
spec.add_dependency 'pathname'
|
47
|
-
spec.add_dependency 'mustache'
|
48
|
-
spec.add_dependency 'activesupport'
|
49
|
-
# For more information and examples about making a new gem, check out our
|
50
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
40
|
+
# Development dependencies
|
41
|
+
spec.add_development_dependency 'bundler', '~> 2.3'
|
42
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
43
|
+
spec.add_development_dependency 'rspec', '~> 3.12'
|
44
|
+
spec.add_development_dependency 'pry', '~> 0.14'
|
45
|
+
spec.add_development_dependency 'pry-byebug', '~> 3.10'
|
51
46
|
end
|