translate2code 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/translate2OC.rb +99 -0
- data/lib/translate2code/version.rb +1 -1
- data/lib/translate2code.rb +0 -5
- data/lib/translate2java.rb +75 -0
- data/lib/translate2language.rb +112 -0
- data/lib/translateUtil.rb +46 -0
- metadata +5 -10
- data/.gitignore +0 -8
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -21
- data/README.md +0 -43
- data/Rakefile +0 -2
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/translate2code.gemspec +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 541047336d26e9b179a9eb15433cfbd9d5971d4e
|
4
|
+
data.tar.gz: 4c5c1c075c04a4f826b29cc4a4b6c89cb306ba7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cacdaaa6653fe5677cdd897e8f04a6d6586bf4e2b7331ef39b740ebfe835080fc8012dd74c24f7a7921aa2b41070eff114d27daca0c3aa5060ca794ca1189558
|
7
|
+
data.tar.gz: 8f797e087be5527750bbdddb55b8749b9be70c9f2e768d1f8aeed2b11c900082e05672b84d4f99f39a4da5fbd4bdff348d493a75a02e2a19d857cbd651e43486
|
data/lib/translate2OC.rb
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
require_relative 'translate2language'
|
2
|
+
class ModelDefinition;end
|
3
|
+
|
4
|
+
class OCModelDefinition < ModelDefinition
|
5
|
+
|
6
|
+
def property_definition(readonly, args)
|
7
|
+
property_str = "@property(nonatomic,readonly,class)#{property_type(args[1])} #{args[0]}; "
|
8
|
+
end
|
9
|
+
|
10
|
+
def property_type(property)
|
11
|
+
case property
|
12
|
+
when String
|
13
|
+
return "NSString *"
|
14
|
+
when TrueClass,FalseClass
|
15
|
+
return "BOOL"
|
16
|
+
when Float
|
17
|
+
return "float"
|
18
|
+
when Fixnum
|
19
|
+
return "int"
|
20
|
+
when Bignum
|
21
|
+
return "long long"
|
22
|
+
else
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def implementation_body(property)
|
27
|
+
case property
|
28
|
+
when String
|
29
|
+
return "getStringForKey:"
|
30
|
+
when TrueClass,FalseClass
|
31
|
+
return "getBoolForKey:"
|
32
|
+
when Float
|
33
|
+
return "getFloatForKey:"
|
34
|
+
when Fixnum
|
35
|
+
return "getInt32ForKey:"
|
36
|
+
when Bignum
|
37
|
+
return "getInt64ForKey:"
|
38
|
+
else
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def propterty_getterGenerator(args)
|
43
|
+
property_value = %Q(@"#{context.class_name}_#{args[0]}")
|
44
|
+
default_Value = args[1]
|
45
|
+
if String === args[1]
|
46
|
+
default_Value = %Q(@"#{default_Value}")
|
47
|
+
end
|
48
|
+
getter = "\n+(#{property_type(args[1])})#{args[0]} {
|
49
|
+
return [VideoConfigCacheMgr #{implementation_body(args[1])}:#{property_value} defaultValue:#{default_Value}];
|
50
|
+
}\n"
|
51
|
+
end
|
52
|
+
|
53
|
+
def property_instance(args)
|
54
|
+
property_value = args[1]
|
55
|
+
if String === args[1]
|
56
|
+
property_value = %Q(@"#{property_value}")
|
57
|
+
end
|
58
|
+
instance = "#{property_type(args[1])} _#{args[0]} = #{property_value};"
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
def header_template
|
63
|
+
template = <<-EOS
|
64
|
+
#import <Foundation/Foundation.h>
|
65
|
+
<%- if context.headers_str -%>
|
66
|
+
<%= context.headers_str %>
|
67
|
+
<%- end -%>
|
68
|
+
|
69
|
+
<%- if context.enums_str -%>
|
70
|
+
<%= context.enums_str %>
|
71
|
+
<%- end -%>
|
72
|
+
|
73
|
+
@interface <%= context.class_name %> : NSObject
|
74
|
+
<% context.properties.each do |prop| -%>
|
75
|
+
<%= property_definition(true, prop) %>
|
76
|
+
<% end -%>
|
77
|
+
@end
|
78
|
+
EOS
|
79
|
+
end
|
80
|
+
|
81
|
+
def implementation_template
|
82
|
+
template = <<-EOS
|
83
|
+
#import "<%= context.class_name %>.h"
|
84
|
+
#import "VideoConfigCacheMgr.h"
|
85
|
+
|
86
|
+
@implementation <%= context.class_name %>
|
87
|
+
<% context.properties.each do |prop| -%>
|
88
|
+
<%= propterty_getterGenerator(prop) %>
|
89
|
+
<% end -%>
|
90
|
+
@end
|
91
|
+
EOS
|
92
|
+
end
|
93
|
+
|
94
|
+
|
95
|
+
def finishTranslate
|
96
|
+
replace_file("#{getDirPath}/#{class_name}.h",header)
|
97
|
+
replace_file("#{getDirPath}/#{class_name}.m",implementation)
|
98
|
+
end
|
99
|
+
end
|
data/lib/translate2code.rb
CHANGED
@@ -1,10 +1,5 @@
|
|
1
1
|
require 'translateUtil'
|
2
2
|
require 'translate2language'
|
3
|
-
def startTranslateJson(jsonFilePath)
|
4
|
-
jsonClass = JSONClass.new
|
5
|
-
jsonClass.parseJson(jsonFilePath)
|
6
|
-
pp jsonClass
|
7
|
-
end
|
8
3
|
|
9
4
|
def startTranlate2Code(jsonFilePath,codeGenerateModel)
|
10
5
|
codeGenerateModel.startTranslate(jsonFilePath)
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require_relative 'translate2language'
|
2
|
+
class ModelDefinition;end
|
3
|
+
|
4
|
+
class JAVAModelDefinition < ModelDefinition
|
5
|
+
|
6
|
+
def property_definition(readonly, args)
|
7
|
+
property_value = args[1]
|
8
|
+
if String === args[1]
|
9
|
+
property_value = %Q("#{property_value}")
|
10
|
+
end
|
11
|
+
property_str = "private static #{property_type(args[1])} #{args[0]} = #{property_value}; "
|
12
|
+
end
|
13
|
+
|
14
|
+
def propterty_getterGenerator(args)
|
15
|
+
argParam = %Q("#{context.class_name}_#{args[0]}")
|
16
|
+
getter = "public static #{property_type(args[1])} get#{args[0]}(){
|
17
|
+
return VideoConfigCacheMgr.#{implementation_body(args[1])}(#{argParam},#{args[0]});
|
18
|
+
} "
|
19
|
+
end
|
20
|
+
|
21
|
+
def implementation_body(property)
|
22
|
+
case property
|
23
|
+
when String
|
24
|
+
return "decodeString"
|
25
|
+
when TrueClass,FalseClass
|
26
|
+
return "decodeBoolean"
|
27
|
+
when Float
|
28
|
+
return "decodeDouble"
|
29
|
+
when Fixnum
|
30
|
+
return "decodeInt"
|
31
|
+
when Bignum
|
32
|
+
return "decodeLong"
|
33
|
+
else
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def property_type(property)
|
38
|
+
case property
|
39
|
+
when String
|
40
|
+
return "String"
|
41
|
+
when TrueClass,FalseClass
|
42
|
+
return "boolean"
|
43
|
+
when Float
|
44
|
+
return "double"
|
45
|
+
when Fixnum
|
46
|
+
return "int"
|
47
|
+
when Bignum
|
48
|
+
return "long"
|
49
|
+
else
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def implementation_template
|
54
|
+
template = <<-EOS
|
55
|
+
package com.tencent.videobase.videoconfig;
|
56
|
+
|
57
|
+
import com.tencent.videobase.videoconfig.VideoConfigCacheMgr;
|
58
|
+
|
59
|
+
public final class <%= context.class_name %> {
|
60
|
+
<% context.properties.each do |prop| -%>
|
61
|
+
<%= property_definition(true,prop) %>
|
62
|
+
<% end -%>
|
63
|
+
|
64
|
+
<% context.properties.each do |prop| -%>
|
65
|
+
<%=propterty_getterGenerator(prop) %>
|
66
|
+
<% end -%>
|
67
|
+
|
68
|
+
}
|
69
|
+
EOS
|
70
|
+
end
|
71
|
+
|
72
|
+
def finishTranslate
|
73
|
+
replace_file("#{getDirPath}/#{class_name}.java",implementation)
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require_relative 'translate2OC'
|
3
|
+
require_relative 'translate2java'
|
4
|
+
|
5
|
+
# 代码生成器上下文,保存数据
|
6
|
+
class Context
|
7
|
+
@@videoConfigClassName = "className"
|
8
|
+
@@videoConfigProperties = "properties"
|
9
|
+
attr_reader :properties,
|
10
|
+
:class_name,
|
11
|
+
:headers_str,
|
12
|
+
:enums_str
|
13
|
+
|
14
|
+
def initialize(classname,properties)
|
15
|
+
@class_name = classname
|
16
|
+
@properties = properties
|
17
|
+
end
|
18
|
+
|
19
|
+
def enums(str)
|
20
|
+
@enums_str = str
|
21
|
+
end
|
22
|
+
|
23
|
+
def headers(str)
|
24
|
+
@headers_str = str
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# 代码生成器
|
29
|
+
class ModelDefinition
|
30
|
+
attr_accessor :configHash
|
31
|
+
def self.getModelDefinition(modelType)
|
32
|
+
case modelType
|
33
|
+
when "oc"
|
34
|
+
modelDefinition = OCModelDefinition.new
|
35
|
+
when "java"
|
36
|
+
modelDefinition = JAVAModelDefinition.new
|
37
|
+
end
|
38
|
+
end
|
39
|
+
def initialize
|
40
|
+
|
41
|
+
end
|
42
|
+
# 头文件生成
|
43
|
+
def header
|
44
|
+
erb_template = ERB.new(header_template, nil, '-')
|
45
|
+
erb_template.result(binding)
|
46
|
+
end
|
47
|
+
# 实现文件生成
|
48
|
+
def implementation
|
49
|
+
erb_template = ERB.new(implementation_template, nil, '-')
|
50
|
+
erb_template.result(binding)
|
51
|
+
end
|
52
|
+
# 类名
|
53
|
+
def class_name
|
54
|
+
context.class_name
|
55
|
+
end
|
56
|
+
|
57
|
+
attr_reader :context
|
58
|
+
# 生成器上下文
|
59
|
+
def setcontext(context)
|
60
|
+
@context = context
|
61
|
+
end
|
62
|
+
# 属性模板
|
63
|
+
def property_definition(readonly, args)
|
64
|
+
|
65
|
+
end
|
66
|
+
# 属性访问器模版
|
67
|
+
def propterty_getterGenerator(args)
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
#属性类型模板
|
72
|
+
def property_type(property)
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
# 头文件模版
|
77
|
+
def header_template
|
78
|
+
|
79
|
+
end
|
80
|
+
# 实现文件模版
|
81
|
+
def implementation_template
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
public
|
86
|
+
# 开始转换
|
87
|
+
def startTranslate(jsonFilePath)
|
88
|
+
begin
|
89
|
+
jsonData = File.read(jsonFilePath)
|
90
|
+
jsonObj = JSON.parse(jsonData)
|
91
|
+
@configHash = jsonObj
|
92
|
+
processTranslate
|
93
|
+
rescue
|
94
|
+
puts("配置文件格式出错")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
# 处理转换
|
98
|
+
def processTranslate
|
99
|
+
@configHash.each do |key,value|
|
100
|
+
setcontext(Context.new(key,value))
|
101
|
+
finishTranslate
|
102
|
+
end
|
103
|
+
|
104
|
+
|
105
|
+
end
|
106
|
+
# 结束转换
|
107
|
+
def finishTranslate
|
108
|
+
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'pp'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
def parseJson(path)
|
6
|
+
json = File.read(path)
|
7
|
+
obj = JSON.parse(json)
|
8
|
+
end
|
9
|
+
|
10
|
+
def getDirPath
|
11
|
+
fatherDir = File.expand_path("..", Dir.pwd)
|
12
|
+
outputDir = fatherDir + "/Output"
|
13
|
+
FileUtils.mkdir_p(outputDir) unless File.exists?(outputDir)
|
14
|
+
return outputDir
|
15
|
+
end
|
16
|
+
|
17
|
+
def replace_file(path, content)
|
18
|
+
File.open(path, "w") do |file|
|
19
|
+
file.write(content)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
class JSONClass
|
26
|
+
@@videoConfigClassName = "className"
|
27
|
+
@@videoConfigProperties = "properties"
|
28
|
+
|
29
|
+
attr_reader :className,
|
30
|
+
:properties
|
31
|
+
|
32
|
+
def initialize
|
33
|
+
@properties = []
|
34
|
+
end
|
35
|
+
|
36
|
+
def className(str)
|
37
|
+
@className = str
|
38
|
+
end
|
39
|
+
|
40
|
+
def properties(properties)
|
41
|
+
@properties = properties
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: translate2code
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- starsi
|
@@ -45,17 +45,12 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
-
|
49
|
-
- CODE_OF_CONDUCT.md
|
50
|
-
- Gemfile
|
51
|
-
- LICENSE.txt
|
52
|
-
- README.md
|
53
|
-
- Rakefile
|
54
|
-
- bin/console
|
55
|
-
- bin/setup
|
48
|
+
- lib/translate2OC.rb
|
56
49
|
- lib/translate2code.rb
|
57
50
|
- lib/translate2code/version.rb
|
58
|
-
-
|
51
|
+
- lib/translate2java.rb
|
52
|
+
- lib/translate2language.rb
|
53
|
+
- lib/translateUtil.rb
|
59
54
|
homepage:
|
60
55
|
licenses:
|
61
56
|
- MIT
|
data/.gitignore
DELETED
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,74 +0,0 @@
|
|
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 starsi@tencent.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/
|
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2019 starsi
|
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/README.md
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
# Translate2code
|
2
|
-
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/translate2code`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'translate2code'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install translate2code
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/translate2code. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
-
|
37
|
-
## License
|
38
|
-
|
39
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
-
|
41
|
-
## Code of Conduct
|
42
|
-
|
43
|
-
Everyone interacting in the Translate2code project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/translate2code/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "translate2code"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/translate2code.gemspec
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path("../lib", __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
puts(lib)
|
5
|
-
require "translate2code/version"
|
6
|
-
|
7
|
-
Gem::Specification.new do |spec|
|
8
|
-
spec.name = "translate2code"
|
9
|
-
spec.version = Translate2code::VERSION
|
10
|
-
spec.authors = ["starsi"]
|
11
|
-
spec.email = ["starsi@tencent.com"]
|
12
|
-
|
13
|
-
spec.summary = %q{代码转换器}
|
14
|
-
spec.description = %q{支持转换java,oc}
|
15
|
-
spec.license = "MIT"
|
16
|
-
# Specify which files should be added to the gem when it is released.
|
17
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
19
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
-
end
|
21
|
-
spec.bindir = "exe"
|
22
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
-
spec.require_paths = ["lib"]
|
24
|
-
|
25
|
-
spec.add_development_dependency "bundler", "~> 2.0"
|
26
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
-
end
|