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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6779c969c47a7014a59fd584fb9a2ef70bb5e13e
4
- data.tar.gz: 9a677071123db85bc3efbc50924cee6b6a5bae8a
3
+ metadata.gz: 1e68122feb93f8115ea7b84a5d73ed704b9a22bb
4
+ data.tar.gz: 7fb46b24c07c2b3cf54510fb9e3679469e542b33
5
5
  SHA512:
6
- metadata.gz: b3d6557ab9cc800b8f33c607e37363ba3de7d2ff09d03fff2eb014e0a7cdbb618d165a4691b14d3dea3d8e7db96dd2b221a9214465f6ad21ff063673a2210f3c
7
- data.tar.gz: c81199059489597f9f9a22220adf562efe8471c9054262d153efd5ee004bd541ac2629f9ab77d7dcbf1a17ffac8fe4941f73784c8a12c08adbf7aa09b4cc8903
6
+ metadata.gz: 4dc9a576a7fb7c345afbe2ec0893af498afbf7c28ec2d4c7735c4891df8c405aa954df8a88c008785dec979f51a23dd31305476859243d8ba2c0d5e93e7c9cf3
7
+ data.tar.gz: b75f861f20be37825effa8b7ea0ba0c4c375cb6e12f705b71ec7e60d872542a8324917c3f6fe0aed46e8b2cc0c5ca718740f6fb9ddbd4c130d7bf43bf00d8b60
data/.gitignore CHANGED
@@ -13,4 +13,5 @@
13
13
  *.a
14
14
  mkmf.log
15
15
  .idea
16
- *.gem
16
+ *.gem
17
+ src
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/[my-github-username]/mybatis-cli/fork )
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
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
3
 
4
- require 'mybatis'
4
+ require_relative '../lib/mybatis-cli'
5
5
 
6
6
  begin
7
7
  system "export LC_ALL=en_US.UTF-8;export LC_CTYPE=en_US.UTF-8;export LANG=en_US.UTF-8"
@@ -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
- mapper_path << context.package.gsub(/\./,'/') if context.package
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
- mapper_path << context.package.gsub(/\./,'/') if context.package
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", :required => true, desc: "po class name"
11
- method_option :package, type: :string, aliases: "-p", default: "mybatis-cli" , desc: "po class package name"
12
- method_option :tablename, type: :string, aliases: "-t", default: '' , desc: "table name"
13
- method_option :list, type: :array, aliases: "-l", :required => true, desc: "table columns"
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)
@@ -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}"
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Mybatis
4
- VERSION = "0.0.5"
4
+ VERSION = "0.0.6"
5
5
  end
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.5
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