code stringlengths 1 1.05M | repo_name stringlengths 6 83 | path stringlengths 3 242 | language stringclasses 222
values | license stringclasses 20
values | size int64 1 1.05M |
|---|---|---|---|---|---|
package utils
import (
"encoding/json"
"github.com/crawlab-team/crawlab/core/interfaces"
)
func GetResultHash(value interface{}, keys []string) (res string, err error) {
m := make(map[string]interface{})
for _, k := range keys {
_value, ok := value.(interfaces.Result)
if !ok {
continue
}
v := _value.Ge... | 2302_79757062/crawlab | core/utils/result.go | Go | bsd-3-clause | 451 |
package utils
import "encoding/json"
// Object 转化为 String
func ObjectToString(params interface{}) string {
bytes, _ := json.Marshal(params)
return BytesToString(bytes)
}
// 获取 RPC 参数
func GetRpcParam(key string, params map[string]string) string {
return params[key]
}
| 2302_79757062/crawlab | core/utils/rpc.go | Go | bsd-3-clause | 288 |
package utils
func GetSpiderCol(col string, name string) string {
if col == "" {
return "results_" + name
}
return col
}
| 2302_79757062/crawlab | core/utils/spider.go | Go | bsd-3-clause | 127 |
package utils
import (
"github.com/crawlab-team/crawlab/db/generic"
"github.com/upper/db/v4"
"go.mongodb.org/mongo-driver/bson/primitive"
)
func GetSqlQuery(query generic.ListQuery) (res db.Cond) {
res = db.Cond{}
for _, c := range query {
switch c.Value.(type) {
case primitive.ObjectID:
c.Value = c.Value... | 2302_79757062/crawlab | core/utils/sql.go | Go | bsd-3-clause | 512 |
package utils
import (
"context"
"github.com/crawlab-team/crawlab/core/models/models"
"github.com/upper/db/v4"
"github.com/upper/db/v4/adapter/sqlite"
"time"
)
func GetSqliteSession(ds *models.DataSource) (s db.Session, err error) {
return getSqliteSession(context.Background(), ds)
}
func GetSqliteSessionWithT... | 2302_79757062/crawlab | core/utils/sqlite.go | Go | bsd-3-clause | 954 |
package utils
| 2302_79757062/crawlab | core/utils/stats.go | Go | bsd-3-clause | 14 |
package utils
import "github.com/spf13/viper"
func IsPro() bool {
return viper.GetString("info.edition") == "global.edition.pro"
}
| 2302_79757062/crawlab | core/utils/system.go | Go | bsd-3-clause | 134 |
package utils
import "github.com/crawlab-team/crawlab/core/constants"
func IsCancellable(status string) bool {
switch status {
case constants.TaskStatusPending,
constants.TaskStatusRunning:
return true
default:
return false
}
}
| 2302_79757062/crawlab | core/utils/task.go | Go | bsd-3-clause | 240 |
package utils
import (
"time"
)
func GetLocalTime(t time.Time) time.Time {
return t.In(time.Local)
}
func GetTimeString(t time.Time) string {
return t.Format("2006-01-02 15:04:05")
}
func GetLocalTimeString(t time.Time) string {
t = GetLocalTime(t)
return GetTimeString(t)
}
| 2302_79757062/crawlab | core/utils/time.go | Go | bsd-3-clause | 284 |
package utils
import "github.com/google/uuid"
func NewUUIDString() (res string) {
id, _ := uuid.NewUUID()
return id.String()
}
| 2302_79757062/crawlab | core/utils/uuid.go | Go | bsd-3-clause | 131 |
package errors
const (
errorPrefixMongo = "mongo"
errorPrefixRedis = "redis"
)
| 2302_79757062/crawlab | db/errors/base.go | Go | bsd-3-clause | 82 |
package errors
import "errors"
var (
ErrInvalidType = errors.New("invalid type")
ErrMissingValue = errors.New("missing value")
ErrNoCursor = errors.New("no cursor")
ErrAlreadyLocked = errors.New("already locked")
)
| 2302_79757062/crawlab | db/errors/errors.go | Go | bsd-3-clause | 229 |
package errors
import (
"errors"
"fmt"
)
var (
ErrorRedisInvalidType = NewRedisError("invalid type")
ErrorRedisLocked = NewRedisError("locked")
)
func NewRedisError(msg string) (err error) {
return errors.New(fmt.Sprintf("%s: %s", errorPrefixRedis, msg))
}
| 2302_79757062/crawlab | db/errors/redis.go | Go | bsd-3-clause | 270 |
package generic
const (
DataSourceTypeMongo = "mongo"
DataSourceTypeMysql = "mysql"
DataSourceTypePostgres = "postgres"
DataSourceTypeElasticSearch = "postgres"
)
| 2302_79757062/crawlab | db/generic/base.go | Go | bsd-3-clause | 189 |
package generic
type ListQueryCondition struct {
Key string
Op string
Value interface{}
}
type ListQuery []ListQueryCondition
type ListOptions struct {
Skip int
Limit int
Sort []ListSort
}
| 2302_79757062/crawlab | db/generic/list.go | Go | bsd-3-clause | 205 |
package generic
type Op string
const (
OpEqual = "eq"
)
| 2302_79757062/crawlab | db/generic/op.go | Go | bsd-3-clause | 59 |
package generic
type SortDirection string
const (
SortDirectionAsc SortDirection = "asc"
SortDirectionDesc SortDirection = "desc"
)
type ListSort struct {
Key string
Direction SortDirection
}
| 2302_79757062/crawlab | db/generic/sort.go | Go | bsd-3-clause | 206 |
package db
import "time"
type RedisClient interface {
Ping() (err error)
Keys(pattern string) (values []string, err error)
AllKeys() (values []string, err error)
Get(collection string) (value string, err error)
Set(collection string, value string) (err error)
Del(collection string) (err error)
RPush(collection... | 2302_79757062/crawlab | db/interfaces.go | Go | bsd-3-clause | 1,871 |
package mongo
import (
"context"
"encoding/json"
"fmt"
"github.com/apex/log"
"github.com/cenkalti/backoff/v4"
"github.com/crawlab-team/crawlab/trace"
"github.com/spf13/viper"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"sync"
)
var AppName = "crawlab-db"
var _clientMap =... | 2302_79757062/crawlab | db/mongo/client.go | Go | bsd-3-clause | 3,462 |
package mongo
import "context"
type ClientOption func(options *ClientOptions)
type ClientOptions struct {
Context context.Context
Uri string
Host string
Port string
Db string
Hosts []string
Usernam... | 2302_79757062/crawlab | db/mongo/client_options.go | Go | bsd-3-clause | 1,650 |
package mongo
import (
"context"
"github.com/crawlab-team/crawlab/db/errors"
"github.com/crawlab-team/crawlab/trace"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
)
type ColInterface interface {
I... | 2302_79757062/crawlab | db/mongo/col.go | Go | bsd-3-clause | 7,517 |
package mongo
import (
"github.com/crawlab-team/crawlab/trace"
"github.com/spf13/viper"
"go.mongodb.org/mongo-driver/mongo"
)
func GetMongoDb(dbName string, opts ...DbOption) (db *mongo.Database) {
if dbName == "" {
dbName = viper.GetString("mongo.db")
}
if dbName == "" {
dbName = "test"
}
_opts := &DbOp... | 2302_79757062/crawlab | db/mongo/db.go | Go | bsd-3-clause | 590 |
package mongo
import "go.mongodb.org/mongo-driver/mongo"
type DbOption func(options *DbOptions)
type DbOptions struct {
client *mongo.Client
}
func WithDbClient(c *mongo.Client) DbOption {
return func(options *DbOptions) {
options.client = c
}
}
| 2302_79757062/crawlab | db/mongo/db_options.go | Go | bsd-3-clause | 255 |
package mongo
import (
"context"
"github.com/crawlab-team/crawlab/db/errors"
"go.mongodb.org/mongo-driver/mongo"
)
type FindResultInterface interface {
One(val interface{}) (err error)
All(val interface{}) (err error)
GetCol() (col *Col)
GetSingleResult() (res *mongo.SingleResult)
GetCursor() (cur *mongo.Curs... | 2302_79757062/crawlab | db/mongo/result.go | Go | bsd-3-clause | 1,502 |
package mongo
import (
"context"
"github.com/crawlab-team/crawlab/trace"
"go.mongodb.org/mongo-driver/mongo"
)
func RunTransaction(fn func(mongo.SessionContext) error) (err error) {
return RunTransactionWithContext(context.Background(), fn)
}
func RunTransactionWithContext(ctx context.Context, fn func(mongo.Sess... | 2302_79757062/crawlab | db/mongo/transaction.go | Go | bsd-3-clause | 966 |
package redis
import (
"github.com/apex/log"
"github.com/crawlab-team/crawlab/db"
"github.com/crawlab-team/crawlab/db/errors"
"github.com/crawlab-team/crawlab/db/utils"
"github.com/crawlab-team/crawlab/trace"
"github.com/gomodule/redigo/redis"
"reflect"
"strings"
"time"
)
type Client struct {
// settings
b... | 2302_79757062/crawlab | db/redis/client.go | Go | bsd-3-clause | 12,026 |
package redis
var MemoryStatsMetrics = []string{
"peak.allocated",
"total.allocated",
"startup.allocated",
"overhead.total",
"keys.count",
"dataset.bytes",
}
| 2302_79757062/crawlab | db/redis/constants.go | Go | bsd-3-clause | 165 |
package redis
import (
"github.com/crawlab-team/crawlab/db"
"time"
)
type Option func(c db.RedisClient)
func WithBackoffMaxInterval(interval time.Duration) Option {
return func(c db.RedisClient) {
c.SetBackoffMaxInterval(interval)
}
}
func WithTimeout(timeout int) Option {
return func(c db.RedisClient) {
c... | 2302_79757062/crawlab | db/redis/options.go | Go | bsd-3-clause | 346 |
package redis
import (
"github.com/crawlab-team/crawlab/trace"
"github.com/gomodule/redigo/redis"
"github.com/spf13/viper"
"time"
)
func NewRedisPool() *redis.Pool {
var address = viper.GetString("redis.address")
var port = viper.GetString("redis.port")
var database = viper.GetString("redis.database")
var pas... | 2302_79757062/crawlab | db/redis/pool.go | Go | bsd-3-clause | 1,245 |
package test
import (
"github.com/crawlab-team/crawlab/db"
"github.com/crawlab-team/crawlab/db/redis"
"testing"
)
func init() {
var err error
T, err = NewTest()
if err != nil {
panic(err)
}
}
type Test struct {
client db.RedisClient
TestCollection string
TestMessage string
TestMessages ... | 2302_79757062/crawlab | db/redis/test/base.go | Go | bsd-3-clause | 1,522 |
package sql
import (
"errors"
"fmt"
"github.com/crawlab-team/crawlab/trace"
"github.com/jmoiron/sqlx"
)
func GetSqlDatabaseConnectionString(dataSourceType string, host string, port string, username string, password string, database string) (connStr string, err error) {
if dataSourceType == "mysql" {
connStr = ... | 2302_79757062/crawlab | db/sql/sql.go | Go | bsd-3-clause | 1,233 |
package utils
import "io"
func Close(c io.Closer) {
err := c.Close()
if err != nil {
//log.WithError(err).Error("关闭资源文件失败。")
}
}
func ContainsString(list []string, item string) bool {
for _, d := range list {
if d == item {
return true
}
}
return false
}
| 2302_79757062/crawlab | db/utils/utils.go | Go | bsd-3-clause | 291 |
FROM node:14 AS build
ADD . /app
WORKDIR /app
RUN rm /app/.npmrc
# install frontend
RUN npm i -g pnpm@7
RUN pnpm install
RUN pnpm run build
FROM alpine:3.14
# copy files
COPY --from=build /app/dist /app/dist
| 2302_79757062/crawlab | frontend/Dockerfile | Dockerfile | bsd-3-clause | 212 |
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset',
'@babel/preset-typescript'
]
}
| 2302_79757062/crawlab | frontend/babel.config.js | JavaScript | bsd-3-clause | 105 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="width=device-width,initial-scale=1.0" name="viewport">
<link href="favicon.ico" rel="icon">
<title>Crawlab</title>
<!--externals-->
<link href="https://cdn.jsd... | 2302_79757062/crawlab | frontend/index.html | HTML | bsd-3-clause | 6,183 |
/*
* For a detailed explanation regarding each configuration property and type check, visit:
* https://jestjs.io/docs/en/configuration.html
*/
export default {
// All imported modules in your tests should be mocked automatically
// automock: false,
// Stop running tests after `n` failures
// bail: 0,
//... | 2302_79757062/crawlab | frontend/jest.config.ts | TypeScript | bsd-3-clause | 6,592 |
function initCanvas() {
let canvas, ctx, circ, nodes, mouse, SENSITIVITY, SIBLINGS_LIMIT, DENSITY, NODES_QTY, ANCHOR_LENGTH, MOUSE_RADIUS,
TURBULENCE, MOUSE_MOVING_TURBULENCE, MOUSE_ANGLE_TURBULENCE, MOUSE_MOVING_RADIUS, BASE_BRIGHTNESS, RADIUS_DEGRADE,
SAMPLE_SIZE
let handle
// how close next node must... | 2302_79757062/crawlab | frontend/public/js/login-canvas.js | JavaScript | bsd-3-clause | 7,529 |
import 'crawlab-ui/dist/style.css';
import 'vue';
import {createApp} from 'crawlab-ui';
(async function () {
await createApp();
})();
| 2302_79757062/crawlab | frontend/src/main.ts | TypeScript | bsd-3-clause | 137 |
import {resolve} from 'path';
import {defineConfig, splitVendorChunkPlugin} from 'vite';
import vue from '@vitejs/plugin-vue';
import dynamicImport from 'vite-plugin-dynamic-import';
import {visualizer} from 'rollup-plugin-visualizer';
import externalGlobals from 'rollup-plugin-external-globals';
import {externalizeDep... | 2302_79757062/crawlab | frontend/vite.config.ts | TypeScript | bsd-3-clause | 1,796 |
const path = require("path")
const CopyWebpackPlugin = require('copy-webpack-plugin')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const alias = {
'crawlab-ui$': 'crawlab-ui/dist/crawlab-ui.umd.min.js',
'element-plus$': 'element-plus/dist/index.full.min.js',
'echarts$': 'e... | 2302_79757062/crawlab | frontend/vue.config.js | JavaScript | bsd-3-clause | 1,609 |
FROM golang:1.15
WORKDIR /app
ADD ./go.mod /app
ADD ./go.sum /app
RUN go mod download
CMD ["sh", "./bin/test.sh"]
| 2302_79757062/crawlab | fs/Dockerfile | Dockerfile | bsd-3-clause | 116 |
package fs
import "os"
const (
FilerResponseNotFoundErrorMessage = "response status code: 404"
FilerStatusNotFoundErrorMessage = "Status:404 Not Found"
)
const (
DefaultDirMode = os.FileMode(0766)
DefaultFileMode = os.FileMode(0666)
)
const (
MethodUpdateFile = "update-file"
MethodUploadFile = "upload-file... | 2302_79757062/crawlab | fs/constants.go | Go | bsd-3-clause | 357 |
package fs
import "errors"
var ErrorFsNotExists = errors.New("not exists")
| 2302_79757062/crawlab | fs/errors.go | Go | bsd-3-clause | 77 |
package fs
import (
"github.com/crawlab-team/goseaweedfs"
"time"
)
type Manager interface {
Init() (err error)
Close() (err error)
ListDir(remotePath string, isRecursive bool) (files []goseaweedfs.FilerFileInfo, err error)
UploadFile(localPath, remotePath string, args ...interface{}) (err error)
UploadDir(loca... | 2302_79757062/crawlab | fs/interface.go | Go | bsd-3-clause | 1,280 |
package copy
import (
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"syscall"
)
func CopyDirectory(scrDir, dest string) error {
entries, err := ioutil.ReadDir(scrDir)
if err != nil {
return err
}
for _, entry := range entries {
sourcePath := filepath.Join(scrDir, entry.Name())
destPath := filepath.Join(... | 2302_79757062/crawlab | fs/lib/copy/copy.go | Go | bsd-3-clause | 2,051 |
package fs
import "time"
type Option func(m Manager)
func WithFilerUrl(url string) Option {
return func(m Manager) {
m.SetFilerUrl(url)
}
}
func WithFilerAuthKey(authKey string) Option {
return func(m Manager) {
m.SetFilerAuthKey(authKey)
}
}
func WithTimeout(timeout time.Duration) Option {
return func(m ... | 2302_79757062/crawlab | fs/options.go | Go | bsd-3-clause | 744 |
package fs
import (
"bytes"
"errors"
"fmt"
"github.com/cenkalti/backoff/v4"
"github.com/crawlab-team/crawlab/trace"
"github.com/crawlab-team/goseaweedfs"
"github.com/emirpasic/gods/queues/linkedlistqueue"
"github.com/google/uuid"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"path"
"path/filepath"
"string... | 2302_79757062/crawlab | fs/seaweedfs_manager.go | Go | bsd-3-clause | 19,055 |
package test
import (
fs "github.com/crawlab-team/crawlab/fs"
"os"
"testing"
"time"
)
func init() {
var err error
T, err = NewTest()
if err != nil {
panic(err)
}
}
var T *Test
type Test struct {
m fs.Manager
}
func (t *Test) Setup(t2 *testing.T) {
t.Cleanup()
t2.Cleanup(t.Cleanup)
}
func (t *Test) Cl... | 2302_79757062/crawlab | fs/test/base.go | Go | bsd-3-clause | 778 |
package test
import (
"github.com/apex/log"
"github.com/cenkalti/backoff/v4"
"github.com/crawlab-team/crawlab/trace"
"github.com/google/uuid"
"io/ioutil"
"os"
"os/exec"
"path"
"path/filepath"
"time"
)
func init() {
var err error
TmpDir, err = filepath.Abs("tmp")
if err != nil {
panic(err)
}
if _, err... | 2302_79757062/crawlab | fs/test/utils.go | Go | bsd-3-clause | 2,564 |
package fs
import (
"fmt"
"github.com/crawlab-team/goseaweedfs"
"net/url"
"path/filepath"
"regexp"
"strings"
)
func IsGitFile(file goseaweedfs.FileInfo) (res bool) {
// skip .git
res, err := regexp.MatchString("/?\\.git/", file.Path)
if err != nil {
return false
}
return res
}
func getCollectionAndTtlFr... | 2302_79757062/crawlab | fs/utils.go | Go | bsd-3-clause | 2,353 |
#!/bin/sh
IFS=$'\n'
pattern=^replace
content=$(cat ./backend/go.mod)
for line in $content
do
if [[ $line =~ $pattern ]]; then
echo "Invalid ./backend/go.mod, which should not contain \"^replace\""
exit 1
fi
done
| 2302_79757062/crawlab | scripts/validate-backend.sh | Shell | bsd-3-clause | 219 |
package parser
// type: model / attribute
// {{task.spider.name}}
// =>
| 2302_79757062/crawlab | template-parser/entity.go | Go | bsd-3-clause | 74 |
package parser
func Parse(template string, args ...interface{}) (content string, err error) {
return ParseGeneral(template, args...)
}
func ParseGeneral(template string, args ...interface{}) (content string, err error) {
p, _ := NewGeneralParser()
if err := p.Parse(template); err != nil {
return "", err
}
retu... | 2302_79757062/crawlab | template-parser/func.go | Go | bsd-3-clause | 343 |
package parser
import (
"encoding/json"
"errors"
"fmt"
"github.com/robertkrimen/otto"
"regexp"
"strings"
)
type GeneralParser struct {
tagPattern string
tagRegexp *regexp.Regexp
mathPattern string
mathRegexp *regexp.Regexp
template string
indexes [][]int
matches [][]string
placehol... | 2302_79757062/crawlab | template-parser/general_parser.go | Go | bsd-3-clause | 4,249 |
package parser
type Entity interface {
GetType() string
SetType(string)
GetName() string
SetName(string)
}
| 2302_79757062/crawlab | template-parser/interfaces.go | Go | bsd-3-clause | 112 |
package parser
type Parser interface {
Parse(template string) (err error)
Render(args ...interface{}) (content string, err error)
}
| 2302_79757062/crawlab | template-parser/parser.go | Go | bsd-3-clause | 135 |
package parser
import (
"encoding/json"
"errors"
"fmt"
"github.com/crawlab-team/crawlab/db/mongo"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"regexp"
"strings"
)
var userRegexp, _ = regexp.Compile("^user(?:\\[(\\w+)\\])?$")
var extRegexp, _ = regexp.Compile("^(\\w+)?:(\\w+... | 2302_79757062/crawlab | template-parser/variable.go | Go | bsd-3-clause | 6,506 |
package vcs
const (
GitRemoteNameOrigin = "origin"
GitRemoteNameUpstream = "upstream"
GitRemoteNameCrawlab = "crawlab"
)
const GitDefaultRemoteName = GitRemoteNameOrigin
const (
GitBranchNameMaster = "master"
GitBranchNameMain = "main"
GitBranchNameRelease = "release"
GitBranchNameTest = "test"
GitB... | 2302_79757062/crawlab | vcs/constants.go | Go | bsd-3-clause | 651 |
package vcs
import (
"time"
)
type GitOptions struct {
checkout []GitCheckoutOption
}
type GitRef struct {
Type string `json:"type"`
Name string `json:"name"`
FullName string `json:"full_name"`
Hash string `json:"hash"`
Timestamp time.Time `json:"timestamp"`
}
type GitLog struct {... | 2302_79757062/crawlab | vcs/entity.go | Go | bsd-3-clause | 889 |
package vcs
import "errors"
var (
ErrInvalidArgsLength = errors.New("invalid arguments length")
ErrUnsupportedType = errors.New("unsupported type")
ErrInvalidAuthType = errors.New("invalid auth type")
ErrInvalidOptions = errors.New("invalid options")
... | 2302_79757062/crawlab | vcs/errors.go | Go | bsd-3-clause | 781 |
package vcs
import (
"github.com/apex/log"
"github.com/crawlab-team/crawlab/trace"
"github.com/go-git/go-billy/v5"
"github.com/go-git/go-billy/v5/memfs"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/config"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/object"
"gith... | 2302_79757062/crawlab | vcs/git.go | Go | bsd-3-clause | 21,289 |
package vcs
import (
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/config"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/object"
"github.com/go-git/go-git/v5/plumbing/transport"
"strings"
)
type GitOption func(c *GitClient)
func WithPath(path string) GitOption {
ret... | 2302_79757062/crawlab | vcs/git_options.go | Go | bsd-3-clause | 4,946 |
package vcs
import "sync"
var GitMemStorages = sync.Map{}
var GitMemFileSystem = sync.Map{}
| 2302_79757062/crawlab | vcs/git_store.go | Go | bsd-3-clause | 94 |
package vcs
import (
"github.com/go-git/go-git/v5"
"os"
"path"
)
func CreateBareGitRepo(path string) (err error) {
// validate options
if path == "" {
return ErrInvalidRepoPath
}
// validate if exists
if IsGitRepoExists(path) {
return ErrRepoAlreadyExists
}
// create directory if not exists
_, err = ... | 2302_79757062/crawlab | vcs/git_utils.go | Go | bsd-3-clause | 1,179 |
package vcs
type Client interface {
Init() (err error)
Dispose() (err error)
Clone(opts ...GitCloneOption) (err error)
Checkout(opts ...GitCheckoutOption) (err error)
Commit(msg string, opts ...GitCommitOption) (err error)
Pull(opts ...GitPullOption) (err error)
Push(opts ...GitPushOption) (err error)
Reset(op... | 2302_79757062/crawlab | vcs/interface.go | Go | bsd-3-clause | 356 |
package test
import (
vcs "github.com/crawlab-team/crawlab/vcs"
"io/ioutil"
"os"
"path"
"sync"
"testing"
"time"
)
func init() {
var err error
T, err = NewTest()
if err != nil {
panic(err)
}
}
var T *Test
type Test struct {
RemoteRepoPath string
LocalRepoPath string
LocalRepo ... | 2302_79757062/crawlab | vcs/test/base.go | Go | bsd-3-clause | 2,822 |
package test
type Credential struct {
Username string `json:"username"`
Password string `json:"password"`
TestRepoHttpUrl string `json:"test_repo_http_url"`
TestRepoMultiBranchUrl string `json:"test_repo_multi_branch_url"`
SshUsername string `json:"ssh_username"`
Ssh... | 2302_79757062/crawlab | vcs/test/credential.go | Go | bsd-3-clause | 538 |
package vcs
import (
"os/user"
"path/filepath"
)
func getDefaultPublicKeyPath() (path string) {
u, err := user.Current()
if err != nil {
return path
}
path = filepath.Join(u.HomeDir, ".ssh", "id_rsa")
return
}
| 2302_79757062/crawlab | vcs/utils.go | Go | bsd-3-clause | 221 |
FROM golang:1.16
RUN go env -w GOPROXY=https://goproxy.io,https://goproxy.cn && \
go env -w GO111MODULE="on"
WORKDIR /tools
RUN go get github.com/cosmtrek/air
WORKDIR /backend
RUN rm -rf /tools
# set as non-interactive
ENV DEBIAN_FRONTEND noninteractive
# install packages
RUN chmod 777 /tmp \
&& apt-get updat... | 2302_79757062/crawlab | workspace/dockerfiles/golang/Dockerfile | Dockerfile | bsd-3-clause | 1,203 |
FROM node:12
WORKDIR frontend
ENV SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/
RUN npm config set registry "http://registry.npm.taobao.org"
| 2302_79757062/crawlab | workspace/dockerfiles/node/Dockerfile | Dockerfile | bsd-3-clause | 154 |
package com.example.demo5
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation... | 2302_80106977/demo4 | demo5/app/src/androidTest/java/com/example/demo5/ExampleInstrumentedTest.kt | Kotlin | unknown | 661 |
package com.example.demo5
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box... | 2302_80106977/demo4 | demo5/app/src/main/java/com/example/demo5/MainActivity.kt | Kotlin | unknown | 4,533 |
package com.example.demo5.data
import com.example.demo5.R
import com.example.demo5.model.Topic
object DataSource {
val topics = listOf(
Topic(R.string.architecture, 58, R.drawable.img1),
Topic(R.string.automotive, 30, R.drawable.img2),
Topic(R.string.biology, 90, R.drawable.img3),
... | 2302_80106977/demo4 | demo5/app/src/main/java/com/example/demo5/data/DataSource.kt | Kotlin | unknown | 1,481 |
package com.example.demo5.model
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
data class Topic(
@StringRes val name: Int,
val availableCourses: Int,
@DrawableRes val imageRes: Int
) | 2302_80106977/demo4 | demo5/app/src/main/java/com/example/demo5/model/Topic.kt | Kotlin | unknown | 225 |
package com.example.demo5.ui.theme
import androidx.compose.ui.graphics.Color
val Purple80 = Color(0xFFD0BCFF)
val PurpleGrey80 = Color(0xFFCCC2DC)
val Pink80 = Color(0xFFEFB8C8)
val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71)
val Pink40 = Color(0xFF7D5260) | 2302_80106977/demo4 | demo5/app/src/main/java/com/example/demo5/ui/theme/Color.kt | Kotlin | unknown | 281 |
package com.example.demo5.ui.theme
import android.app.Activity
import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compos... | 2302_80106977/demo4 | demo5/app/src/main/java/com/example/demo5/ui/theme/Theme.kt | Kotlin | unknown | 1,690 |
package com.example.demo5.ui.theme
import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
// Set of Material typography styles to start with
val Typography... | 2302_80106977/demo4 | demo5/app/src/main/java/com/example/demo5/ui/theme/Type.kt | Kotlin | unknown | 986 |
package com.example.demo5
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEqu... | 2302_80106977/demo4 | demo5/app/src/test/java/com/example/demo5/ExampleUnitTest.kt | Kotlin | unknown | 341 |
package com.example.myapplication
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing docum... | 2302_80106977/zxy | MyApplication/app/src/androidTest/java/com/example/myapplication/ExampleInstrumentedTest.kt | Kotlin | unknown | 677 |
package com.example.myapplication
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.mat... | 2302_80106977/zxy | MyApplication/app/src/main/java/com/example/myapplication/MainActivity.kt | Kotlin | unknown | 1,493 |
package com.example.myapplication.ui.theme
import androidx.compose.ui.graphics.Color
val Purple80 = Color(0xFFD0BCFF)
val PurpleGrey80 = Color(0xFFCCC2DC)
val Pink80 = Color(0xFFEFB8C8)
val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71)
val Pink40 = Color(0xFF7D5260) | 2302_80106977/zxy | MyApplication/app/src/main/java/com/example/myapplication/ui/theme/Color.kt | Kotlin | unknown | 289 |
package com.example.myapplication.ui.theme
import android.app.Activity
import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.dynamicDarkColorScheme
import android... | 2302_80106977/zxy | MyApplication/app/src/main/java/com/example/myapplication/ui/theme/Theme.kt | Kotlin | unknown | 1,706 |
package com.example.myapplication.ui.theme
import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
// Set of Material typography styles to start with
val Ty... | 2302_80106977/zxy | MyApplication/app/src/main/java/com/example/myapplication/ui/theme/Type.kt | Kotlin | unknown | 994 |
package com.example.myapplication
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
a... | 2302_80106977/zxy | MyApplication/app/src/test/java/com/example/myapplication/ExampleUnitTest.kt | Kotlin | unknown | 349 |
package com.example.myui
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation]... | 2302_80106977/demo2 | MyUI/app/src/androidTest/java/com/example/myui/ExampleInstrumentedTest.kt | Kotlin | unknown | 659 |
package com.example.myui
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout... | 2302_80106977/demo2 | MyUI/app/src/main/java/com/example/myui/MainActivity.kt | Kotlin | unknown | 8,308 |
package com.example.myui.ui.theme
import androidx.compose.ui.graphics.Color
val Purple80 = Color(0xFFD0BCFF)
val PurpleGrey80 = Color(0xFFCCC2DC)
val Pink80 = Color(0xFFEFB8C8)
val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71)
val Pink40 = Color(0xFF7D5260) | 2302_80106977/demo2 | MyUI/app/src/main/java/com/example/myui/ui/theme/Color.kt | Kotlin | unknown | 280 |
package com.example.myui.ui.theme
import android.app.Activity
import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose... | 2302_80106977/demo2 | MyUI/app/src/main/java/com/example/myui/ui/theme/Theme.kt | Kotlin | unknown | 1,688 |
package com.example.myui.ui.theme
import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
// Set of Material typography styles to start with
val Typography ... | 2302_80106977/demo2 | MyUI/app/src/main/java/com/example/myui/ui/theme/Type.kt | Kotlin | unknown | 985 |
package com.example.myui
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEqua... | 2302_80106977/demo2 | MyUI/app/src/test/java/com/example/myui/ExampleUnitTest.kt | Kotlin | unknown | 340 |
<!DOCTYPE html>
<html lang="en" ng-app="portainer">
<head>
<meta charset="utf-8">
<title>Portainer面板</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="Portainer.io">
<link rel="stylesheet" href="css/app.069dd38e.... | 2302_77879529/lottery | doc/assets/Portainer-CN/index.html | HTML | apache-2.0 | 2,810 |
/*
Navicat Premium Data Transfer
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 50639
Source Host : localhost:3306
Source Schema : lottery
Target Server Type : MySQL
Target Server Version : 50639
File Encoding : 65001
Date: 04/12/2021 12... | 2302_77879529/lottery | doc/assets/sql/lottery.sql | PLpgSQL | apache-2.0 | 10,499 |
/*
Navicat Premium Data Transfer
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 50639
Source Host : localhost:3306
Source Schema : lottery_01
Target Server Type : MySQL
Target Server Version : 50639
File Encoding : 65001
Date: 11/12/2021... | 2302_77879529/lottery | doc/assets/sql/lottery_01.sql | PLpgSQL | apache-2.0 | 16,211 |
/*
Navicat Premium Data Transfer
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 50639
Source Host : localhost:3306
Source Schema : lottery_02
Target Server Type : MySQL
Target Server Version : 50639
File Encoding : 65001
Date: 11/12/2021... | 2302_77879529/lottery | doc/assets/sql/lottery_02.sql | PLpgSQL | apache-2.0 | 14,928 |
/*
Navicat Premium Data Transfer
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 50639
Source Host : localhost:3306
Source Schema : xxl_job
Target Server Type : MySQL
Target Server Version : 50639
File Encoding : 65001
Date: 04/12/2021 16... | 2302_77879529/lottery | doc/assets/sql/xxl-job.sql | PLpgSQL | apache-2.0 | 10,152 |
#!/bin/sh
# 使用说明,用来提示输入参数
usage() {
echo "Usage: sh 执行脚本.sh [base|services|stop|rm]"
exit 1
}
# 启动基础环境(必须)
base(){
docker-compose up -d lottery-mysql lottery-redis lottery-nacos lottery-kafka lottery-zookeeper
}
# 启动程序模块(必须)
services(){
docker-compose up -d lottery-website lottery-api lottery-draw lottery-erp
}
... | 2302_77879529/lottery | doc/docker/deploy.sh | Shell | apache-2.0 | 770 |
FROM openjdk:8-jre
MAINTAINER bytemecc
VOLUME /home/Lottery
RUN mkdir -p /home/Lottery
WORKDIR /home/Lottery
COPY ./jar/Lottery-API.jar /home/Lottery/app.jar
# ADD Lottery-API.jar /app.jar
RUN bash -c 'touch /home/Lottery/app.jar'
ENTRYPOINT ["java","-jar","/home/Lottery/app.jar"]
| 2302_77879529/lottery | doc/docker/lottery/api/Dockerfile | Dockerfile | apache-2.0 | 286 |
FROM openjdk:8-jre
MAINTAINER bytemecc
VOLUME /home/Lottery
RUN mkdir -p /home/Lottery
WORKDIR /home/Lottery
COPY ./jar/Lottery.jar /home/Lottery/app.jar
# ADD Lottery-API.jar /app.jar
RUN bash -c 'touch /home/Lottery/app.jar'
ENTRYPOINT ["java","-jar","/home/Lottery/app.jar"]
| 2302_77879529/lottery | doc/docker/lottery/draw/Dockerfile | Dockerfile | apache-2.0 | 283 |
FROM tomcat:8
COPY /usr/local/tomcat/conf/ ./lottery/erp/conf/
COPY ./webapps/ /usr/local/tomcat/webapps/
| 2302_77879529/lottery | doc/docker/lottery/erp/Dockerfile | Dockerfile | apache-2.0 | 111 |
# 基础镜像
FROM mysql:5.7
# author
MAINTAINER bytemecc
ENV MYSQL_ROOT_PASSWORD "自己的密码"
# 执行sql脚本
COPY ./db/ /docker-entrypoint-initdb.d/
| 2302_77879529/lottery | doc/docker/mysql/Dockerfile | Dockerfile | apache-2.0 | 164 |