This commit is contained in:
Hong Ooi 2019-09-19 11:59:50 +10:00
Родитель f72e031d97
Коммит 20ac67d945
8 изменённых файлов: 157 добавлений и 21 удалений

10
.Rbuildignore Normal file
Просмотреть файл

@ -0,0 +1,10 @@
^misc$
^\.vs$
\.sln$
\.Rproj$
\.Rxproj$
^\.Rproj\.user$
.travis.yml
CONTRIBUTING.md
^LICENSE\.md$
azure-pipelines.yml

2
.gitignore поставляемый
Просмотреть файл

@ -34,3 +34,5 @@ vignettes/*.pdf
# Shiny token, see https://shiny.rstudio.com/articles/shinyapps.html
rsconnect/
misc/

23
DESCRIPTION Normal file
Просмотреть файл

@ -0,0 +1,23 @@
Package: AzureVision
Title: Interface to Azure Computer Vision Service
Version: 0.0.1
Authors@R: c(
person("Hong", "Ooi", , "hongooi@microsoft.com", role = c("aut", "cre")),
person("Microsoft", role="cph")
)
Description: An interface to the Azure Computer Vision service API.
URL: https://github.com/Azure/AzureVision https://github.com/Azure/AzureR
BugReports: https://github.com/Azure/AzureVision/issues
License: MIT + file LICENSE
Depends:
R (>= 3.3)
Imports:
AzureRMR,
httr (>= 1.3)
Suggests:
AzureAuth,
jpeg,
png,
svglite
Roxygen: list(markdown=TRUE)
RoxygenNote: 6.1.1

23
LICENSE
Просмотреть файл

@ -1,21 +1,2 @@
MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
YEAR: 2019
COPYRIGHT HOLDER: Microsoft

21
LICENSE.md Normal file
Просмотреть файл

@ -0,0 +1,21 @@
# MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE

3
NAMESPACE Normal file
Просмотреть файл

@ -0,0 +1,3 @@
# Generated by roxygen2: do not edit by hand
import(AzureRMR)

41
R/AzureVision.R Normal file
Просмотреть файл

@ -0,0 +1,41 @@
#' @import AzureRMR
NULL
globalVariables(c("self", "private"))
.onLoad <- function(libname, pkgname)
{
add_methods()
}
add_methods <- function()
{
az_resource_group$set("public", "create_vision_service", overwrite=TRUE,
function(name, location=self$location, sku="S1", ...)
{
az_resource$new(self$token, self$subscription, self$name,
type="Microsoft.CognitiveServices/accounts",
name=name,
location=location,
kind="ComputerVision",
sku=list(name=sku), ...)
})
az_resource_group$set("public", "get_vision_service", overwrite=TRUE,
function(name)
{
az_resource$new(self$token, self$subscription, self$name,
type="Microsoft.CognitiveServices/accounts",
name=name)
})
az_resource_group$set("public", "delete_vision_service", overwrite=TRUE,
function(name, confirm=TRUE, wait=FALSE)
{
az_resource$new(self$token, self$subscription, self$name,
type="Microsoft.CognitiveServices/accounts",
name=name,
deployed_properties=list(NULL))$delete(confirm=confirm, wait=wait)
})
}

55
azure-pipelines.yml Normal file
Просмотреть файл

@ -0,0 +1,55 @@
variables:
- group: GH
- name: R_LIBS_USER
value: '$(Agent.BuildDirectory)/R/library'
pool:
vmImage: 'ubuntu-latest'
container: $[variables['rockerImage']]
steps:
- bash: |
export CLOUDYR_REPO=$(echo $(Build.Repository.Name) | sed "s/Azure/cloudyr/")
git push --prune https://$(ghPat)@github.com/$CLOUDYR_REPO +refs/remotes/origin/*:refs/heads/* +refs/tags/*:refs/tags/*
displayName: 'Copy to Cloudyr'
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
- bash: |
echo "options(repos = '$(cranRepo)')" > ~/.Rprofile
echo ".libPaths(c('$R_LIBS_USER', .libPaths()))" >> ~/.Rprofile
mkdir -p $R_LIBS_USER
displayName: 'Setup R library directory'
- task: CacheBeta@0
inputs:
key: ./DESCRIPTION | "$(rockerImage)" | "$(cranRepo)"
path: $(R_LIBS_USER)
displayName: 'Caching packages'
- bash: |
Rscript -e "pkgs <- c('remotes', 'rcmdcheck', 'drat'); if(length(find.package(pkgs, quiet=TRUE)) != length(pkgs)) install.packages(pkgs)"
Rscript -e "remotes::install_deps(dependencies=TRUE)"
displayName: 'Installing package dependencies'
- bash: |
Rscript -e "f <- pkgbuild::build(dest_path='$(Build.ArtifactStagingDirectory)'); rcmdcheck::rcmdcheck(f, args='--no-manual', error_on='warning', check_dir='check')"
displayName: 'Checking package'
- bash: |
export PKGBUILD_GZ=$(ls $(Build.ArtifactStagingDirectory)/*.gz)
mkdir drat
cd drat
git init
git config user.email "dummy@example.com"
git config user.name "Azure Pipelines"
git remote add upstream "https://$(ghPat)@github.com/cloudyr/cloudyr.github.io.git"
git fetch upstream
git checkout master
Rscript -e "drat::insertPackage('$PKGBUILD_GZ', repodir='./drat')"
git add --all
git commit -m "add $PKGBUILD_GZ (build $(Build.BuildId))"
git push
displayName: 'Update Cloudyr drat'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))