Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
corteza
corteza-server
Commits
60264dfc
Commit
60264dfc
authored
6 years ago
by
Tit Petric
Browse files
Options
Download
Email Patches
Plain Diff
upd(codegen): delete sam symlink
parent
92484d6b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
1 deletion
+77
-1
codegen/sam
codegen/sam
+0
-1
codegen/sam/rest/index.php
codegen/sam/rest/index.php
+31
-0
codegen/sam/rest/server/index.php
codegen/sam/rest/server/index.php
+46
-0
No files found.
codegen/sam
deleted
120000 → 0
View file @
92484d6b
crm
\ No newline at end of file
This diff is collapsed.
Click to expand it.
codegen/sam/rest/index.php
0 → 100644
View file @
60264dfc
<?php
foreach
(
$apis
as
$api
)
{
if
(
is_array
(
$api
[
'struct'
]))
{
$name
=
ucfirst
(
$api
[
'interface'
]);
$filename
=
$dirname
.
"/"
.
str_replace
(
".."
,
"."
,
strtolower
(
$name
)
.
".go"
);
$tpl
->
load
(
"http_.tpl"
);
$tpl
->
assign
(
$common
);
$tpl
->
assign
(
"package"
,
basename
(
__DIR__
));
$tpl
->
assign
(
"name"
,
$name
);
$tpl
->
assign
(
"api"
,
$api
);
$tpl
->
assign
(
"self"
,
strtolower
(
substr
(
$name
,
0
,
1
)));
$tpl
->
assign
(
"structs"
,
$api
[
'struct'
]);
$imports
=
array
();
foreach
(
$api
[
'struct'
]
as
$struct
)
{
if
(
isset
(
$struct
[
'imports'
]))
foreach
(
$struct
[
'imports'
]
as
$import
)
{
$imports
[]
=
$import
;
}
}
$tpl
->
assign
(
"imports"
,
$imports
);
$tpl
->
assign
(
"calls"
,
$api
[
'apis'
]);
$contents
=
str_replace
(
"
\n\n
}"
,
"
\n
}"
,
$tpl
->
get
());
if
(
!
file_exists
(
$filename
))
{
file_put_contents
(
$filename
,
$contents
);
echo
$filename
.
"
\n
"
;
}
}
}
This diff is collapsed.
Click to expand it.
codegen/sam/rest/server/index.php
0 → 100644
View file @
60264dfc
<?php
$templates
=
array
(
"http_interfaces.tpl"
=>
function
(
$name
,
$api
)
{
return
strtolower
(
$name
)
.
".go"
;
},
"http_request.tpl"
=>
function
(
$name
,
$api
)
{
return
strtolower
(
$name
)
.
"_requests.go"
;
},
"http_handlers.tpl"
=>
function
(
$name
,
$api
)
{
return
strtolower
(
$name
)
.
"_handlers.go"
;
},
"http_routes.tpl"
=>
function
(
$name
,
$api
)
{
return
strtolower
(
$name
)
.
"_routes.go"
;
}
);
foreach
(
$templates
as
$template
=>
$fn
)
foreach
(
$apis
as
$api
)
{
if
(
is_array
(
$api
[
'struct'
]))
{
$name
=
ucfirst
(
$api
[
'interface'
]);
$filename
=
$dirname
.
"/"
.
$fn
(
$name
,
$api
);
$tpl
->
load
(
$template
);
$tpl
->
assign
(
$common
);
$tpl
->
assign
(
"package"
,
basename
(
__DIR__
));
$tpl
->
assign
(
"name"
,
$name
);
$tpl
->
assign
(
"api"
,
$api
);
$tpl
->
assign
(
"apis"
,
$apis
);
$tpl
->
assign
(
"self"
,
strtolower
(
substr
(
$name
,
0
,
1
)));
$tpl
->
assign
(
"structs"
,
$api
[
'struct'
]);
$imports
=
array
();
foreach
(
$api
[
'struct'
]
as
$struct
)
{
if
(
isset
(
$struct
[
'imports'
]))
foreach
(
$struct
[
'imports'
]
as
$import
)
{
$imports
[]
=
$import
;
}
}
$tpl
->
assign
(
"imports"
,
$imports
);
$tpl
->
assign
(
"calls"
,
$api
[
'apis'
]);
$contents
=
str_replace
(
"
\n\n
}"
,
"
\n
}"
,
$tpl
->
get
());
file_put_contents
(
$filename
,
$contents
);
echo
$filename
.
"
\n
"
;
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment