Skip to content

Commit

Permalink
packagetemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
colinta committed Jul 27, 2012
1 parent 1ab900b commit c748754
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 10 deletions.
18 changes: 14 additions & 4 deletions config.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
import os
from strange_case.strange_case_config import CONFIG
from strange_case.configurators import titlecase
from strange_case.registry import Registry
from strange_case.extensions.configurator_title_from_name import titlecase


def project_title(CONFIG):
assert CONFIG.get('project', None), "'project' is required"
if CONFIG.get('project', None) is None:
import sys
sys.stderr.write("Usage:\n scase project:name [desc:description]\n\n'project' is required\n")
sys.exit(1)

if 'Project' not in CONFIG:
CONFIG['Project'] = titlecase(CONFIG['project'])
CONFIG['project'] = CONFIG['project'].replace('-', '_')
CONFIG['Project'] = titlecase(CONFIG['project'])
CONFIG['ProJect'] = CONFIG['Project'].replace(' ', '')
CONFIG['deploy_path'] = os.path.abspath(os.path.dirname(__file__) + '/../' + CONFIG['ProJect'])

CONFIG['config_hook'] = project_title
CONFIG['len'] = len
CONFIG['deploy_path'] = 'ignore'

Registry.associate('page', '*.*')
1 change: 0 additions & 1 deletion config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
project_path: ~/Library/Application Support/Sublime Text 2/Packages
deploy_path: null
site_path: project
2 changes: 1 addition & 1 deletion project/Default.sublime-commands
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
// {
// "caption": "{{ Project }}",
// "caption": "{{ ProJect }}",
// "command": "{{ project }}"
// }
]
11 changes: 8 additions & 3 deletions project/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{{ Project }} for Sublime Text 2
={{ '=' * len(Project) }}====================
----
target_name: README.md
----
{{ ProJect }} for Sublime Text 2
={{ '=' * len(ProJect) }}====================
{%- if desc %}

{{ desc }}
Expand All @@ -8,7 +11,7 @@
Installation
--------------

1. Using Package Control, install "{{ Project }}"
1. Using Package Control, install "{{ ProJect }}"

Or:

Expand All @@ -19,7 +22,9 @@ Or:
- Linux: ~/.Sublime Text 2/Packages/

2. clone this repo
3. Install keymaps for the commands (see Example.sublime-keymap for my preferred keys)

Commands
----------

`{{ project }}`:
2 changes: 1 addition & 1 deletion project/_package_.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sublime_plugin


class {{ Project }}Command(sublime_plugin.TextCommand):
class {{ ProJect }}Command(sublime_plugin.TextCommand):
def run(self, edit, **kwargs):
e = self.view.begin_edit('{{ project }}')
regions = [region for region in self.view.sel()]
Expand Down
7 changes: 7 additions & 0 deletions project/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"repo": "Sublime{{ ProJect }}",
"name": "{{ Project }}",
"description": "{{ description }}",
"author": "Colin Thomas-Arnold (colinta)",
"homepage": "https://github.com/colinta/Sublime{{ ProJect }}"
}

0 comments on commit c748754

Please sign in to comment.