Permalink
Browse files

feature: Speech output is only enabled on Mac

  • Loading branch information...
MikeMitterer committed Jun 9, 2015
1 parent 13cf440 commit 8a926b4ab0ea3340da11d9e1210e9d531824e4cc
Showing with 120 additions and 23 deletions.
  1. +2 −1 .gitignore
  2. +1 −0 README.md
  3. +1 −0 SiteGen.iml
  4. +3 −0 lib/sitegen.dart
  5. +10 −5 lib/src/Application.dart
  6. +14 −1 lib/src/Config.dart
  7. +3 −0 lib/src/Options.dart
  8. +84 −16 pubspec.lock
  9. +2 −0 pubspec.yaml
View
@@ -10,4 +10,5 @@ packages
*.dart.js
*.js_
*.js.deps
*.js.map
*.js.map
.pub
View
@@ -130,6 +130,7 @@ Supported vars:
- usesass: true
- autoprefixer: true
- browser: Chromium
- talktome: true (on OSX, false on all the other OSs)
## Markdown
**SiteGen** lets you use [markdown][markdown] to write your site content. At the beginning of each markdown file, you
View
@@ -3,6 +3,7 @@
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/bin/packages" />
<excludeFolder url="file://$MODULE_DIR$/example/packages" />
<excludeFolder url="file://$MODULE_DIR$/example/simple/.sitegen/html/_content/about/packages" />
View
@@ -20,6 +20,7 @@ import "package:mustache/mustache.dart" as mustache;
import "package:yaml/yaml.dart" as yaml;
import 'package:http_server/http_server.dart';
import 'package:system_info/system_info.dart';
part "src/Application.dart";
part "src/Options.dart";
@@ -28,6 +29,8 @@ part "src/Init.dart";
part "src/Generator.dart";
bool _runsOnOSX() => (SysInfo.operatingSystemName == "Mac OS X");
void main(List<String> arguments) {
final Application application = new Application();
application.run( arguments );
View
@@ -267,7 +267,7 @@ class Application {
final ProcessResult result = await Process.run("pwd", []);
if (result.exitCode != 0) {
_logger.info("sassc faild with: ${(result.stderr as String).trim()}!");
_vickiSay("got a sassc error");
_vickiSay("got a sassc error",config);
return;
}
_logger.fine(result.stdout.trim());
@@ -312,7 +312,7 @@ class Application {
final ProcessResult resultOsascript = await Process.run(executable, [ script.path ]);
if (resultOsascript.exitCode != 0) {
_logger.severe("$executable faild with: ${(resultOsascript.stderr as String).trim()}!");
_vickiSay("$executable failed");
_vickiSay("$executable failed",config);
return;
}
@@ -341,7 +341,7 @@ class Application {
final ProcessResult result = Process.runSync(compiler, [ source, target ]);
if (result.exitCode != 0) {
_logger.info("sassc faild with: ${(result.stderr as String).trim()}!");
_vickiSay("got a sassc error");
_vickiSay("got a sassc error",config);
return;
}
_logger.info("Done!");
@@ -361,7 +361,7 @@ class Application {
final ProcessResult result = Process.runSync(prefixer, [ cssFile ]);
if (result.exitCode != 0) {
_logger.info("prefixer faild with: ${(result.stderr as String).trim()}!");
_vickiSay("got a prefixer error");
_vickiSay("got a prefixer error",config);
return;
}
_logger.info("Done!");
@@ -374,9 +374,14 @@ class Application {
}).toList();
}
void _vickiSay(final String sentence) {
void _vickiSay(final String sentence,final Config config) {
Validate.notBlank(sentence);
if(config.talktome == false) {
_logger.severe("Vicki wants to say: '${sentence}'");
return;
}
final ProcessResult result = Process.runSync("say", [ '-v', "Vicki", '-r', '200', sentence.replaceFirst("wsk_", "") ]);
if (result.exitCode != 0) {
_logger.severe("run faild with: ${(result.stderr as String).trim()}!");
View
@@ -24,6 +24,7 @@ class Config {
static const _CONF_SASS_COMPILER = 'sasscompiler';
static const _CONF_USE_SASS = 'usesass';
static const _CONF_USE_AUTOPREFIXER = 'autoprefixer';
static const _CONF_TALK_TO_ME = 'talktome';
static const _CONF_BROWSER = 'browser';
final ArgResults _argResults;
@@ -46,7 +47,7 @@ class Config {
_settings[Config._CONF_USE_MARKDOWN] = true;
_settings[Config._CONF_DEFAULT_TEMPLATE] = "default.html";
_settings[Config._CONF_SASS_COMPILER] = "sassc";
_settings[Config._CONF_BROWSER] = "Chromium";
_settings[Config._CONF_BROWSER] = "Chromium-${SysInfo.operatingSystemName}-";
_settings[Config._CONF_SITE_OPTIONS] = {};
@@ -56,6 +57,7 @@ class Config {
_settings[Config._CONF_USE_SASS] = true;
_settings[Config._CONF_USE_AUTOPREFIXER] = true;
_settings[Config._CONF_TALK_TO_ME] = _runsOnOSX();
@@ -105,6 +107,8 @@ class Config {
bool get useautoprefixer => _settings[Config._CONF_USE_AUTOPREFIXER];
bool get talktome => _settings[Config._CONF_TALK_TO_ME];
String get browser => _settings[Config._CONF_BROWSER];
Map<String,String> get settings {
@@ -128,6 +132,7 @@ class Config {
settings["Use markdown"] = usemarkdown ? "yes" : "no";
settings["Use SASS"] = usesass ? "yes" : "no";
settings["Use Autoprefixer"] = useautoprefixer ? "yes" : "no";
settings["Talk to me"] = talktome ? "yes" : "no";
settings["Site options"] = siteoptions.toString();
@@ -201,6 +206,14 @@ class Config {
_settings[Config._CONF_USE_AUTOPREFIXER] = _argResults[Options._ARG_USE_AUTOPREFIXER];
}
if(_argResults.wasParsed(Options._ARG_USE_AUTOPREFIXER)) {
_settings[Config._CONF_USE_AUTOPREFIXER] = _argResults[Options._ARG_USE_AUTOPREFIXER];
}
if(_argResults.wasParsed(Options._ARG_TALK_TO_ME)) {
_settings[Config._CONF_TALK_TO_ME] = _argResults[Options._ARG_TALK_TO_ME];
}
}
void _overwriteSettingsWithConfigFile() {
View
@@ -18,6 +18,7 @@ class Options {
static const _ARG_USE_SASS = 'usesass';
static const _ARG_USE_AUTOPREFIXER = 'useapfx';
static const _ARG_TALK_TO_ME = 'talktome';
final ArgParser _parser;
@@ -69,6 +70,8 @@ class Options {
..addFlag(_ARG_USE_AUTOPREFIXER, negatable: true, help: "Enables / disables Autoprefixer", defaultsTo: true)
..addFlag(_ARG_TALK_TO_ME, negatable: true, help: "Enables / disables Speek-Output", defaultsTo: _runsOnOSX())
..addOption(_ARG_PORT, help: "Sets the port to listen on", defaultsTo: "8000")
..addOption(_ARG_DOCROOT, help: "Document root", defaultsTo: "web")
View
@@ -4,35 +4,63 @@ packages:
analyzer:
description: analyzer
source: hosted
version: "0.9.1"
version: "0.25.0+1"
args:
description: args
source: hosted
version: "0.13.0"
version: "0.13.2"
barback:
description: barback
source: hosted
version: "0.15.2+4"
browser:
description: browser
source: hosted
version: "0.10.0+2"
collection:
description: collection
source: hosted
version: "1.1.0"
version: "1.1.1"
console_log_handler:
description: console_log_handler
source: hosted
version: "0.1.4"
crypto:
description: crypto
source: hosted
version: "0.9.0"
file_utils:
description: file_utils
source: hosted
version: "0.0.23"
glob:
description: glob
source: hosted
version: "1.0.4"
globbing:
description: globbing
source: hosted
version: "0.1.20"
http_multi_server:
description: http_multi_server
source: hosted
version: "1.3.2"
http_parser:
description: http_parser
source: hosted
version: "0.0.2+6"
http_server:
description: http_server
source: hosted
version: "0.9.5+1"
intl:
description: intl
source: hosted
version: "0.8.10+4"
version: "0.12.4"
logging:
description: logging
source: hosted
version: "0.9.3"
version: "0.11.1"
logging_handlers:
description: logging_handlers
source: hosted
@@ -44,43 +72,83 @@ packages:
matcher:
description: matcher
source: hosted
version: "0.11.4+4"
meta:
description: meta
source: hosted
version: "0.8.8"
version: "0.12.0+1"
mime:
description: mime
source: hosted
version: "0.9.3"
mustache:
description: mustache
source: hosted
version: "0.2.1"
version: "0.2.3"
path:
description: path
source: hosted
version: "1.3.4"
version: "1.3.5"
petitparser:
description: petitparser
source: hosted
version: "1.4.3"
pool:
description: pool
source: hosted
version: "1.0.2"
pub_semver:
description: pub_semver
source: hosted
version: "1.2.1"
shelf:
description: shelf
source: hosted
version: "0.6.1+2"
shelf_static:
description: shelf_static
source: hosted
version: "0.2.2"
shelf_web_socket:
description: shelf_web_socket
source: hosted
version: "0.0.1+2"
source_map_stack_trace:
description: source_map_stack_trace
source: hosted
version: "1.0.4"
source_maps:
description: source_maps
source: hosted
version: "0.10.1"
source_span:
description: source_span
source: hosted
version: "1.1.1"
version: "1.1.2"
stack_trace:
description: stack_trace
source: hosted
version: "1.2.4"
version: "1.3.2"
string_scanner:
description: string_scanner
source: hosted
version: "0.1.3"
version: "0.1.3+1"
system_info:
description: system_info
source: hosted
version: "0.0.14"
test:
description: test
source: hosted
version: "0.12.3"
unittest:
description: unittest
source: hosted
version: "0.11.5+4"
version: "0.12.3"
validate:
description: validate
source: hosted
version: "1.4.2"
watcher:
description: watcher
source: hosted
version: "0.9.5"
yaml:
description: yaml
source: hosted
View
@@ -32,5 +32,7 @@ dependencies:
intl: any
http_server: any
system_info: "^0.0.14"
dev_dependencies:
unittest: any

0 comments on commit 8a926b4

Please sign in to comment.