Announcements

Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more

New update to Scriptlike: v0.9.4.

Scriptlike is a library to help you write script-like programs in D.

The two highlights in this release are string interpolation and a full set of examples in the documentation. Also of note are the new functions removePath and tryRemovePath which can be used to delete files (like remove) or directories (like rmdirRecurse).

For the full list of all changes in this release, see the changelog.

String Interpolation

See: https://github.com/Abscissa/scriptlike#string-interpolation

AFAICT, a string mixin is necessary to accomplish this in D, but otherwise it works much like other languages:

// Output: The number 21 doubled is 42! int num = 21; writeln( mixin(interp!"The number ${num} doubled is ${num * 2}!") );

The interpolated sections are handled via std.conv.text(), so they accept any type.

Bikeshedding requested! I'm not 100% sold on the name interp for this long-term. Suggestions welcome.

Examples

The homepage/readme now provides sample code demonstrating all of Scriptlike's various features.

There is also a demonstration of suggested practices for how to use Scriptlike in a D-based script.

And finally, all examples are included as actual runnable programs (all automatically tested by dub test, to ensure continued freshness).

Read more


Various Software Updates and New Tools

I've been fairly busy over the last couple months or so updating several projects. Enough has accumulated that instead of making individual posts for each update to each tool and library, I'm combining them all into this one post.

Most of this has been part of a behind-the-scenes push to get the next incarnation of DAuth ready for release. It will still be the same library, but will be rebranded as "InstaUser" (partly to avoid confusion with OAuth, which DAuth isn't directly related to) and will have an expanded scope.

The current DAuth will become "InstaUser Basic", the core of the InstaUser project. But InstaUser will also offer brand-new purely optional components: "InstaUser Store" to instantly get up-and-running with database-backed user account storage, and "InstaUser Web" which builds on InstaUser Store to provide ready-to-use web-based login and registrations. Eventually, there may even be an "InstaUser OAuth", but that's only in the "wishlist" stage right now and definitely won't be in the first release of InstaUser.

Anyway, that's all still in-progress, but working on it has revealed various direct and indirect needs in other projects. Here's what's new since my last "Announcements" post:


DAuth v0.6.2

[Project Homepage]
[Full Changelog]

This will likely be the last DAuth release before being rebranded InstaUser.

DAuth is an open-source salted password hash authentication library for D. It provides a simple, yet flexible API. With it, your software can easily incorporate user accounts with reliable, upgradeable security.

Changes since v0.6.1:

v0.6.2 - 2015/03/25

  • Fixed: #1/#2: Compilation failure when using DUB and DMD 2.067 (@NCrashed)


gen-package-version v1.0.2

[Project Homepage]
[Full Changelog]

Automatically generate a D module with version and timestamp information (detected from git or Mercurial/hg) every time your program or library is built. You can also generate a DDOC macro file (using the --ddoc=dir switch.)

Even better, all your in-between builds will automatically have their own VCS-generated version number, including the VCS commit hash (for example: v1.2.0-1-g78f5cf9). So there's never any confusion as to which "version" of v1.2.0 you're running!

Just add this to your project's dub.json:

"dependencies": { "gen-package-version": "~>1.0.2" }, "preGenerateCommands": ["dub run gen-package-version -- your.package.name --root=$PACKAGE_DIR --src=path/to/src"]

Replace your.package.name and path/to/src with the appropriate values for your project (but keep $PACKAGE_DIR exactly as written above), and you're ready to go:

module your.package.name.main; import std.stdio; import your.package.name.packageVersion; void main() { writeln("My Cool Program ", packageVersion); writeln("Built on ", packageTimestamp); }

Changes since v0.9.0:

v0.9.1 - 2015/06/14

  • Fixed: helper/gen_version.sh isn't set as executable when checked out through dub.

v0.9.2 - 2015/06/14

  • Fixed: The old recommended "preGenerateCommands" led to problems (project dependencies that use gen-package-version would run it from the wrong directory).

v0.9.3 - 2015/06/15

  • Enhancement: If detecting the version number via git fails, attempt to detect it via the current directory name (ex, ~/.dub/packages/[project-name]-[version-tag]).
  • Enhancement: Don't bother running git if there's no .git directory.
  • Enhancement: Bootstraps itself, so gen-package-version itself enjoys the following fix:
  • Fixed: Fails to detect version number for packages fetched by dub (since they lack .git).

v0.9.4 - 2015/06/16

  • Enhancement: Support detecting the version number via Mercurial (hg).
  • Enhancement: Support .hgignore for Mercurial working directories.

v1.0.0 - 2015/06/27

  • Change: The generated packageTimestamp is changed from ISOExt format to human readable. The ISOExt formatted version is now called packageTimestampISO.
  • Change: Value for --module is no longer allowed to contain periods.
  • Enhancement: Basic ability to be used as a library. See the README for details.
  • Enhancement: Add -r|--root to support projects in any directory, not just the current directory.
  • Enhancement: Minor improvements to --verbose and --trace outputs.
  • Fixed: Don't update the version file (and thus trigger a project rebuild) if the version file doesn't need updated. Bypass this check with the new --force flag.
  • Fixed: Don't rebuild gen-package-version if not needed.
  • Fixed: Failure on Windows when target project is on a different drive letter from current working directory.

v1.0.1 - 2015/06/28

  • Fixed: Don't use a broken scriptlike release (v0.9.0), use v0.9.1 instead.

v1.0.2 - 2015/07/01

  • Enhancement: Now works on DMD 2.066.1 (previously required 2.067.0 or up).


New tool: safeArg v0.9.7

[Project Homepage]
[Full Changelog]

Think of this like xargs -0, but simplified and ready-to-use in any dub-based project, even on Windows.

See the homepage for more info and examples, but essentially, the purpose is this:

Using eval or command substitution to pass arguments to a program is error-prone, non-portable and a potential security risk. This command-line tool utilizes the commonly-recommended approach of null-delimited stream to provide safety and reliability when passing arbitrary data to a program as command-line arguments.


Scriptlike v0.9.2

[Project Homepage]
[Full Changelog]

Utility library to aid in writing script-like programs in D.

Changes since v0.8.0:

v0.9.0 - 2015/06/27

  • Change: Split scriptlike.file and scriptlike.path into the following:
    • scriptlike.core
    • scriptlike.file.extras
    • scriptlike.file.wrappers
    • scriptlike.path.extras
    • scriptlike.path.wrappers
    Utilizes package.d to retain ability to import scriptlike.file and scriptlike.path.
  • Change: Convert changelog from markdown to ddox so links are more readable.
  • Enhancement: Add (opt-in) command echoing to most functions in scriptlike.file.
  • Enhancement: Add yap and yapFunc as improved versions of to-be-deprecated echoCommand.
  • Fixed: Make escapeShellArg const-correct.
  • Fixed: Make Path.toRawString and Ext.toRawString both be pure @safe nothrow.

v0.9.1 - 2015/06/28

  • Fixed: Fails to compile unless the makedocs script has been run.

v0.9.2 - 2015/07/10

  • Fixed: Properly flush all command echoing output (ie, in yap and yapFunc).
  • Enhancement: Add a "no-build" configuration for projects that need to import/depend on Scriptlike through DUB, but use their own buildsystem.


SDLang-D v0.9.2

[Project Homepage]
[Full Changelog]

A library to parse/generate SDL (Simple Data Language) files. Offers both DOM and StAX/Pull APIs.

SDL is like XML/JSON/YAML, but is low-verbosity, simpler than YAML, and supports comments and basic datatypes. It looks like this:

// An example of SDL: folder "myFiles" color="yellow" protection=on { folder "my images" { file "myHouse.jpg" color=true date=2005/11/05 file "myCar.jpg" color=false date=2002/01/05 } // Another folder folder "my documents" { document "resume.pdf" } }

Changes since v0.9.0:

v0.9.1 - 2015/03/17

  • Fixed: #16: Access Violation when using the pull parser.

v0.9.2 - 2015-07-31

  • New: Uses travis-ci.org for continuous integration testing.
  • Change: Updated package.json to newer dub.json name.
  • Fixed: #16: Now fixed for DUB users, too: Access Violation when using the pull parser.
  • Fixed: #21: Remove unneeded "buildOptions" from DUB package config (fixes a DUB warning) (@schuetzm)
  • Fixed: #28/#29: Wrong line count for Windows style line breaks. (@s-ludwig)
  • Fixed: Fixed running unittests via DUB. (Part of #29) (@s-ludwig)
  • Fixed: Trailing line comments incorrectly treated as line continuation instead of newline (Related: #20, plus libsdl-d's e565f30 and c6dc722) (@Dicebot)
  • Improved: #22/#23: Internal improvements (@schuetzm)

Read more


gen-package-version v0.9.0: New tool: Auto-generate version/timestamp info

Automatically generate a D module with version and timestamp information (detected from git) every time your program or library is built.

Even better, all your in-between builds will automatically have their own git-generated version number, including the git commit hash (for example: v1.2.0-1-g78f5cf9). So there's never any confusion as to which "version" of v1.2.0 you're running!

The gen-package-version Homepage

Full usage and instructions are at the link above, but here's a brief primer for those using it with dub:

To use:

Add this to your project's dub.json file:

"dependencies": { "gen-package-version": "~>0.9.0" }, "preGenerateCommands": ["dub run gen-package-version -- package.name --src=path/to/src"]

Now, when you build your project with dub, it'll automatically download, install and run gen-package-version, which will generate the file path/to/src/package/name/packageVersion.d

Then just import that and use it:

module package.name.main; import std.stdio; import package.name.packageVersion; void main() { writeln("My Cool Program ", packageVersion); writeln("Built on ", packageTimestamp); }

Read more


Scriptlike v0.8.0

A bunch of new updates to Scriptlike: A library to aid in writing script-like programs in D.

Scriptlike links: [Home] [Dub] [Full changelog]

Highlights (more info at full changelog):

  • Change: Minimum officially supported DMD increased from v2.064.2 to v2.066.0.
  • Change: API reference now built using ddox and uses much improved styling (actually uses a stylesheet now).
  • Change: Misc changes to reduce symbol conflict issues with std.file/std.path.
  • Change: Eliminate remnants of the "planned but never enabled" wstring/dstring versions of Path/Ext/Args. There turned out not to be much need for them.
  • Enhancement: Add module scriptlike.only to import all of scriptlike, but omit the helper Phobos imports in scriptlike.std.
  • Enhancement: fail now accepts an arbitrary list of args
  • Enhancement: Added failEnforce.
  • Enhancement: Added runCollect and tryRunCollect, to capture a command's output instead of displaying it.
  • Enhancement: Added pause to pause and prompt the user to press Enter.
  • Enhancement: Added Path-based wrappers for std.file's getcwd, thisExePath and tempDir.
  • Fixed: No longer uses the deprecated std.process.system().

Read more


Tagged Scriptlike release: v0.7.0

Scriptlike is a utility library to aid in writing script-like programs in D (available through DUB):

Two things in this release:

  • Easy input-prompting module "scriptlike.interact", by Jesse Phillips. This has actually been in master for quite some time, but now it's part of a tagged release.
  • Fixed: The unittests failed to compile on DMD 2.067.0

Early heads-up warning: While scriptlike currently supports DMDs as early as 2.064.2, I will likely be increasing the minimum supported DMD up to 2.066.0 between now and the next release, due to increasing reliance on the newer parts of std.process (which prior to 2.066.0 had "paths with spaces" problems on Windows, which I was previously able to work around using the outdated system() function).

Read more


SDLang-D v0.9.0

SDLang-D update (v0.9.0) has now been tagged/released:

It's a D lib to parse and generate the SDL data language (similar to XML/JSON, but more human-friendly, while still being very simple). Additional examples are available at the links above, but the language looks like this:

// Sample, but useful, SDL: latest-version "v0.9.0" release-date 2015/03/16 how-cool "So cool!" links { original-sdl "http://sdl.ikayzo.org/display/SDL/Language+Guide" sdlang-d:home "https://github.com/Abscissa/SDLang-D" // Full changelog sdlang-d:changelog "https://github.com/Abscissa/SDLang-D/blob/master/CHANGELOG.md" // How-to-Use and API Reference sdlang-d:how-to-use "https://github.com/Abscissa/SDLang-D/blob/master/HOWTO.md" sdlang-d:api-reference "http://semitwist.com/sdlang-d-api/sdlang.html" }

Most of the big changes have been sitting in master for awhile, so this is long overdue.

Aside from various bugfixes, the big changes in this release are the addition of a StAX/Pull-style parser (see the changelog), and utilization of D's package.d feature.

  • Breaking change: Changed package structure to use package.d. Most users will be unaffected, but the internal package names have changed slightly, and users of DMD 2.063.2 and below will need to import sdlang.package; instead of import sdlang; until they upgrade their compiler. The built-in command line tool and unittests, however, do now require DMD 2.064 or newer because of this change.
  • New: Added StAX/Pull-style parser via pullParseFile and pullParseSource. (Warning: FileStartEvent and FileEndEvent might be removed later: #17)
  • Fixed: Work around a DMD 2.064/2.065 segfault bug in a unittest.
  • Fixed: #5 & #7: Building with Dub produces package format warnings (@ColdenCullen).
  • Fixed: #8: Consecutive escape sequences not getting correctly decoded.
  • Fixed: #11: Newline immediately after // is ignored.
  • Fixed: #12: Incorrectly accepts "anon tag without a value" when the tag has children.
  • Fixed: The build-docs script was broken for newer RDMDs.
  • Improved: Better error message for anonymous tags with no values.

As always, it's available in the DUB package repository.

The codename for this release is "version zero point nine point zero". Alternate codename is "4a44e9e88e573444cd6e7a43fb0e574ff5e03ac2".

Update 2015/03/27: Just tagged v0.9.1, a small but important update that fixes this issue:

  • Fixed: #16: Access Violation when using the pull parser

Read more