Compare commits
	
		
			21 Commits
		
	
	
		
			v0.0.1
			...
			718665e520
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 718665e520 | |||
| 480a407b9e | |||
| d0e9c04326 | |||
| 3ab92ee93a | |||
| 
						 | 
					dc6e801c23 | ||
| 
						 | 
					788a9f38fe | ||
| 
						 | 
					2d1a4bc89f | ||
| 
						 | 
					143b646dc8 | ||
| 
						 | 
					755db6988c | ||
| 
						 | 
					0a231f6ba2 | ||
| 
						 | 
					e2fa558ad9 | ||
| 
						 | 
					f409fcee70 | ||
| 
						 | 
					ffa1bb68c8 | ||
| 
						 | 
					e3101160e1 | ||
| 
						 | 
					2429fcf6f7 | ||
| 
						 | 
					3cb451251c | ||
| 
						 | 
					c771a8671f | ||
| 
						 | 
					950fd84ae6 | ||
| 
						 | 
					15c5ca21d5 | ||
| 
						 | 
					4f563cae10 | ||
| 
						 | 
					0b85f4a661 | 
							
								
								
									
										48
									
								
								.github/workflows/docs.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								.github/workflows/docs.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
			
		||||
name: Docs
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
    branches: [ "master" ]
 | 
			
		||||
  workflow_dispatch:
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  build:
 | 
			
		||||
    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: Build docs
 | 
			
		||||
        run: |
 | 
			
		||||
          v doc -f html -m .
 | 
			
		||||
          pushd _docs
 | 
			
		||||
          ln -vs licenseid.html index.html
 | 
			
		||||
          ls -alFh
 | 
			
		||||
          popd
 | 
			
		||||
 | 
			
		||||
      - name: Upload static files as artifact
 | 
			
		||||
        id: deployment
 | 
			
		||||
        uses: actions/upload-pages-artifact@v3
 | 
			
		||||
        with:
 | 
			
		||||
          path: _docs/
 | 
			
		||||
 | 
			
		||||
  deploy:
 | 
			
		||||
    needs: build
 | 
			
		||||
    environment:
 | 
			
		||||
      name: github-pages
 | 
			
		||||
      url: ${{ steps.deployment.outputs.page_url }}
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Deploy to GitHub Pages
 | 
			
		||||
        id: deployment
 | 
			
		||||
        uses: actions/deploy-pages@v4
 | 
			
		||||
 | 
			
		||||
permissions:
 | 
			
		||||
  contents: read
 | 
			
		||||
  pages: write
 | 
			
		||||
  id-token: write
 | 
			
		||||
							
								
								
									
										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 .
 | 
			
		||||
							
								
								
									
										1
									
								
								.vdocignore
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.vdocignore
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
examples/
 | 
			
		||||
							
								
								
									
										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_URL1)
 | 
			
		||||
	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