metanorma-cli 1.3.7.3 → 1.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,73 +0,0 @@
1
- require "fontist"
2
- require "fileutils"
3
-
4
- module Metanorma
5
- module Cli
6
- class Setup
7
- def initialize(options)
8
- @options = options
9
- @font_name = options.fetch(:font)
10
- @term_agreement = options.fetch(:term_agreement, false)
11
-
12
- create_metanorma_fonts_directory
13
- end
14
-
15
- def self.run(options = {})
16
- new(options).run
17
- end
18
-
19
- def run
20
- font = Metanorma::Cli.fonts.grep(/#{font_name}/i)
21
-
22
- if font.empty?
23
- font_paths = download_font
24
- copy_to_fonts(font_paths)
25
- end
26
- end
27
-
28
- private
29
-
30
- attr_reader :font_name, :options, :term_agreement
31
-
32
- def create_metanorma_fonts_directory
33
- unless Metanorma::Cli.fonts_directory.exist?
34
- FileUtils.mkdir_p(Metanorma::Cli.fonts_directory)
35
- end
36
- end
37
-
38
- def metanorma_fonts_path
39
- @metanorma_fonts_path ||= Metanorma::Cli.fonts_directory
40
- end
41
-
42
- def download_font
43
- begin
44
- Fontist::Font.find(font_name)
45
- rescue Fontist::Errors::MissingFontError
46
- process_font_installation(font_name)
47
- end
48
- end
49
-
50
- def copy_to_fonts(fonts_path)
51
- fonts_path.each do |font_path|
52
- font_name = File.basename(font_path)
53
- FileUtils.copy_file(font_path, metanorma_fonts_path.join(font_name))
54
- end
55
- end
56
-
57
- def process_font_installation(font_name)
58
- accepted_agreement = term_agreement == true ? "yes" : "no"
59
-
60
- UI.say(missing_font_message) if !term_agreement
61
- Fontist::Font.install(font_name, confirmation: accepted_agreement)
62
- end
63
-
64
- def missing_font_message
65
- <<~MSG
66
- Your system does not have the necessary fonts installed for
67
- PDF generation. Without these fonts, the generated PDF will use
68
- generic fonts that may not resemble the desired styling.\n
69
- MSG
70
- end
71
- end
72
- end
73
- end
@@ -1,74 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: docker
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
- paths-ignore:
10
- - .github/workflows/test.yml
11
- - .github/workflows/macos.yml
12
- - .github/workflows/ubuntu.yml
13
- - .github/workflows/windows.yml
14
- - Makefile.win
15
- repository_dispatch:
16
- types: [ metanorma/metanorma-docker ]
17
-
18
- jobs:
19
- test-docker:
20
- runs-on: ubuntu-latest
21
- container: docker://metanorma/mn
22
- steps:
23
- - name: Checkout code
24
- uses: actions/checkout@v2
25
- with:
26
- token: ${{ secrets.METANORMA_CI_PAT_TOKEN || github.token }}
27
- submodules: true
28
- - name: Setup fonts
29
- run: |
30
- metanorma setup --agree-to-terms
31
- - uses: actions/setup-go@v2-beta
32
- with:
33
- go-version: '^1.13.1'
34
- - name: Install yq
35
- run: |
36
- GO111MODULE=on go get github.com/mikefarah/yq/v3
37
- ln -s $GOPATH/bin/yq /usr/local/bin/yq
38
- - name: Instal gems from local Gemfile
39
- run: |
40
- curl -L --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/gemfile-to-bundle-add.sh | bash
41
- - name: Build document in the Metanorma container
42
- env:
43
- LC_ALL: C.UTF-8
44
- LANG: C.UTF-8
45
- LANGUAGE: C.UTF-8
46
- run: |
47
- make clean all publish
48
- - uses: actions/upload-artifact@master
49
- with:
50
- name: published
51
- path: published
52
-
53
- deploy-gh-pages:
54
- if: github.ref == 'refs/heads/master'
55
- runs-on: ubuntu-latest
56
- needs: test-docker
57
- steps:
58
- - uses: actions/checkout@master
59
- - uses: actions/download-artifact@v1
60
- with:
61
- name: published
62
- - name: Deploy to GH Pages
63
- uses: peaceiris/actions-gh-pages@v3
64
- with:
65
- deploy_key: ${{ secrets.GH_DEPLOY_KEY }}
66
- publish_dir: ./published
67
- force_orphan: true
68
- user_name: ${{ github.actor }}
69
- user_email: ${{ format('{0}@users.noreply.github.com', github.actor) }}
70
- commit_message: "${{ format('Deploy to GitHub Pages: {0}', github.sha) }}"
71
- - uses: kolpav/purge-artifacts-action@v1
72
- with:
73
- token: ${{ secrets.GITHUB_TOKEN }}
74
- expire-in: 0
@@ -1,50 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: macos
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
- paths-ignore:
10
- - .github/workflows/test.yml
11
- - .github/workflows/docker.yml
12
- - .github/workflows/ubuntu.yml
13
- - .github/workflows/windows.yml
14
- - Makefile.win
15
-
16
- jobs:
17
- test-macos:
18
- name: Test on macOS
19
- runs-on: macos-latest
20
- steps:
21
- - name: Checkout code
22
- uses: actions/checkout@v2
23
- with:
24
- token: ${{ secrets.METANORMA_CI_PAT_TOKEN || github.token }}
25
- submodules: true
26
- - name: Cache xml2rfc
27
- id: cache-xml2rfc
28
- uses: actions/cache@v1
29
- with:
30
- path: ~/.cache/xml2rfc
31
- key: xml2rfc
32
- restore-key: xml2rfc
33
- - name: Use Metanorma
34
- run: |
35
- brew update
36
- brew install yq
37
- brew install https://raw.githubusercontent.com/metanorma/homebrew-metanorma/master/Formula/metanorma.rb
38
- metanorma version
39
- - name: Setup Fonts
40
- run: |
41
- metanorma setup --agree-to-terms
42
- - name: Install bundler
43
- run: |
44
- sudo gem install bundler
45
- - name: Metanorma compile
46
- env:
47
- JAVA_OPTS: "java.awt.headless=true"
48
- run: |
49
- source $(brew --prefix metanorma)/libexec/venv/bin/activate
50
- make clean all
@@ -1,55 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: ubuntu
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
- paths-ignore:
10
- - .github/workflows/test.yml
11
- - .github/workflows/macos.yml
12
- - .github/workflows/docker.yml
13
- - .github/workflows/windows.yml
14
- - Makefile.win
15
-
16
- jobs:
17
- test-linux:
18
- name: Test on Ubuntu
19
- runs-on: ubuntu-latest
20
- steps:
21
- - name: Checkout code
22
- uses: actions/checkout@v2
23
- with:
24
- token: ${{ secrets.METANORMA_CI_PAT_TOKEN || github.token }}
25
- submodules: true
26
- - name: Cache xml2rfc
27
- id: cache-xml2rfc
28
- uses: actions/cache@v1
29
- with:
30
- path: ~/.cache/xml2rfc
31
- key: xml2rfc
32
- restore-key: xml2rfc
33
- - name: Use Metanorma
34
- run: |
35
- sudo apt-get update
36
- curl -L https://raw.githubusercontent.com/metanorma/metanorma-linux-setup/master/ubuntu.sh | sudo bash
37
- sudo chown -R $USER:$(id -gn $USER) $HOME/.config
38
- - name: Setup Fonts
39
- run: |
40
- sudo gem install rake metanorma-cli
41
- sudo metanorma setup --agree-to-terms
42
- - name: Install yq
43
- run: |
44
- sudo snap install yq
45
- echo "::add-path::/snap/bin"
46
- - name: Install bundler
47
- run: |
48
- sudo gem install bundler
49
- - name: Metanorma compile
50
- env:
51
- JAVA_OPTS: "java.awt.headless=true"
52
- run: |
53
- source $HOME/.nvm/nvm.sh
54
- nvm use mn-node
55
- make clean all publish
@@ -1,42 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: windows
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
- paths-ignore:
10
- - .github/workflows/test.yml
11
- - .github/workflows/macos.yml
12
- - .github/workflows/ubuntu.yml
13
- - .github/workflows/docker.yml
14
- - Makefile
15
-
16
- jobs:
17
- test-windows:
18
- name: Test on Windows
19
- runs-on: windows-latest
20
- steps:
21
- - name: Checkout code
22
- uses: actions/checkout@v2
23
- with:
24
- token: ${{ secrets.METANORMA_CI_PAT_TOKEN || github.token }}
25
- submodules: true
26
- - name: Cache xml2rfc
27
- id: cache-xml2rfc
28
- uses: actions/cache@v1
29
- with:
30
- path: ~/.cache/xml2rfc
31
- key: xml2rfc
32
- restore-key: xml2rfc
33
- - name: Install Metanorma & yq
34
- shell: pwsh
35
- run: |
36
- cinst --no-progress -y metanorma yq
37
- - name: Install bundler
38
- run: |
39
- gem install bundler
40
- - name: Metanorma compile
41
- run: |
42
- make -f Makefile.win clean all SHELL=cmd
@@ -1,6 +0,0 @@
1
- .DS_Store
2
- .swp
3
- .tmp.xml
4
-
5
- # Deploy key
6
- deploy_key
@@ -1,45 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- image:
4
- name: metanorma/mn
5
- entrypoint: [""]
6
-
7
- cache:
8
- paths:
9
-
10
- stages:
11
- - build
12
- - deploy
13
-
14
-
15
- build:
16
- stage: build
17
- script:
18
- # We need to do this to install mscorefonts
19
- - curl -Ls -o yq https://github.com/mikefarah/yq/releases/download/3.3.0/yq_linux_amd64
20
- - chmod +x yq && mv yq /usr/bin
21
- - yq
22
- - apt-add-repository -y contrib && apt-get update
23
- - echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections
24
- - apt-get install -y ttf-mscorefonts-installer
25
- - curl -Ls https://raw.githubusercontent.com/metanorma/vista-fonts-installer/master/vista-fonts-installer.sh | bash
26
- - curl -L --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/gemfile-to-bundle-add.sh | bash
27
- - bundle install
28
- - make clean all
29
- - make published
30
- - mv published public
31
- artifacts:
32
- paths:
33
- - public
34
-
35
- pages:
36
- dependencies:
37
- - build
38
- stage: deploy
39
- script:
40
- - 'curl --location --output artifacts.zip --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/master/download?job=build"'
41
- artifacts:
42
- paths:
43
- - public
44
- only:
45
- - master