mybatis-cli 0.0.5 → 0.0.6
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/.gitignore +2 -1
- data/README.md +1 -1
- data/bin/mybatis +1 -1
- data/lib/mybatis-cli.rb +1 -0
- data/lib/mybatis/builder/mapper_builder.rb +6 -2
- data/lib/mybatis/builder/mapper_xml_builder.rb +6 -2
- data/lib/mybatis/cli.rb +5 -4
- data/lib/mybatis/util/context.rb +3 -0
- data/lib/mybatis/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e68122feb93f8115ea7b84a5d73ed704b9a22bb
|
4
|
+
data.tar.gz: 7fb46b24c07c2b3cf54510fb9e3679469e542b33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4dc9a576a7fb7c345afbe2ec0893af498afbf7c28ec2d4c7735c4891df8c405aa954df8a88c008785dec979f51a23dd31305476859243d8ba2c0d5e93e7c9cf3
|
7
|
+
data.tar.gz: b75f861f20be37825effa8b7ea0ba0c4c375cb6e12f705b71ec7e60d872542a8324917c3f6fe0aed46e8b2cc0c5ca718740f6fb9ddbd4c130d7bf43bf00d8b60
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -24,7 +24,7 @@ TODO: Write usage instructions here
|
|
24
24
|
|
25
25
|
## Contributing
|
26
26
|
|
27
|
-
1. Fork it ( https://github.com/
|
27
|
+
1. Fork it ( https://github.com/typ0520/mybatis-cli/fork )
|
28
28
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
29
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
30
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/bin/mybatis
CHANGED
data/lib/mybatis-cli.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require_relative '../lib/mybatis'
|
@@ -38,9 +38,13 @@ module Mybatis
|
|
38
38
|
def get_mapper_path(workspace,context)
|
39
39
|
mapper_path = workspace
|
40
40
|
mapper_path << '/' unless mapper_path.end_with? '/'
|
41
|
-
|
41
|
+
if context.mapper_package != ''
|
42
|
+
mapper_path << context.mapper_package.gsub(/\./,'/')
|
43
|
+
else
|
44
|
+
mapper_path << context.package.gsub(/\./,'/') if context.package
|
45
|
+
mapper_path << 'mapper'
|
46
|
+
end
|
42
47
|
mapper_path << '/' unless mapper_path.end_with? '/'
|
43
|
-
mapper_path << 'mapper/'
|
44
48
|
end
|
45
49
|
end
|
46
50
|
end
|
@@ -67,9 +67,13 @@ module Mybatis
|
|
67
67
|
def get_mapper_xml_path(workspace,context)
|
68
68
|
mapper_path = workspace
|
69
69
|
mapper_path << '/' unless mapper_path.end_with? '/'
|
70
|
-
|
70
|
+
if context.mapper_package != ''
|
71
|
+
mapper_path << context.mapper_package.gsub(/\./,'/')
|
72
|
+
else
|
73
|
+
mapper_path << context.package.gsub(/\./,'/') if context.package
|
74
|
+
mapper_path << 'mapper'
|
75
|
+
end
|
71
76
|
mapper_path << '/' unless mapper_path.end_with? '/'
|
72
|
-
mapper_path << 'mapper/'
|
73
77
|
end
|
74
78
|
|
75
79
|
def get_class_path(context)
|
data/lib/mybatis/cli.rb
CHANGED
@@ -7,10 +7,11 @@ module Mybatis
|
|
7
7
|
desc "generate -p package -n name table_columns", "Build po-class,mapper-class,mapper-xml (alias: 'g')."
|
8
8
|
map ["g"] => :generate
|
9
9
|
|
10
|
-
method_option :name, type: :string, aliases: "-n",
|
11
|
-
method_option :package, type: :string, aliases: "-p",
|
12
|
-
method_option :
|
13
|
-
method_option :
|
10
|
+
method_option :name, type: :string, aliases: "-n", :required => true, desc: "po class name"
|
11
|
+
method_option :package, type: :string, aliases: "-p", default: '' , desc: "po class package name"
|
12
|
+
method_option :mapper_package, type: :string, aliases: "-m", default: '' , desc: "mapper class package name"
|
13
|
+
method_option :tablename, type: :string, aliases: "-t", default: '' , desc: "table name"
|
14
|
+
method_option :list, type: :array, aliases: "-l", :required => true, desc: "table columns"
|
14
15
|
|
15
16
|
def generate *args
|
16
17
|
Mybatis.generate(*args, options)
|
data/lib/mybatis/util/context.rb
CHANGED
@@ -19,6 +19,7 @@ module Mybatis
|
|
19
19
|
|
20
20
|
class GenerateContext
|
21
21
|
attr_accessor :package
|
22
|
+
attr_accessor :mapper_package
|
22
23
|
attr_accessor :po_name
|
23
24
|
attr_accessor :table_name
|
24
25
|
attr_accessor :attributes
|
@@ -26,8 +27,10 @@ module Mybatis
|
|
26
27
|
class << self
|
27
28
|
def instance_with_options options
|
28
29
|
#{"package"=>"package", "name"=>"Order", "tablename"=>"t_order", "list"=>["id", "order_no", "create_time"]}
|
30
|
+
p options
|
29
31
|
context = self.new
|
30
32
|
context.package = options[:package]
|
33
|
+
context.mapper_package = options[:mapper_package]
|
31
34
|
context.po_name = options[:name].upcase_first
|
32
35
|
context.table_name =
|
33
36
|
options[:tablename] != '' ? options[:tablename] : "t#{context.po_name.replace_upcase_to_underline}"
|
data/lib/mybatis/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mybatis-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tong
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- Rakefile
|
68
68
|
- bin/mybatis
|
69
69
|
- changelog.txt
|
70
|
+
- lib/mybatis-cli.rb
|
70
71
|
- lib/mybatis.rb
|
71
72
|
- lib/mybatis/builder/builder.rb
|
72
73
|
- lib/mybatis/builder/mapper_builder.rb
|