Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
iguir2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pet-estatistica
iguir2
Commits
7fefaa5c
Commit
7fefaa5c
authored
9 years ago
by
Eduardo E. R. Junior
Browse files
Options
Downloads
Patches
Plain Diff
Corrige bugs e padroniza mensagens ao usuário
parent
9772e005
Branches
Branches containing commit
No related tags found
1 merge request
!1
Issue#1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
shinyApp
+36
-14
36 additions, 14 deletions
shinyApp
with
36 additions
and
14 deletions
shinyApp
+
36
−
14
View file @
7fefaa5c
...
@@ -25,7 +25,9 @@ $*
...
@@ -25,7 +25,9 @@ $*
executa a função runApp, abrindo o navegador padrão
executa a função runApp, abrindo o navegador padrão
-t : cria os arquivos conforme template definido para
-t : cria os arquivos conforme template definido para
o projeto IGUIR2
o projeto IGUIR2. Obs.: Tenha em um diretório acima da
aplicação (cd ..) o arquivo template.R com função R
chamada template já definida.
run: Executa uma aplicação shiny, com função runApp
run: Executa uma aplicação shiny, com função runApp
...
@@ -52,7 +54,7 @@ build_App() {
...
@@ -52,7 +54,7 @@ build_App() {
echo
-n
" Deseja sobrescrever? "
echo
-n
" Deseja sobrescrever? "
read
ANSWER
read
ANSWER
case
"
$ANSWER
"
in
case
"
$ANSWER
"
in
s
|
sim
|
y
|
yes
)
echo
"
-------------------------------------------
"
;;
s
|
sim
|
y
|
yes
)
echo
""
;;
n
|
não
|
no
)
exit
1
;;
n
|
não
|
no
)
exit
1
;;
*
)
echo
" Responda com as palavres: yes ou no"
*
)
echo
" Responda com as palavres: yes ou no"
exit
1
exit
1
...
@@ -88,6 +90,7 @@ build_App() {
...
@@ -88,6 +90,7 @@ build_App() {
run
)
run
)
echo
"Criando ui.R e server.R em
$DIR
"
echo
"Criando ui.R e server.R em
$DIR
"
emacs server.R ui.R &
emacs server.R ui.R &
echo
"Pressione ^C para interromper a aplicação"
Rscript
-e
"shiny::runApp(getwd(), launch.browser = TRUE)"
Rscript
-e
"shiny::runApp(getwd(), launch.browser = TRUE)"
;;
;;
*
)
*
)
...
@@ -101,12 +104,16 @@ build_AppTemplate() {
...
@@ -101,12 +104,16 @@ build_AppTemplate() {
echo
-n
" Deseja sobrescrever? "
echo
-n
" Deseja sobrescrever? "
read
ANSWER
read
ANSWER
case
"
$ANSWER
"
in
case
"
$ANSWER
"
in
s
|
sim
|
y
|
yes
)
echo
"
-------------------------------------------
"
;;
s
|
sim
|
y
|
yes
)
echo
""
;;
n
|
não
|
no
)
exit
1
;;
n
|
não
|
no
)
exit
1
;;
*
)
echo
" Responda com as palavres: yes ou no"
*
)
echo
" Responda com as palavres: yes ou no"
exit
1
exit
1
esac
esac
fi
fi
if
[
!
-e
"../template.R"
]
;
then
echo
"Arquivo template.R não existe! Favor defini-lo no diretório acima."
exit
1
fi
##-------------------------------------------
##-------------------------------------------
# Criando o server.R
# Criando o server.R
echo
"##-------------------------------------------"
>
server.R
echo
"##-------------------------------------------"
>
server.R
...
@@ -137,7 +144,7 @@ build_AppTemplate() {
...
@@ -137,7 +144,7 @@ build_AppTemplate() {
echo
"shinyUI("
>>
ui.R
echo
"shinyUI("
>>
ui.R
echo
" fluidPage("
>>
ui.R
echo
" fluidPage("
>>
ui.R
echo
" ## Cabeçalho IGUIR2"
>>
ui.R
echo
" ## Cabeçalho IGUIR2"
>>
ui.R
echo
" htmlOutput(
\"
header
\"
)
,
"
>>
ui.R
echo
" htmlOutput(
\"
header
\"
)"
>>
ui.R
echo
" "
>>
ui.R
echo
" "
>>
ui.R
echo
" "
>>
ui.R
echo
" "
>>
ui.R
echo
" )"
>>
ui.R
echo
" )"
>>
ui.R
...
@@ -148,6 +155,7 @@ build_AppTemplate() {
...
@@ -148,6 +155,7 @@ build_AppTemplate() {
run
)
run
)
echo
"Criando ui.R e server.R em
$DIR
"
echo
"Criando ui.R e server.R em
$DIR
"
emacs server.R ui.R &
emacs server.R ui.R &
echo
"Pressione ^C para interromper a aplicação"
Rscript
-e
"shiny::runApp(getwd(), launch.browser = TRUE)"
Rscript
-e
"shiny::runApp(getwd(), launch.browser = TRUE)"
;;
;;
*
)
*
)
...
@@ -165,7 +173,10 @@ fi
...
@@ -165,7 +173,10 @@ fi
# secundários, init e run. getopts é MUITO MUItO útil para opções do
# secundários, init e run. getopts é MUITO MUItO útil para opções do
# tipo -*
# tipo -*
## Aplicação
##======================================================================
## Inicia o script
echo
"-------------------------------------------"
if
[
$1
=
"init"
]
;
then
if
[
$1
=
"init"
]
;
then
if
[
$#
-eq
1
]
;
then
if
[
$#
-eq
1
]
;
then
build_App
build_App
...
@@ -193,6 +204,7 @@ if [ $1 = "init" ]; then
...
@@ -193,6 +204,7 @@ if [ $1 = "init" ]; then
elif
[
$1
=
"run"
]
;
then
elif
[
$1
=
"run"
]
;
then
if
[
$#
-eq
1
]
;
then
if
[
$#
-eq
1
]
;
then
echo
"Executando a aplicação em
$DIR
"
echo
"Executando a aplicação em
$DIR
"
echo
"Pressione ^C para interromper a aplicação"
Rscript
-e
"shiny::runApp(getwd(), launch.browser = TRUE)"
Rscript
-e
"shiny::runApp(getwd(), launch.browser = TRUE)"
elif
[
$#
-eq
2
]
;
then
elif
[
$#
-eq
2
]
;
then
case
$2
in
case
$2
in
...
@@ -201,12 +213,20 @@ elif [ $1 = "run" ]; then
...
@@ -201,12 +213,20 @@ elif [ $1 = "run" ]; then
-o
)
-o
)
echo
"Executando a aplicação e abrir arquivos no emacs"
echo
"Executando a aplicação e abrir arquivos no emacs"
emacs server.R ui.R &
emacs server.R ui.R &
echo
"Pressione ^C para interromper a aplicação"
Rscript
-e
"shiny::runApp(getwd(), launch.browser = TRUE)"
Rscript
-e
"shiny::runApp(getwd(), launch.browser = TRUE)"
;;
;;
*
)
*
)
if
[
-d
$2
]
;
then
if
[
-d
$2
]
;
then
echo
"Rodar a aplicação em
$2
"
cd
$2
Rscript
-e
"shiny::runApp(
\"
$2
\"
, launch.browser = TRUE)"
if
[
!
-e
"
$SV
"
]
||
[
!
-e
"
$UI
"
]
;
then
echo
"Este diretório não contém uma aplicação shiny completa"
echo
"Verifique os arquivos server.R e ui.R em
$2
"
exit
1
fi
echo
"Executando a aplicação em
$2
"
echo
"Pressione ^C para interromper a aplicação"
Rscript
-e
"shiny::runApp(getwd(), launch.browser = TRUE)"
else
else
echo
"Argumentos inválidos! Consulte shinyApp --help"
echo
"Argumentos inválidos! Consulte shinyApp --help"
exit
1
exit
1
...
@@ -222,16 +242,18 @@ elif [ $1 = "run" ]; then
...
@@ -222,16 +242,18 @@ elif [ $1 = "run" ]; then
exit
1
exit
1
fi
fi
emacs server.R ui.R &
emacs server.R ui.R &
echo
"Pressione ^C para interromper a aplicação"
Rscript
-e
"shiny::runApp(getwd(), launch.browser = TRUE)"
Rscript
-e
"shiny::runApp(getwd(), launch.browser = TRUE)"
elif
[
$3
=
"-o"
]
&&
[
-d
$2
]
;
then
elif
[
-d
$2
]
&&
[
$3
=
"-o"
]
;
then
echo
"Executando a aplicação em
$2
"
echo
"Executando a aplicação em
$2
"
cd
$2
cd
$2
if
[
!
-e
"
$SV
"
]
||
[
!
-e
"
$UI
"
]
;
then
if
[
!
-e
"
$SV
"
]
||
[
!
-e
"
$UI
"
]
;
then
echo
"Este diretório não contém uma aplicação shiny completa"
echo
"Este diretório não contém uma aplicação shiny completa"
echo
"Verifique os arquivos server.R e ui.R em
$
3
"
echo
"Verifique os arquivos server.R e ui.R em
$
2
"
exit
1
exit
1
fi
fi
emacs server.R ui.R &
emacs server.R ui.R &
echo
"Pressione ^C para interromper a aplicação"
Rscript
-e
"shiny::runApp(getwd(), launch.browser = TRUE)"
Rscript
-e
"shiny::runApp(getwd(), launch.browser = TRUE)"
else
else
echo
"Argumentos inválidos! Consulte shinyApp --help"
echo
"Argumentos inválidos! Consulte shinyApp --help"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment