Compare commits
	
		
			4 Commits
		
	
	
		
			dc6e801c23
			...
			718665e520
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 718665e520 | |||
| 480a407b9e | |||
| d0e9c04326 | |||
| 3ab92ee93a | 
							
								
								
									
										4
									
								
								.github/workflows/docs.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/docs.yaml
									
									
									
									
										vendored
									
									
								
							@@ -1,9 +1,7 @@
 | 
			
		||||
name: CI
 | 
			
		||||
name: Docs
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
    branches: [ "master" ]
 | 
			
		||||
  pull_request:
 | 
			
		||||
    branches: [ "master" ]
 | 
			
		||||
  workflow_dispatch:
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										24
									
								
								.github/workflows/test.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								.github/workflows/test.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
			
		||||
name: Tests
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
    branches: [ "master" ]
 | 
			
		||||
  pull_request:
 | 
			
		||||
    branches: [ "master" ]
 | 
			
		||||
  workflow_dispatch:
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  test:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout code
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
 | 
			
		||||
      - name: Setup V
 | 
			
		||||
        run: |
 | 
			
		||||
          wget -qO /tmp/v.zip https://github.com/vlang/v/releases/latest/download/v_linux.zip
 | 
			
		||||
          unzip -q /tmp/v.zip -d /tmp
 | 
			
		||||
          echo /tmp/v >> "$GITHUB_PATH"
 | 
			
		||||
 | 
			
		||||
      - name: Run tests
 | 
			
		||||
        run: |
 | 
			
		||||
          v -stats test .
 | 
			
		||||
							
								
								
									
										23
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								Makefile
									
									
									
									
									
								
							@@ -1,23 +0,0 @@
 | 
			
		||||
SRC_DIR = src
 | 
			
		||||
DOC_DIR = doc
 | 
			
		||||
 | 
			
		||||
SPDX_LICENSE_LIST_FILE = src/licenselist.json
 | 
			
		||||
SPDX_LICENSE_LIST_FILE_MIN = src/licenselist.min.json
 | 
			
		||||
SPDX_LICENSE_LIST_FILE_TMP = /tmp/licenselist.json.new
 | 
			
		||||
SPDX_LICENSE_LIST_JSON_URL = https://spdx.org/licenses/licenses.json
 | 
			
		||||
 | 
			
		||||
licenselist:
 | 
			
		||||
	wget -q -O $(SPDX_LICENSE_LIST_FILE_TMP) $(SPDX_LICENSE_LIST_JSON_URL)
 | 
			
		||||
	if ! diff $(SPDX_LICENSE_LIST_FILE) $(SPDX_LICENSE_LIST_FILE_TMP) >/dev/null 2>&1; \
 | 
			
		||||
		then mv -v $(SPDX_LICENSE_LIST_FILE_TMP) $(SPDX_LICENSE_LIST_FILE); \
 | 
			
		||||
	fi
 | 
			
		||||
	jq -c . < $(SPDX_LICENSE_LIST_FILE) > $(SPDX_LICENSE_LIST_FILE_MIN)
 | 
			
		||||
 | 
			
		||||
doc:
 | 
			
		||||
	v doc -f html -m ./$(SRC_DIR) -o $(DOC_DIR)
 | 
			
		||||
 | 
			
		||||
serve: clean doc
 | 
			
		||||
	v -e "import net.http.file; file.serve(folder: '$(DOC_DIR)')"
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	rm -r $(DOC_DIR) || true
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
## Query the SPDX license list and licenses information
 | 
			
		||||
# Query the SPDX license list
 | 
			
		||||
 | 
			
		||||
`licenseid` module embeds the SPDX license list data file taken from
 | 
			
		||||
https://spdx.org/licenses/licenses.json and allows you to obtain basic
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@ module licenseid
 | 
			
		||||
import json
 | 
			
		||||
import net.http
 | 
			
		||||
 | 
			
		||||
const licenses_file = $embed_file('licenselist.min.json')
 | 
			
		||||
const licenses_file = $embed_file('licenses.min.json')
 | 
			
		||||
const licenses = json.decode(LicenseList, licenses_file.to_string()) or { LicenseList{} }
 | 
			
		||||
 | 
			
		||||
struct LicenseList {
 | 
			
		||||
@@ -47,7 +47,7 @@ pub:
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// details fetches the license details object from SPDX data file using the
 | 
			
		||||
// details_url. Requires access to public network.
 | 
			
		||||
// details_url. Requires access to internet.
 | 
			
		||||
pub fn (l License) details() !LicenseDetails {
 | 
			
		||||
	response := http.get(l.details_url)!
 | 
			
		||||
	details := json.decode(LicenseDetails, response.body)!
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										25
									
								
								make.vsh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										25
									
								
								make.vsh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
#!/usr/bin/env -S v run
 | 
			
		||||
 | 
			
		||||
import build
 | 
			
		||||
import net.http
 | 
			
		||||
 | 
			
		||||
const source_url = 'https://spdx.org/licenses/licenses.json'
 | 
			
		||||
 | 
			
		||||
mut context := build.context(default: 'licenses.min.json')
 | 
			
		||||
 | 
			
		||||
context.artifact(
 | 
			
		||||
	name:       'licenses.json'
 | 
			
		||||
	help:       'SPDX licenses list in JSON format'
 | 
			
		||||
	should_run: |self| true
 | 
			
		||||
	run:        |self| http.download_file(source_url, self.name)!
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
context.artifact(
 | 
			
		||||
	name:       'licenses.min.json'
 | 
			
		||||
	help:       'The minified licenses.json ready for embedding (requires jq util)'
 | 
			
		||||
	depends:    ['licenses.json']
 | 
			
		||||
	should_run: |self| true
 | 
			
		||||
	run:        |self| system('jq -c . < licenses.json > ${self.name}')
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
context.run()
 | 
			
		||||
		Reference in New Issue
	
	Block a user