metamodel 0.0.4 → 0.0.5
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/README.md +1 -1
- data/bin/meta +0 -0
- data/lib/metamodel/command/build.rb +32 -4
- data/lib/metamodel/template/file_header.swift.erb +0 -1
- data/lib/metamodel/template/metamodel.swift.erb +17 -1
- data/lib/metamodel/template/static_methods.swift.erb +1 -1
- data/lib/metamodel/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 299648ce9da2c26b4d34f74f90acdfff7dff076c
|
4
|
+
data.tar.gz: b3d307c710260f446bd61c1b2aa0f049523d92b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ab3d001805ebb322de152d52f9c01a973b3d329ae5fbe532f95d34ddfe3dec7c1c77f9e5c1b048aa2f0ace724c93e1da5de1779ad086d0adb4c167a3f2d8733
|
7
|
+
data.tar.gz: 3faf5fff2d4738bfe1fe140ce83f4c9f52ac8ab5548836f2863ae2d229496d5cc4621b467bf524af8d7f7c3ed28e68b55c7e8aa03e10e1bf3393206de3f9b1ad
|
data/README.md
CHANGED
@@ -99,7 +99,7 @@ Generating model files
|
|
99
99
|
Generating MetaModel.framework
|
100
100
|
-> MetaModel.framework located in current folder
|
101
101
|
|
102
|
-
[!] Please drag MetaModel.framework into Linked Frameworks and Libraries
|
102
|
+
[!] Please drag MetaModel.framework into Linked Frameworks and Libraries phrase.
|
103
103
|
```
|
104
104
|
|
105
105
|
This command build a `MetaModel.framework` in project root folder, you need to add this framework to **Linked frameworks and Libraries** phrase which located in `General` tab.
|
data/bin/meta
CHANGED
File without changes
|
@@ -33,7 +33,7 @@ module MetaModel
|
|
33
33
|
UI.message "Existing project `#{config.metamodel_xcode_project}`"
|
34
34
|
else
|
35
35
|
UI.section "Cloning MetaModel project into `./metamodel` folder" do
|
36
|
-
Git.clone(config.metamodel_template_uri, '
|
36
|
+
Git.clone(config.metamodel_template_uri, 'metamodel')
|
37
37
|
UI.message "Using `./metamodel/MetaModel.xcodeproj` to build module"
|
38
38
|
end
|
39
39
|
end
|
@@ -58,10 +58,38 @@ module MetaModel
|
|
58
58
|
|
59
59
|
def build_metamodel_framework
|
60
60
|
UI.section "Generating MetaModel.framework" do
|
61
|
-
|
62
|
-
|
61
|
+
|
62
|
+
build_iphoneos = "xcodebuild -scheme MetaModel \
|
63
|
+
-project MetaModel/MetaModel.xcodeproj \
|
64
|
+
-configuration Release -sdk iphoneos \
|
65
|
+
-derivedDataPath './metamodel' \
|
66
|
+
BITCODE_GENERATION_MODE=bitcode \
|
67
|
+
ONLY_ACTIVE_ARCH=NO \
|
68
|
+
CODE_SIGNING_REQUIRED=NO \
|
69
|
+
CODE_SIGN_IDENTITY="
|
70
|
+
build_iphonesimulator = "xcodebuild -scheme MetaModel \
|
71
|
+
-project MetaModel/MetaModel.xcodeproj \
|
72
|
+
-configuration Release -sdk iphonesimulator \
|
73
|
+
-derivedDataPath './metamodel' \
|
74
|
+
ONLY_ACTIVE_ARCH=NO \
|
75
|
+
CODE_SIGNING_REQUIRED=NO \
|
76
|
+
CODE_SIGN_IDENTITY="
|
77
|
+
result = system "#{build_iphoneos} > /dev/null &&
|
78
|
+
#{build_iphonesimulator} > /dev/null"
|
79
|
+
|
63
80
|
raise Informative, 'Building framework failed.' unless result
|
64
|
-
|
81
|
+
|
82
|
+
build_products_folder = "./metamodel/Build/Products"
|
83
|
+
|
84
|
+
copy_command = "cp -rf #{build_products_folder}/Release-iphoneos/MetaModel.framework . && \
|
85
|
+
cp -rf #{build_products_folder}/Release-iphonesimulator/MetaModel.framework/Modules/MetaModel.swiftmodule/* \
|
86
|
+
MetaModel.framework/Modules/MetaModel.swiftmodule/"
|
87
|
+
lipo_command = "lipo -create -output MetaModel.framework/MetaModel \
|
88
|
+
#{build_products_folder}/Release-iphonesimulator/MetaModel.framework/MetaModel \
|
89
|
+
#{build_products_folder}/Release-iphoneos/MetaModel.framework/MetaModel"
|
90
|
+
|
91
|
+
result = system "#{copy_command} && #{lipo_command}"
|
92
|
+
|
65
93
|
raise Informative, 'Copy framework to current folder failed.' unless result
|
66
94
|
UI.message "-> ".green + "MetaModel.framework located in current folder"
|
67
95
|
end
|
@@ -7,7 +7,6 @@
|
|
7
7
|
//
|
8
8
|
|
9
9
|
import Foundation
|
10
|
-
import SQLite
|
11
10
|
|
12
11
|
let path = NSSearchPathForDirectoriesInDomains(
|
13
12
|
.DocumentDirectory, .UserDomainMask, true
|
@@ -57,3 +56,20 @@ func executeSQL(sql: String, silent: Bool = false, success: (() -> ())? = nil) -
|
|
57
56
|
}
|
58
57
|
return nil
|
59
58
|
}
|
59
|
+
|
60
|
+
func executeScalarSQL(sql: String, silent: Bool = false, success: (() -> ())? = nil) -> Binding? {
|
61
|
+
defer { print("\n") }
|
62
|
+
print("-> Begin Transaction")
|
63
|
+
let startDate = NSDate()
|
64
|
+
let result = db.scalar(sql)
|
65
|
+
let endDate = NSDate()
|
66
|
+
let interval = endDate.timeIntervalSinceDate(startDate) * 1000
|
67
|
+
print("\tSQL (\(interval.format("0.2"))ms) \(sql)")
|
68
|
+
print("-> Commit Transaction")
|
69
|
+
|
70
|
+
if let success = success {
|
71
|
+
success()
|
72
|
+
}
|
73
|
+
|
74
|
+
return result
|
75
|
+
}
|
@@ -5,7 +5,7 @@ public extension <%= model.name %> {
|
|
5
5
|
}
|
6
6
|
static func count() -> Int {
|
7
7
|
let countSQL = "SELECT count(*) FROM \(tableName.unwrapped)"
|
8
|
-
guard let count =
|
8
|
+
guard let count = executeScalarSQL(countSQL) as? Int64 else { return 0 }
|
9
9
|
return Int(count)
|
10
10
|
}
|
11
11
|
|
data/lib/metamodel/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metamodel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Draveness Zuo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: claide
|
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
183
|
version: '0'
|
184
184
|
requirements: []
|
185
185
|
rubyforge_project:
|
186
|
-
rubygems_version: 2.6.
|
186
|
+
rubygems_version: 2.6.6
|
187
187
|
signing_key:
|
188
188
|
specification_version: 4
|
189
189
|
summary: The Cocoa models generator.
|