Tilemap collision working but needs speeding up

This commit is contained in:
Richard Davey
2013-04-25 20:05:56 +01:00
parent b8ab13fec8
commit b2e1434f5e
1336 changed files with 277759 additions and 6786 deletions
+1
View File
@@ -0,0 +1 @@
grunt-open
+13
View File
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
</value>
</option>
</component>
</project>
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
</project>
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
+25
View File
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectResources">
<default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
</component>
<component name="ProjectRootManager" version="2" />
<component name="SvnConfiguration" maxAnnotateRevisions="500" myUseAcceleration="nothing" myAutoUpdateAfterCommit="false" cleanupOnStartRun="false">
<option name="USER" value="" />
<option name="PASSWORD" value="" />
<option name="mySSHConnectionTimeout" value="30000" />
<option name="mySSHReadTimeout" value="30000" />
<option name="LAST_MERGED_REVISION" />
<option name="MERGE_DRY_RUN" value="false" />
<option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
<option name="UPDATE_LOCK_ON_DEMAND" value="false" />
<option name="IGNORE_SPACES_IN_MERGE" value="false" />
<option name="DETECT_NESTED_COPIES" value="true" />
<option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
<option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
<option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
<option name="FORCE_UPDATE" value="false" />
<myIsUseDefaultProxy>false</myIsUseDefaultProxy>
</component>
</project>
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/grunt-open.iml" filepath="$PROJECT_DIR$/.idea/grunt-open.iml" />
</modules>
</component>
</project>
+5
View File
@@ -0,0 +1,5 @@
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
</component>
</project>
+384
View File
@@ -0,0 +1,384 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="e685cd30-a33d-4a27-9021-0bcff700f6d9" name="Default" comment="" />
<ignored path="grunt-open.iws" />
<ignored path=".idea/workspace.xml" />
<file path="/Gruntfile.js" changelist="e685cd30-a33d-4a27-9021-0bcff700f6d9" time="1359773587699" ignored="false" />
<file path="/open.js" changelist="e685cd30-a33d-4a27-9021-0bcff700f6d9" time="1359773577287" ignored="false" />
<file path="/README.md" changelist="e685cd30-a33d-4a27-9021-0bcff700f6d9" time="1361211023620" ignored="false" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="DaemonCodeAnalyzer">
<disable_hints />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FavoritesManager">
<favorites_list name="grunt-open" />
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="Gruntfile.js" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/Gruntfile.js">
<provider selected="true" editor-type-id="text-editor">
<state line="14" column="12" selection-start="279" selection-end="279" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name=".jshintrc" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/.jshintrc">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="README.md" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="text-editor">
<state line="61" column="28" selection-start="1363" selection-end="1363" vertical-scroll-proportion="0.66562176">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="package.json" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/package.json">
<provider selected="true" editor-type-id="text-editor">
<state line="16" column="4" selection-start="460" selection-end="460" vertical-scroll-proportion="-12.307693">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="open.js" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/tasks/open.js">
<provider selected="true" editor-type-id="text-editor">
<state line="14" column="28" selection-start="334" selection-end="334" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FindManager">
<FindUsagesManager>
<setting name="OPEN_NEW_TAB" value="false" />
</FindUsagesManager>
</component>
<component name="IdeDocumentHistory">
<option name="changedFiles">
<list>
<option value="$PROJECT_DIR$/test/open_test.js" />
<option value="$PROJECT_DIR$/LICENSE" />
<option value="$PROJECT_DIR$/Gruntfile.js" />
<option value="$PROJECT_DIR$/tasks/open.js" />
<option value="$PROJECT_DIR$/package.json" />
<option value="$PROJECT_DIR$/README.md" />
</list>
</option>
</component>
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
<component name="ProjectFrameBounds">
<option name="x" value="1680" />
<option name="width" value="1920" />
<option name="height" value="1080" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectReloadState">
<option name="STATE" value="0" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents ProjectPane="true" />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
</navigator>
<panes>
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="grunt-open" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="grunt-open" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="grunt-open" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="grunt-open" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="grunt-open" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="tasks" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="options.splitter.main.proportions" value="0.3" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="options.lastSelected" value="preferences.sourceCode.PHP" />
<property name="options.searchVisible" value="true" />
<property name="options.splitter.details.proportions" value="0.2" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$" />
</key>
</component>
<component name="RunManager">
<list size="0" />
</component>
<component name="ShelveChangesManager" show_recycled="false" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="e685cd30-a33d-4a27-9021-0bcff700f6d9" name="Default" comment="" />
<created>1349287020528</created>
<updated>1349287020528</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="1680" y="0" width="1920" height="1080" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.12916666" sideWeight="0.96017224" order="0" side_tool="false" content_ui="combo" />
<window_info id="Jenkins" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="VcsManagerConfiguration">
<option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
<option name="CHECK_NEW_TODO" value="true" />
<option name="myTodoPanelSettings">
<value>
<are-packages-shown value="false" />
<are-modules-shown value="false" />
<flatten-packages value="false" />
<is-autoscroll-to-source value="false" />
</value>
</option>
<option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" />
<option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" />
<option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
<option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true" />
<option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
<option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false" />
<option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="false" />
<option name="CHANGED_ON_SERVER_INTERVAL" value="60" />
<option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" />
<option name="CHECK_COMMIT_MESSAGE_SPELLING" value="true" />
<option name="DEFAULT_PATCH_EXTENSION" value="patch" />
<option name="SHORT_DIFF_HORISONTALLY" value="true" />
<option name="SHORT_DIFF_EXTRA_LINES" value="2" />
<option name="SOFT_WRAPS_IN_SHORT_DIFF" value="true" />
<option name="INCLUDE_TEXT_INTO_PATCH" value="false" />
<option name="INCLUDE_TEXT_INTO_SHELF" value="false" />
<option name="SHOW_FILE_HISTORY_DETAILS" value="true" />
<option name="SHOW_VCS_ERROR_NOTIFICATIONS" value="true" />
<option name="SHOW_DIRTY_RECURSIVELY" value="false" />
<option name="LIMIT_HISTORY" value="true" />
<option name="MAXIMUM_HISTORY_ROWS" value="1000" />
<option name="UPDATE_FILTER_SCOPE_NAME" />
<option name="USE_COMMIT_MESSAGE_MARGIN" value="false" />
<option name="COMMIT_MESSAGE_MARGIN_SIZE" value="72" />
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" />
<option name="LAST_COMMIT_MESSAGE" />
<option name="MAKE_NEW_CHANGELIST_ACTIVE" value="false" />
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
<option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
<option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
<option name="ACTIVE_VCS_NAME" />
<option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
<option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
<option name="UPDATE_FILTER_BY_SCOPE" value="false" />
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/.jshintrc">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="text-editor">
<state line="8" column="5" selection-start="109" selection-end="109" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/LICENSE">
<provider selected="true" editor-type-id="text-editor">
<state line="13" column="0" selection-start="593" selection-end="593" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tasks/open.js">
<provider selected="true" editor-type-id="text-editor">
<state line="12" column="34" selection-start="217" selection-end="217" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/package.json">
<provider selected="true" editor-type-id="text-editor">
<state line="6" column="29" selection-start="206" selection-end="206" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Gruntfile.js">
<provider selected="true" editor-type-id="text-editor">
<state line="6" column="11" selection-start="111" selection-end="111" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="text-editor">
<state line="8" column="5" selection-start="109" selection-end="109" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/LICENSE">
<provider selected="true" editor-type-id="text-editor">
<state line="13" column="0" selection-start="593" selection-end="593" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tasks/open.js">
<provider selected="true" editor-type-id="text-editor">
<state line="9" column="0" selection-start="153" selection-end="153" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/package.json">
<provider selected="true" editor-type-id="text-editor">
<state line="4" column="43" selection-start="149" selection-end="149" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/.jshintrc">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Gruntfile.js">
<provider selected="true" editor-type-id="text-editor">
<state line="14" column="12" selection-start="279" selection-end="279" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/LICENSE">
<provider selected="true" editor-type-id="text-editor">
<state line="13" column="0" selection-start="593" selection-end="593" vertical-scroll-proportion="0.27168235">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tasks/open.js">
<provider selected="true" editor-type-id="text-editor">
<state line="14" column="28" selection-start="334" selection-end="334" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/package.json">
<provider selected="true" editor-type-id="text-editor">
<state line="16" column="4" selection-start="460" selection-end="460" vertical-scroll-proportion="-12.307693">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="text-editor">
<state line="61" column="28" selection-start="1363" selection-end="1363" vertical-scroll-proportion="0.66562176">
<folding />
</state>
</provider>
</entry>
</component>
</project>
+14
View File
@@ -0,0 +1,14 @@
{
"curly": false,
"eqeqeq": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"boss": true,
"eqnull": true,
"node": true,
"es5": true
}
+1
View File
@@ -0,0 +1 @@
/node_modules/
+34
View File
@@ -0,0 +1,34 @@
'use strict';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
jshint: {
options : {
jshintrc : '.jshintrc'
},
all: ['Gruntfile.js', 'tasks/**/*.js', 'test/**/*.js']
},
open : {
dev : {
path : 'http://127.0.0.1/~jsoverson/'
},
google : {
url : 'http://google.com/'
},
file : {
file : '/etc/hosts'
}
},
});
grunt.loadNpmTasks('grunt-contrib-jshint');
// Load local tasks.
grunt.loadTasks('tasks');
// Default task.
grunt.registerTask('default', ['jshint','open']);
};
+13
View File
@@ -0,0 +1,13 @@
Copyright 2012 OneHealth Solutions, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+71
View File
@@ -0,0 +1,71 @@
# grunt-open
Open urls and files from a grunt task
## Installation
Install alongside your Gruntfile
```bash
$ npm install --save grunt-open
```
## Usage
This is immediately useful as part of your task chain between `server` and `watch`
```js
grunt.registerTask('default', 'server open watch');
```
You can specify different configurations so that you can set up task chains like
```js
grunt.registerTask('dev', 'server open:dev watch');
grunt.registerTask('dev', 'build server open:build watch:build');
```
## Getting Started
Install this grunt plugin next to your project's [Gruntfile][getting_started] with: `npm install grunt-open`
## Configuration
This is a very simple task and takes only one configuration parameter, `path`.
```js
grunt.initConfig({
open : {
dev : {
path: 'http://127.0.0.1:8888/src'
},
google : {
path : 'http://google.com/'
},
file : {
path : '/etc/hosts'
}
}
})
grunt.loadNpmTasks('grunt-open');
```
[grunt]: https://github.com/gruntjs/grunt
[getting_started]: https://github.com/cowboy/grunt/blob/master/docs/getting_started.md
## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt][grunt].
## Release History
- 0.2.0 grunt 0.4.0 support, added and preferring `path` parameter.
- 0.1.0 initial release
## License
Copyright OneHealth Solutions, Inc
Written by Jarrod Overson
Licensed under the Apache 2.0 license.
Generated Vendored Executable
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/env node
require('grunt').npmTasks('grunt-open').cli();
+1
View File
@@ -0,0 +1 @@
test
+28
View File
@@ -0,0 +1,28 @@
# open.js
open a file or url in the default associated application
# install
```
npm install open
```
# usage
```js
var open = require('open');
open('http://www.google.com');
```
# how it works
- on `win32` uses `start`
- on `darwin` uses `open`
- otherwise uses the xdg-open script from [Portland](http://portland.freedesktop.org)
# warning
The same care should be taken when calling open as if you were calling
child_process.exec directly. If its an executable it will run in a new shell.
+39
View File
@@ -0,0 +1,39 @@
var exec = require('child_process').exec;
var path = require('path');
/**
* open a file or uri using the default application for the file type.
* @return {ChildProcess} - the child process object.
* @param {string} target - the file/uri to open.
* @param {function(Error)} callback - null on success, or an error object
* that contains a property 'code' with the exit code of the process.
*/
module.exports = open;
function open(target, callback) {
var opener;
switch (process.platform) {
case 'darwin':
opener = 'open';
break;
case 'win32':
// if the first parameter to start is quoted, it uses that as the title
// so we pass a blank title so we can quote the file we are opening
opener = 'start ""';
break;
default:
// use Portlands xdg-open everywhere else
opener = path.join(__dirname, '../vendor/xdg-open');
break;
}
// TODO: what are the implications of quoting target?
// - we'll need to look at target to see if its already quoted
// - different platforms may treat quotes differently
return exec(opener + ' "' + escape(target) + '"', callback);
}
function escape(s) {
return s.replace(/"/, '\\\"');
}
+40
View File
@@ -0,0 +1,40 @@
{
"author": {
"name": "J Jordan",
"email": "jjrdn@styosis.com"
},
"name": "open",
"description": "open a file or uri with the users preferred application",
"version": "0.0.2",
"repository": {
"type": "git",
"url": "git://github.com/jjrdn/node-open.git"
},
"main": "lib/open.js",
"keywords": [
"start",
"open",
"browser",
"editor",
"default"
],
"scripts": {
"test": "mocha"
},
"dependencies": {},
"devDependencies": {
"mocha": "*"
},
"optionalDependencies": {},
"engines": {
"node": ">= 0.6.0"
},
"readme": "# open.js\r\n\r\nopen a file or url in the default associated application\r\n\r\n# install\r\n\r\n```\r\nnpm install open\r\n```\r\n\r\n# usage\r\n\r\n```js\r\nvar open = require('open');\r\n\r\nopen('http://www.google.com');\r\n```\r\n\r\n# how it works \r\n\r\n- on `win32` uses `start`\r\n- on `darwin` uses `open`\r\n- otherwise uses the xdg-open script from [Portland](http://portland.freedesktop.org)\r\n\r\n# warning\r\n\r\nThe same care should be taken when calling open as if you were calling \r\nchild_process.exec directly. If its an executable it will run in a new shell. \r\n",
"readmeFilename": "README.md",
"_id": "open@0.0.2",
"dist": {
"shasum": "61e7c855f46a78e5b8ff01b28d39f289eeda025f"
},
"_from": "open@0.0.2",
"_resolved": "https://registry.npmjs.org/open/-/open-0.0.2.tgz"
}
+557
View File
@@ -0,0 +1,557 @@
#!/bin/sh
#---------------------------------------------
# xdg-open
#
# Utility script to open a URL in the registered default application.
#
# Refer to the usage() function below for usage.
#
# Copyright 2009-2010, Fathi Boudra <fabo@freedesktop.org>
# Copyright 2009-2010, Rex Dieter <rdieter@fedoraproject.org>
# Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at>
# Copyright 2006, Jeremy White <jwhite@codeweavers.com>
#
# LICENSE:
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
#---------------------------------------------
manualpage()
{
cat << _MANUALPAGE
Name
xdg-open - opens a file or URL in the user's preferred application
Synopsis
xdg-open { file | URL }
xdg-open { --help | --manual | --version }
Description
xdg-open opens a file or URL in the user's preferred application. If a URL is
provided the URL will be opened in the user's preferred web browser. If a file
is provided the file will be opened in the preferred application for files of
that type. xdg-open supports file, ftp, http and https URLs.
xdg-open is for use inside a desktop session only. It is not recommended to use
xdg-open as root.
Options
--help
Show command synopsis.
--manual
Show this manualpage.
--version
Show the xdg-utils version information.
Exit Codes
An exit code of 0 indicates success while a non-zero exit code indicates
failure. The following failure codes can be returned:
1
Error in command line syntax.
2
One of the files passed on the command line did not exist.
3
A required tool could not be found.
4
The action failed.
Examples
xdg-open 'http://www.freedesktop.org/'
Opens the Freedesktop.org website in the user's default browser
xdg-open /tmp/foobar.png
Opens the PNG image file /tmp/foobar.png in the user's default image viewing
application.
_MANUALPAGE
}
usage()
{
cat << _USAGE
xdg-open - opens a file or URL in the user's preferred application
Synopsis
xdg-open { file | URL }
xdg-open { --help | --manual | --version }
_USAGE
}
#@xdg-utils-common@
#----------------------------------------------------------------------------
# Common utility functions included in all XDG wrapper scripts
#----------------------------------------------------------------------------
DEBUG()
{
[ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && return 0;
[ ${XDG_UTILS_DEBUG_LEVEL} -lt $1 ] && return 0;
shift
echo "$@" >&2
}
#-------------------------------------------------------------
# Exit script on successfully completing the desired operation
exit_success()
{
if [ $# -gt 0 ]; then
echo "$@"
echo
fi
exit 0
}
#-----------------------------------------
# Exit script on malformed arguments, not enough arguments
# or missing required option.
# prints usage information
exit_failure_syntax()
{
if [ $# -gt 0 ]; then
echo "xdg-open: $@" >&2
echo "Try 'xdg-open --help' for more information." >&2
else
usage
echo "Use 'man xdg-open' or 'xdg-open --manual' for additional info."
fi
exit 1
}
#-------------------------------------------------------------
# Exit script on missing file specified on command line
exit_failure_file_missing()
{
if [ $# -gt 0 ]; then
echo "xdg-open: $@" >&2
fi
exit 2
}
#-------------------------------------------------------------
# Exit script on failure to locate necessary tool applications
exit_failure_operation_impossible()
{
if [ $# -gt 0 ]; then
echo "xdg-open: $@" >&2
fi
exit 3
}
#-------------------------------------------------------------
# Exit script on failure returned by a tool application
exit_failure_operation_failed()
{
if [ $# -gt 0 ]; then
echo "xdg-open: $@" >&2
fi
exit 4
}
#------------------------------------------------------------
# Exit script on insufficient permission to read a specified file
exit_failure_file_permission_read()
{
if [ $# -gt 0 ]; then
echo "xdg-open: $@" >&2
fi
exit 5
}
#------------------------------------------------------------
# Exit script on insufficient permission to write a specified file
exit_failure_file_permission_write()
{
if [ $# -gt 0 ]; then
echo "xdg-open: $@" >&2
fi
exit 6
}
check_input_file()
{
if [ ! -e "$1" ]; then
exit_failure_file_missing "file '$1' does not exist"
fi
if [ ! -r "$1" ]; then
exit_failure_file_permission_read "no permission to read file '$1'"
fi
}
check_vendor_prefix()
{
file_label="$2"
[ -n "$file_label" ] || file_label="filename"
file=`basename "$1"`
case "$file" in
[a-zA-Z]*-*)
return
;;
esac
echo "xdg-open: $file_label '$file' does not have a proper vendor prefix" >&2
echo 'A vendor prefix consists of alpha characters ([a-zA-Z]) and is terminated' >&2
echo 'with a dash ("-"). An example '"$file_label"' is '"'example-$file'" >&2
echo "Use --novendor to override or 'xdg-open --manual' for additional info." >&2
exit 1
}
check_output_file()
{
# if the file exists, check if it is writeable
# if it does not exists, check if we are allowed to write on the directory
if [ -e "$1" ]; then
if [ ! -w "$1" ]; then
exit_failure_file_permission_write "no permission to write to file '$1'"
fi
else
DIR=`dirname "$1"`
if [ ! -w "$DIR" -o ! -x "$DIR" ]; then
exit_failure_file_permission_write "no permission to create file '$1'"
fi
fi
}
#----------------------------------------
# Checks for shared commands, e.g. --help
check_common_commands()
{
while [ $# -gt 0 ] ; do
parm="$1"
shift
case "$parm" in
--help)
usage
echo "Use 'man xdg-open' or 'xdg-open --manual' for additional info."
exit_success
;;
--manual)
manualpage
exit_success
;;
--version)
echo "xdg-open 1.0.2"
exit_success
;;
esac
done
}
check_common_commands "$@"
[ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && unset XDG_UTILS_DEBUG_LEVEL;
if [ ${XDG_UTILS_DEBUG_LEVEL-0} -lt 1 ]; then
# Be silent
xdg_redirect_output=" > /dev/null 2> /dev/null"
else
# All output to stderr
xdg_redirect_output=" >&2"
fi
#--------------------------------------
# Checks for known desktop environments
# set variable DE to the desktop environments name, lowercase
detectDE()
{
if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde;
elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome;
elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
elif [ x"$DESKTOP_SESSION" == x"LXDE" ]; then DE=lxde;
else DE=""
fi
}
#----------------------------------------------------------------------------
# kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4
# It also always returns 1 in KDE 3.4 and earlier
# Simply return 0 in such case
kfmclient_fix_exit_code()
{
version=`kde${KDE_SESSION_VERSION}-config --version 2>/dev/null | grep '^KDE'`
major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'`
minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'`
release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'`
test "$major" -gt 3 && return $1
test "$minor" -gt 5 && return $1
test "$release" -gt 4 && return $1
return 0
}
# This handles backslashes but not quote marks.
first_word()
{
read first rest
echo "$first"
}
open_kde()
{
if kde-open -v 2>/dev/null 1>&2; then
kde-open "$1"
else
if [ x"$KDE_SESSION_VERSION" = x"4" ]; then
kfmclient openURL "$1"
else
kfmclient exec "$1"
kfmclient_fix_exit_code $?
fi
fi
if [ $? -eq 0 ]; then
exit_success
else
exit_failure_operation_failed
fi
}
open_gnome()
{
if gvfs-open --help 2>/dev/null 1>&2; then
gvfs-open "$1"
else
gnome-open "$1"
fi
if [ $? -eq 0 ]; then
exit_success
else
exit_failure_operation_failed
fi
}
open_xfce()
{
exo-open "$1"
if [ $? -eq 0 ]; then
exit_success
else
exit_failure_operation_failed
fi
}
open_generic_xdg_mime()
{
filetype=`xdg-mime query filetype "$1" | sed "s/;.*//"`
default=`xdg-mime query default "$filetype"`
if [ -n "$default" ] ; then
xdg_user_dir="$XDG_DATA_HOME"
[ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share"
xdg_system_dirs="$XDG_DATA_DIRS"
[ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/
for x in `echo "$xdg_user_dir:$xdg_system_dirs" | sed 's/:/ /g'`; do
local file="$x/applications/$default"
if [ -r "$file" ] ; then
command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`"
command_exec=`which $command 2>/dev/null`
if [ -x "$command_exec" ] ; then
$command_exec "$1"
if [ $? -eq 0 ]; then
exit_success
fi
fi
fi
done
fi
}
open_generic()
{
# Paths or file:// URLs
if (echo "$1" | grep -q '^file://' ||
! echo "$1" | egrep -q '^[a-zA-Z+\.\-]+:'); then
local file="$1"
# Decode URLs
if echo "$file" | grep -q '^file:///'; then
file=${file#file://}
file="$(printf "$(echo "$file" | sed -e 's@%\([a-f0-9A-F]\{2\}\)@\\x\1@g')")"
fi
check_input_file "$file"
open_generic_xdg_mime "$file"
if [ -f /etc/debian_version ] &&
which run-mailcap 2>/dev/null 1>&2; then
run-mailcap --action=view "$file"
if [ $? -eq 0 ]; then
exit_success
fi
fi
if mimeopen -v 2>/dev/null 1>&2; then
mimeopen -L -n "$file"
if [ $? -eq 0 ]; then
exit_success
fi
fi
fi
IFS=":"
for browser in $BROWSER; do
if [ x"$browser" != x"" ]; then
browser_with_arg=`printf "$browser" "$1" 2>/dev/null`
if [ $? -ne 0 ]; then
browser_with_arg=$browser;
fi
if [ x"$browser_with_arg" = x"$browser" ]; then
"$browser" "$1";
else eval '$browser_with_arg'$xdg_redirect_output;
fi
if [ $? -eq 0 ]; then
exit_success;
fi
fi
done
exit_failure_operation_impossible "no method available for opening '$1'"
}
open_lxde()
{
# pcmanfm only knows how to handle file:// urls and filepaths, it seems.
if (echo "$1" | grep -q '^file://' ||
! echo "$1" | egrep -q '^[a-zA-Z+\.\-]+:')
then
local file="$(echo "$1" | sed 's%^file://%%')"
# handle relative paths
if ! echo "$file" | grep -q '^/'; then
file="$(pwd)/$file"
fi
pcmanfm "$file"
else
open_generic "$1"
fi
if [ $? -eq 0 ]; then
exit_success
else
exit_failure_operation_failed
fi
}
[ x"$1" != x"" ] || exit_failure_syntax
url=
while [ $# -gt 0 ] ; do
parm="$1"
shift
case "$parm" in
-*)
exit_failure_syntax "unexpected option '$parm'"
;;
*)
if [ -n "$url" ] ; then
exit_failure_syntax "unexpected argument '$parm'"
fi
url="$parm"
;;
esac
done
if [ -z "${url}" ] ; then
exit_failure_syntax "file or URL argument missing"
fi
detectDE
if [ x"$DE" = x"" ]; then
DE=generic
fi
# if BROWSER variable is not set, check some well known browsers instead
if [ x"$BROWSER" = x"" ]; then
BROWSER=links2:links:lynx:w3m
if [ -n "$DISPLAY" ]; then
BROWSER=firefox:mozilla:epiphany:konqueror:chromium-browser:google-chrome:$BROWSER
fi
fi
case "$DE" in
kde)
open_kde "$url"
;;
gnome)
open_gnome "$url"
;;
xfce)
open_xfce "$url"
;;
lxde)
open_lxde "$url"
;;
generic)
open_generic "$url"
;;
*)
exit_failure_operation_impossible "no method available for opening '$url'"
;;
esac
+55
View File
@@ -0,0 +1,55 @@
{
"name": "grunt-open",
"description": "Open urls and files from a grunt task",
"version": "0.2.0",
"homepage": "https://github.com/onehealth/grunt-open",
"author": {
"name": "Jarrod Overson",
"email": "jsoverson@gmail.com",
"url": "http://jarrodoverson.com/"
},
"repository": {
"type": "git",
"url": "git://github.com/onehealth/grunt-open.git"
},
"bugs": {
"url": "https://github.com/onehealth/grunt-open/issues"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/onehealth/grunt-open/blob/master/LICENSE"
}
],
"main": "Gruntfile.js",
"bin": {
"grunt-open": "bin/grunt-open"
},
"engines": {
"node": ">= 0.6.0"
},
"scripts": {
"test": "grunt test"
},
"dependencies": {
"open": "0.0.2"
},
"devDependencies": {
"grunt": "~0.4.0",
"grunt-contrib-jshint": "~0.1.1"
},
"keywords": [
"gruntplugin",
"open",
"url",
"file"
],
"readme": "# grunt-open\n\nOpen urls and files from a grunt task\n\n## Installation\n\nInstall alongside your Gruntfile\n\n```bash\n$ npm install --save grunt-open\n```\n\n## Usage\n\nThis is immediately useful as part of your task chain between `server` and `watch`\n\n```js\ngrunt.registerTask('default', 'server open watch');\n```\n\nYou can specify different configurations so that you can set up task chains like\n\n```js\ngrunt.registerTask('dev', 'server open:dev watch');\ngrunt.registerTask('dev', 'build server open:build watch:build');\n```\n\n## Getting Started\nInstall this grunt plugin next to your project's [Gruntfile][getting_started] with: `npm install grunt-open`\n\n## Configuration\n\nThis is a very simple task and takes only one configuration parameter, `path`.\n\n```js\ngrunt.initConfig({\n open : {\n dev : {\n path: 'http://127.0.0.1:8888/src'\n },\n google : {\n path : 'http://google.com/'\n },\n file : {\n path : '/etc/hosts'\n }\n }\n})\n\ngrunt.loadNpmTasks('grunt-open');\n\n```\n\n[grunt]: https://github.com/gruntjs/grunt\n[getting_started]: https://github.com/cowboy/grunt/blob/master/docs/getting_started.md\n\n## Contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt][grunt].\n\n## Release History\n\n - 0.2.0 grunt 0.4.0 support, added and preferring `path` parameter.\n - 0.1.0 initial release\n\n## License\n\nCopyright OneHealth Solutions, Inc\n\nWritten by Jarrod Overson\n\nLicensed under the Apache 2.0 license.\n",
"readmeFilename": "README.md",
"_id": "grunt-open@0.2.0",
"dist": {
"shasum": "37f0ce5717f3125746d8b1b1e6041a33a592c4f3"
},
"_from": "grunt-open@",
"_resolved": "https://registry.npmjs.org/grunt-open/-/grunt-open-0.2.0.tgz"
}
+19
View File
@@ -0,0 +1,19 @@
/*
* grunt-open
* https://github.com/joverson/grunt-open
*
* Copyright (c) 2012 Jarrod Overson
* Licensed under the MIT license.
*/
'use strict';
var open = require('open');
module.exports = function(grunt) {
grunt.registerMultiTask('open', 'Open urls and files from a grunt task', function() {
var dest = this.data.url || this.data.file || this.data.path;
open(dest);
});
};