module Schizm::Env::Opts

Public Class Methods

build() click to toggle source
# File lib/schizm/env.rb, line 389
def self.build
  Env.var[:input] = "zrc"
  Env.var[:output_doc] = "./docs/_docs"
  Env.var[:output_src] = "./src"
  Env.var[:guard] = true
  return OptionParser.new do |optparse|
    optparse.banner = "Usage: schizm build [OPTIONS]"
    optparse.on "-v", "--verbose", "Verbose messages?" do
      Env.var[:verbose] = true
    end
    optparse.on "-r", "--rewrite", "Rewrite files without asking?" do
      Env.var[:rewrite] = true
    end
    optparse.on "-t", "--title STR", "Set project title." do |str|
      Env.var[:title] = str
    end
    optparse.on "-b", "--brief STR", "Set project brief." do |str|
      Env.var[:brief] = str
    end
    optparse.on "-a", "--author STR", "Specify project author(s)." do |str|
      Env.var[:author] = str
    end
    optparse.on "-y", "--year STR", "Specify project year(s)." do |str|
      Env.var[:year] = str
    end
    optparse.on "--input STR",
      "Where to look for input files." do |str|
      Env.var[:input] = str
    end
    optparse.on "--output-doc STR",
      "Where to write documentation files." do |str|
      Env.var[:output_doc] = str
    end
    optparse.on "--output-src STR",
      "Where to write source files." do |str|
      Env.var[:output_src] = str
    end
    optparse.on "--only-doc", "Build only documention files?" do
      Env.var[:only_doc] = true
    end
    optparse.on "--only-src", "Build only source files?" do
      Env.var[:only_src] = true
    end
    optparse.on "--[no-]guard", "Guard output headers?" do |ans|
      Env.var[:guard] = ans
    end
    optparse.on "--[no-]share", "Share chunks by default?" do |ans|
      Env.var[:share] = ans
    end
    optparse.on_tail "-h", "--help", "Display this help." do
      puts optparse
      exit 0
    end
  end
end
init() click to toggle source
# File lib/schizm/env.rb, line 167
    def self.init
      return OptionParser.new do |optparse|
        optparse.banner = "Usage: schizm init [OPTIONS]"
        optparse.on "-v", "--verbose", "Verbose messages?" do
          Env.var[:verbose] = true
        end
        optparse.on "-r", "--rewrite", "Rewrite files without asking?" do
          Env.var[:rewrite] = true
        end
        optparse.on "-t", "--title STR", "Set project title." do |str|
          Env.var[:title] = str
        end
        optparse.on "-b", "--brief STR", "Set project brief." do |str|
          Env.var[:brief] = str
        end
        optparse.on "-a", "--author STR", "Specify project author(s)." do |str|
          Env.var[:author] = str
        end
        optparse.on "-y", "--year STR", "Specify project year(s)." do |str|
          Env.var[:year] = str
        end
        license_enum = [
          "BSD-2-Clause",
          "BSD-3-Clause",
          "GPL-2.0",
          "GPL-3.0",
          "LGPL-2.1",
          "LGPL-3.0",
          "MIT",
          "MPL-2.0"
        ]
        license_help = <<LIC
Select license, none by default.

\tENUM                License
\t"BSD-2-Clause" .... the 2-clause BSD License
\t"BSD-3-Clause" .... the 3-clause BSD License
\t"GPL-2.0" ......... the GNU General Public License v2.0
\t"GPL-3.0" ......... the GNU General Public License v3.0
\t"LGPL-2.1" ........ the GNU Lesser General Public License v2.1
\t"LGPL-3.0" ........ the GNU Lesser General Public License v3.0
\t"MIT" ............. the MIT License
\t"MPL-2.0" ......... the Mozilla Public License v2.0

LIC
        optparse.on "-l", "--license ENUM",
            license_enum,
            license_help do |str|
          Env.var[:license] = str
        end
        color_help = <<COL

\tENUM                Basic color
\t"red" ............. F4 43 36
\t"pink" ............ E9 1E 63
\t"purple" .......... 9C 27 B0 *** Default primary
\t"deep-purple" ..... 67 3A B7
\t"indigo" .......... 3F 51 B5
\t"blue" ............ 21 96 F3
\t"light-blue" ...... 03 A9 F4
\t"cyan" ............ 00 BC D4
\t"teal" ............ 00 96 88 *** Default secondary
\t"green" ........... 4C AF 50
\t"light-green" ..... 8B C3 4A
\t"lime" ............ CD DC 39
\t"yellow" .......... FF EB 3B
\t"amber" ........... FF C1 07
\t"orange" .......... FF 98 00
\t"deep-orange" ..... FF 57 22

\tRefer to https://material.io/guidelines/style/color.html

COL
        optparse.on "-p", "--primary-color ENUM", COLORS.keys,
          "Specify primary color." do |str|
          Env.var[:primary_color] = str
        end
        optparse.on "-s", "--secondary-color ENUM", COLORS.keys,
          "Specify secondary color.", color_help do |str|
          Env.var[:secondary_color] = str
        end
        optparse.on_tail "-h", "--help", "Display this help." do
          puts optparse
          exit 0
        end
      end
    end
vim(which) click to toggle source
# File lib/schizm/env.rb, line 494
def self.vim which
  return OptionParser.new do |optparse|
    optparse.banner = "Usage: schizm vim-#{which} [OPTIONS]"
    optparse.on "-v", "--verbose", "Verbose messages?" do
      Env.var[:verbose] = true
    end
    optparse.on "-r", "--rewrite", "Rewrite files without asking?" do
      Env.var[:rewrite] = true
    end
    optparse.on "-p", "--path STR", "Specify Vim path." do |str|
      Env.var[:vimhome] = str
    end
    optparse.on_tail "-h", "--help", "Display this help." do
      puts optparse
      exit 0
    end
  end
end
vim_install() click to toggle source
# File lib/schizm/env.rb, line 513
def self.vim_install
  return vim "install"
end
vim_uninstall() click to toggle source
# File lib/schizm/env.rb, line 517
def self.vim_uninstall
  return vim "uninstall"
end