Skip to content

Commit

Permalink
New standard: app package is "app_$name"
Browse files Browse the repository at this point in the history
The convention "app_$name" is more readable than either "${name}app" or
"app${name}" in cases where the app name begins or ends with an
unfortunate letter.  This commit replaces quillapp with app_quill, and
updates Quill's application template accordingly.
  • Loading branch information
wduquette committed Oct 12, 2014
1 parent ae1ea09 commit 12cc82a
Show file tree
Hide file tree
Showing 37 changed files with 179 additions and 178 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/bin/*-linux
teapot.txt
/*.zip

*~

# SublimeText files
*.sublime-*
4 changes: 2 additions & 2 deletions bin/quill.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ package require Tcl 8.6
package require quillinfo

# quill(n) is the package containing the bulk of the quill code.
package require quillapp
namespace import quillapp::*
package require app_quill
namespace import app_quill::*

#-------------------------------------------------------------------------
# Invoke the application
Expand Down
8 changes: 4 additions & 4 deletions lib/quillapp/config.tcl → lib/app_quill/config.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
#-------------------------------------------------------------------------
# Namespace Export

namespace eval ::quillapp:: {
namespace eval ::app_quill:: {
namespace export \
config
}

#-------------------------------------------------------------------------
# config

snit::type ::quillapp::config {
snit::type ::app_quill::config {
# Make it a singleton
pragma -hasinstances no -hastypedestroy no

Expand Down Expand Up @@ -55,7 +55,7 @@ snit::type ::quillapp::config {
set ps [parmset ${type}::ps]

# Helper Commands
# TODO: Consider making ::quillapp::filename a snit::type workalike,
# TODO: Consider making ::app_quill::filename a snit::type workalike,
# with options for "-executable" and "-pattern", so that I can
# define executable-specific types. Actually, the types could
# also know how to find them....
Expand Down Expand Up @@ -87,7 +87,7 @@ snit::type ::quillapp::config {
# cleanup
#
# Destroys the parmset, so that [config init] can be called again.
# This command is used by the quillapp test suite.
# This command is used by the app_quill test suite.

typemethod cleanup {} {
catch {$ps destroy}
Expand Down
4 changes: 2 additions & 2 deletions lib/quillapp/element.tcl → lib/app_quill/element.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
#-------------------------------------------------------------------------
# Exported Commands

namespace eval ::quillapp:: {
namespace eval ::app_quill:: {
namespace export element
}

snit::type ::quillapp::element {
snit::type ::app_quill::element {
# pragma -hasinstances no -hastypedestroy no

#---------------------------------------------------------------------
Expand Down
14 changes: 7 additions & 7 deletions lib/quillapp/element_app.tcl → lib/app_quill/element_app.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,32 @@
#-------------------------------------------------------------------------
# Apploader Templates

::quillapp::element public app {appname} 1 1 \
::quillapp::appElement
::app_quill::element public app {appname} 1 1 \
::app_quill::appElement

# appElement appname
#
# appname - The application name
#
# Saves the app element files.

proc ::quillapp::appElement {appname} {
proc ::app_quill::appElement {appname} {
gentree bin/$appname.tcl [appLoader $appname] \
docs/man1/$appname.manpage [appManPage $appname]

os setexecutable [project root bin $appname.tcl]

element package ${appname}app true
element package app_$appname true
}

# appLoader appname
#
# $appname.tcl file for the $appname app..

maptemplate ::quillapp::appLoader {appname} {
maptemplate ::app_quill::appLoader {appname} {
set project [project name]
set description [project description]
set pkgname ${appname}app
set pkgname app_$appname
set tclversion [project require version Tcl]
} {
#!/bin/sh
Expand Down Expand Up @@ -120,7 +120,7 @@ maptemplate ::quillapp::appLoader {appname} {
#
# $appname.manpage file for the $appname app.

maptemplate ::quillapp::appManPage {appname} {
maptemplate ::app_quill::appManPage {appname} {
set project [project name]
} {
<manpage %appname(1) "%project %appname Application">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#-------------------------------------------------------------------------
# package Templates

::quillapp::element public package {package} 1 1 \
::quillapp::packageElement
::app_quill::element public package {package} 1 1 \
::app_quill::packageElement

# package package mainflag
#
Expand All @@ -26,7 +26,7 @@
#
# Saves the package element tree.

proc ::quillapp::packageElement {package {mainflag 0}} {
proc ::app_quill::packageElement {package {mainflag 0}} {
gentree \
lib/$package/pkgIndex.tcl [pkgIndex $package] \
lib/$package/pkgModules.tcl [pkgModules $package $mainflag] \
Expand All @@ -44,7 +44,7 @@ proc ::quillapp::packageElement {package {mainflag 0}} {
#
# pkgIndex.tcl file for the $package(n) package.

maptemplate ::quillapp::pkgIndex {package} {
maptemplate ::app_quill::pkgIndex {package} {
set project [project name]
set description [project description]
set version [project version]
Expand Down Expand Up @@ -72,7 +72,7 @@ maptemplate ::quillapp::pkgIndex {package} {
#
# pkgModules.tcl file for the $package(n) package.

maptemplate ::quillapp::pkgModules {package mainflag} {
maptemplate ::app_quill::pkgModules {package mainflag} {
set project [project name]
set description [project description]
set version [project version]
Expand Down Expand Up @@ -124,7 +124,7 @@ maptemplate ::quillapp::pkgModules {package mainflag} {
#
# $package.tcl file for the $package(n) package.

maptemplate ::quillapp::pkgFile {package} {
maptemplate ::app_quill::pkgFile {package} {
set project [project name]
set description [project description]
} {
Expand Down Expand Up @@ -165,7 +165,7 @@ maptemplate ::quillapp::pkgFile {package} {
#
# main.tcl file for the $package(n) package.

maptemplate ::quillapp::mainFile {package} {
maptemplate ::app_quill::mainFile {package} {
set project [project name]
set description [project description]
} {
Expand Down Expand Up @@ -207,7 +207,7 @@ maptemplate ::quillapp::mainFile {package} {
#
# all_tests.test file for the $package(n) package.

maptemplate ::quillapp::allTests {package} {
maptemplate ::app_quill::allTests {package} {
set project [project name]
set description [project description]
} {
Expand Down Expand Up @@ -241,7 +241,7 @@ maptemplate ::quillapp::allTests {package} {
#
# $package.test file for the $package(n) package.

maptemplate ::quillapp::testFile {package} {
maptemplate ::app_quill::testFile {package} {
set project [project name]
set description [project description]
} {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
#-------------------------------------------------------------------------
# Quillinfo Templates

::quillapp::element private quillinfo ::quillapp::quillinfoElement
::app_quill::element private quillinfo ::app_quill::quillinfoElement

# quillinfo
#
# Saves the quillinfo element tree.

proc ::quillapp::quillinfoElement {} {
proc ::app_quill::quillinfoElement {} {
gentree \
lib/quillinfo/pkgIndex.tcl [quillinfoPkgIndex] \
lib/quillinfo/pkgModules.tcl [quillinfoPkgModules] \
Expand All @@ -33,7 +33,7 @@ proc ::quillapp::quillinfoElement {} {
#
# pkgIndex.tcl file for the quillinfo(n) package.

maptemplate ::quillapp::quillinfoPkgIndex {} {
maptemplate ::app_quill::quillinfoPkgIndex {} {
set project [project name]
set description [project description]
} {
Expand All @@ -58,7 +58,7 @@ maptemplate ::quillapp::quillinfoPkgIndex {} {
#
# pkgModules.tcl file for the quillinfo(n) package.

maptemplate ::quillapp::quillinfoPkgModules {} {
maptemplate ::app_quill::quillinfoPkgModules {} {
set project [project name]
set description [project description]

Expand Down Expand Up @@ -93,7 +93,7 @@ maptemplate ::quillapp::quillinfoPkgModules {} {
#
# quillinfo.tcl file for the quillinfo(n) package.

maptemplate ::quillapp::quillinfoQuillinfo {} {
maptemplate ::app_quill::quillinfoQuillinfo {} {
set project [project name]
set description [project description]
set meta [list [project metadata]]
Expand Down
4 changes: 2 additions & 2 deletions lib/quillapp/env.tcl → lib/app_quill/env.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
#-------------------------------------------------------------------------
# Namespace exports

namespace eval ::quillapp:: {
namespace eval ::app_quill:: {
namespace export env
}

#-------------------------------------------------------------------------
# env singleton

snit::type ::quillapp::env {
snit::type ::app_quill::env {
pragma -hasinstances no -hastypedestroy no

#---------------------------------------------------------------------
Expand Down
18 changes: 9 additions & 9 deletions lib/quillapp/main.tcl → lib/app_quill/main.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#-------------------------------------------------------------------------
# Namespace Export

namespace eval ::quillapp:: {
namespace eval ::app_quill:: {
namespace export \
main

Expand All @@ -35,7 +35,7 @@ namespace eval ::quillapp:: {
#
# argv - Command line arguments

proc ::quillapp::main {argv} {
proc ::app_quill::main {argv} {
variable opts

# FIRST, are we in a project tree, and if so what's the project
Expand Down Expand Up @@ -68,17 +68,17 @@ proc ::quillapp::main {argv} {
} elseif {[tool exists $tool]} {
set projectInfoNeeded [tool needstree $tool]
} else {
if {![info exists ::quillapp::tools($tool)]} {
if {![info exists ::app_quill::tools($tool)]} {
throw FATAL [outdent "
Unknown subcommand: \"$tool\"
See 'quill help' for a list of commands.
"]
}
# NEXT, check the number of arguments.
checkargs "quill $tool" \
{*}[dict get $::quillapp::tools($tool) argspec] $argv
{*}[dict get $::app_quill::tools($tool) argspec] $argv

if {[dict get $quillapp::tools($tool) intree]} {
if {[dict get $app_quill::tools($tool) intree]} {
set projectInfoNeeded 1
}
}
Expand Down Expand Up @@ -106,7 +106,7 @@ proc ::quillapp::main {argv} {
} elseif {[tool exists $tool]} {
tool use $tool $argv
} else {
set cmd [dict get $quillapp::tools($tool) ensemble]
set cmd [dict get $app_quill::tools($tool) ensemble]
$cmd execute $argv
}

Expand All @@ -117,7 +117,7 @@ proc ::quillapp::main {argv} {
#
# Returns 1 if -verbose was given, and 0 otherwise.

proc ::quillapp::verbose {} {
proc ::app_quill::verbose {} {
variable opts

return $opts(-verbose)
Expand All @@ -129,7 +129,7 @@ proc ::quillapp::verbose {} {
#
# Outputs the text if the -verbose flag was provided.

proc ::quillapp::vputs {text} {
proc ::app_quill::vputs {text} {
if {[verbose]} {
puts $text
}
Expand All @@ -142,7 +142,7 @@ proc ::quillapp::vputs {text} {
#
# Attempts to execute the script in the context of the project.

proc ::quillapp::ExecuteScript {path argv} {
proc ::app_quill::ExecuteScript {path argv} {
# FIRST, prepare the environment.
set ::env(TCLLIBPATH) [project libpath]

Expand Down
12 changes: 6 additions & 6 deletions lib/quillapp/misc.tcl → lib/app_quill/misc.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#-------------------------------------------------------------------------
# Namespace Exports

namespace eval ::quillapp:: {
namespace eval ::app_quill:: {
namespace export \
checkargs \
gentree \
Expand All @@ -38,7 +38,7 @@ namespace eval ::quillapp:: {
#
# Verifies that the right number of arguments are provided to a tool.

proc ::quillapp::checkargs {command min max usage argv} {
proc ::app_quill::checkargs {command min max usage argv} {
set len [llength $argv]

if {$len >= $min && ($max eq "-" || $len <= $max)} {
Expand All @@ -60,7 +60,7 @@ proc ::quillapp::checkargs {command min max usage argv} {
#
# If either or both tags are not found, returns the empty string.

proc ::quillapp::tagsplit {tag text} {
proc ::app_quill::tagsplit {tag text} {
set lines [split $text \n]
set before [list]
set block [list]
Expand Down Expand Up @@ -110,7 +110,7 @@ proc ::quillapp::tagsplit {tag text} {
# Replaces the tagged block with the new block text, and returns
# the result.

proc ::quillapp::tagreplace {tag text newblock} {
proc ::app_quill::tagreplace {tag text newblock} {
set result [tagsplit $tag $text]

# No such tag. Return the text unchange.
Expand Down Expand Up @@ -142,7 +142,7 @@ proc ::quillapp::tagreplace {tag text newblock} {
# Prepares a variable's content for validation, and in some cases
# does the validation. In particular, values are "trimmed" automatically.

proc ::quillapp::prepare {var args} {
proc ::app_quill::prepare {var args} {
upvar 1 $var theVar

set theVar [string trim $theVar]
Expand Down Expand Up @@ -212,7 +212,7 @@ proc ::quillapp::prepare {var args} {
#
# The input is a set of path and content pairs.

proc ::quillapp::gentree {args} {
proc ::app_quill::gentree {args} {
# NEXT, process the files
foreach {path content} $args {
# FIRST get the paths
Expand Down
4 changes: 2 additions & 2 deletions lib/quillapp/pkgIndex.tcl → lib/app_quill/pkgIndex.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
# Tcl-quill: A Project Build System for Tcl/Tk
#
# DESCRIPTION:
# quillapp(n): pkgIndex file
# app_quill(n): pkgIndex file
#
#-------------------------------------------------------------------------

# -quill-ifneeded-begin DO NOT EDIT BY HAND
package ifneeded quillapp 0.2.2a0 [list source [file join $dir pkgModules.tcl]]
package ifneeded app_quill 0.2.2a0 [list source [file join $dir pkgModules.tcl]]
# -quill-ifneeded-end

Loading

0 comments on commit 12cc82a

Please sign in to comment.