translate2code 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/translate2code.rb +24 -4
- data/lib/translate2code/version.rb +1 -1
- data/translate2code.gemspec +0 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2eb8cbdab249b77b7046f1f38f7c7c7a40726b49
|
4
|
+
data.tar.gz: 5f75714145240c6b6fa98fcb446e25e852ff588a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee53b1d2f2ea352493441a3e66ef90367f1e04d84a5cfdd247203385316779a63e84ee27b1123967d7fa7225a7793bb1adee878ddcf5a831b778996976a6641e
|
7
|
+
data.tar.gz: 2f7bbdff4bec1ab57cbe50011b788180a59da866619c37e52607d7ae4f72bfe364da0803cc6d464bbccbdbf7ed072422a497a07af558c002a8b5631ebb76ae19
|
data/lib/translate2code.rb
CHANGED
@@ -1,6 +1,26 @@
|
|
1
|
-
|
1
|
+
require_relative 'translateUtil'
|
2
|
+
require_relative 'translate2language'
|
3
|
+
def startTranslateJson(jsonFilePath)
|
4
|
+
jsonClass = JSONClass.new
|
5
|
+
jsonClass.parseJson(jsonFilePath)
|
6
|
+
pp jsonClass
|
7
|
+
end
|
8
|
+
|
9
|
+
def startTranlate2Code(jsonFilePath,codeGenerateModel)
|
10
|
+
codeGenerateModel.startTranslate(jsonFilePath)
|
11
|
+
end
|
12
|
+
|
13
|
+
# 代码生成器
|
14
|
+
codeType = ARGV[-1]
|
15
|
+
codeGenerateModel = ModelDefinition.getModelDefinition(codeType)
|
16
|
+
if(codeGenerateModel)
|
17
|
+
jsonFilePaths = ARGV[0,ARGV.size-1]
|
18
|
+
# 遍历所有的json配置文件路径
|
19
|
+
jsonFilePaths.each do |jsonFilePath|
|
20
|
+
# 代码转换
|
21
|
+
startTranlate2Code(jsonFilePath,codeGenerateModel)
|
22
|
+
end
|
23
|
+
else
|
24
|
+
puts("没有选择对应平台的语言,请重试")
|
2
25
|
|
3
|
-
module Translate2code
|
4
|
-
class Error < StandardError; end
|
5
|
-
# Your code goes here...
|
6
26
|
end
|
data/translate2code.gemspec
CHANGED
@@ -15,16 +15,6 @@ Gem::Specification.new do |spec|
|
|
15
15
|
|
16
16
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
17
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
-
# if spec.respond_to?(:metadata)
|
19
|
-
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
20
|
-
|
21
|
-
# spec.metadata["homepage_uri"] = spec.homepage
|
22
|
-
# spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
|
23
|
-
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
24
|
-
# else
|
25
|
-
# raise "RubyGems 2.0 or newer is required to protect against " \
|
26
|
-
# "public gem pushes."
|
27
|
-
# end
|
28
18
|
|
29
19
|
# Specify which files should be added to the gem when it is released.
|
30
20
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|