Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remote: Repository not found. #1

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.sublime-workspace
*.pyc
package-metadata.json
/web/node_modules
*.sublime-project
.DS_Store
Empty file added .no-sublime-package
Empty file.
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: python
python:
- "2.6"
before_install:
sudo apt-get install -y libevent-dev python-gevent python-lxml
install:
pip install -r requirements.txt --use-mirrors
script:
make test
notifications:
irc: "irc.freenode.org#lr-sublime"
104 changes: 104 additions & 0 deletions CoffeescriptPlugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

import os
import threading
import subprocess
import sys
import sublime
import sublime_plugin

# fix for import order

sys.path.append(os.path.join(sublime.packages_path(), 'LiveReload'))
LiveReload = __import__('LiveReload')
sys.path.remove(os.path.join(sublime.packages_path(), 'LiveReload'))


class CoffeeThread(threading.Thread):

def getLocalOverride(self):
"""
You can override defaults in sublime-project file

Discussion: https://github.com/dz0ny/LiveReload-sublimetext2/issues/43

Example:

"settings": {
"coffee": {
"command": "coffee -cv --maps"
}
}
"""
try:
view_settings = sublime.active_window().active_view().settings()
view_settings = view_settings.get('lrcoffee')
if view_settings:
return view_settings
else:
return {}
except Exception:
return {}

def __init__(self, dirname, on_compile, filename):

self.filename = filename

##TODO: Proper handler for this
try:
self.dirname = self.getLocalOverride.get('dirname') \
or dirname.replace('\\', '/')
except Exception as e:
self.dirname = dirname.replace('\\', '/')
try:
self.command = self.getLocalOverride.get('command') or 'coffee -c'
except Exception as e:
self.command = 'coffee -c'

self.stdout = None
self.stderr = None
self.on_compile = on_compile
threading.Thread.__init__(self)

def run(self):
cmd = self.command + " " + self.filename + " " + self.filename.replace('.coffee','.js')

p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
test = p.stdout.read()
# if there is no result, everything worked Great!
if not test:
self.on_compile()
else:
# something went wrong...
err = test.split('\n')
sublime.error_message(err[0])

class coffeePreprocessor(LiveReload.Plugin, sublime_plugin.EventListener):

title = 'CoffeeScript Preprocessor'
description = 'Coffeescript Compile and refresh page, when file is compiled'
file_types = '.coffee'
this_session_only = True
file_name = ''

def on_post_save(self, view):
self.original_filename = os.path.basename(view.file_name())

if self.should_run(self.original_filename):
self.file_name_to_refresh = \
self.original_filename.replace('.coffee', '.js')
dirname = os.path.dirname(view.file_name())
CoffeeThread(dirname, self.on_compile, self.original_filename).start()

def on_compile(self):
print(self.file_name_to_refresh)
settings = {
'path': self.file_name_to_refresh,
'apply_js_live': False,
'apply_css_live': False,
'apply_images_live': False,
}
self.sendCommand('refresh', settings, self.original_filename)
34 changes: 34 additions & 0 deletions CommandAPI.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

import sublime
import sublime_plugin
import LiveReload
import webbrowser
import os


class LiveReloadTest(sublime_plugin.ApplicationCommand):

def run(self):
path = os.path.join(sublime.packages_path(), 'LiveReload', 'web')
file_name = os.path.join(path, 'test.html')
webbrowser.open_new_tab("file://"+file_name)


class LiveReloadHelp(sublime_plugin.ApplicationCommand):

def run(self):
webbrowser.open_new_tab('https://github.com/dz0ny/LiveReload-sublimetext2/'
)


class LiveReloadEnablePluginCommand(sublime_plugin.ApplicationCommand):

def on_done(self, index):
if not index is -1:
LiveReload.Plugin.togglePlugin(index)

def run(self):
sublime.active_window().show_quick_panel(LiveReload.Plugin.listPlugins(),
self.on_done)
142 changes: 142 additions & 0 deletions CompassPlugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

import os
import threading
import subprocess
import sys
import sublime
import sublime_plugin
import shlex
import re
import json

# fix for import order

sys.path.append(os.path.join(sublime.packages_path(), 'LiveReload'))
LiveReload = __import__('LiveReload')
sys.path.remove(os.path.join(sublime.packages_path(), 'LiveReload'))


class CompassThread(threading.Thread):

def getLocalOverride(self):
"""
You can override defaults in sublime-project file

Discussion: https://github.com/dz0ny/LiveReload-sublimetext2/issues/43

Example:

"settings": {
"lrcompass": {
"dirname": "/path/to/directory/which/contains/config.rb",
"command": "compass compile -e production --force"
}
}
"""
try:
view_settings = sublime.active_window().active_view().settings()
view_settings = view_settings.get('lrcompass')
if view_settings:
return view_settings
else:
return {}
except Exception:
return {}

def __init__(self, dirname, on_compile):
##TODO: Proper handler for this
try:
self.dirname = self.getLocalOverride.get('dirname') \
or dirname.replace('\\', '/')
except Exception as e:
self.dirname = dirname.replace('\\', '/')

try:
self.command = self.getLocalOverride.get('command') or 'compass compile'
except Exception as e:
self.command = 'compass compile'

self.stdout = None
self.stderr = None
self.on_compile = on_compile
threading.Thread.__init__(self)

# Check if a config.rb file exists in the current directory
# If no config.rb is found then check the parent and stop when root directory is reached
def check_for_compass_config(self):
if os.path.isfile(os.path.join(self.dirname, "config.rb")):
return True
dirname = os.path.abspath(os.path.join(self.dirname, os.pardir)).replace('\\', '/')
if self.dirname == dirname:
return False
else:
self.dirname = dirname
return self.check_for_compass_config()

# Generate config.rb file
def generate_conf_rb(self, dirname):
config_rb = """http_path = "/"
css_dir = "."
sass_dir = "."
images_dir = "img"
javascripts_dir = "javascripts"
output_style = :nested
relative_assets=true
line_comments = false
"""
with open(os.path.join(dirname, "config.rb"), 'w') as f:
f.write(config_rb)
self.dirname = dirname
return

def run(self):
dirname = self.dirname
if not self.check_for_compass_config():
if json.load(open(os.path.join(sublime.packages_path(),'LiveReload','CompassPlugin.sublime-settings')))["create_configrb"]:
self.generate_conf_rb(dirname)
else:
sublime.error_message("Could not find Compass config.rb. Please check your sublime-project file and adjust settings accordingly!")
return
# cmd = shlex.split(self.command)
# cmd.append(self.dirname)
# Mac doesn't compile array
cmd = self.command + ' "' + self.dirname + '"'
p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
compiled = p.stdout.read()

# Find the file to refresh from the console output
if compiled:
print("Compass : " + compiled.decode("utf-8"));
matches = re.findall('\S+\.css', compiled.decode("utf-8"))
if len(matches) > 0:
for match in matches:
self.on_compile(match)


class CompassPreprocessor(LiveReload.Plugin,
sublime_plugin.EventListener):

title = 'Compass Preprocessor'
description = 'Compile and refresh page, when file is compiled'
file_types = '.scss,.sass'
this_session_only = True
file_name = ''

def on_post_save(self, view):
self.original_filename = os.path.basename(view.file_name())
if self.should_run(self.original_filename):
dirname = os.path.dirname(view.file_name())
CompassThread(dirname, self.on_compile).start()

def on_compile(self, file_to_refresh):
settings = {
'path': file_to_refresh,
'apply_js_live': False,
'apply_css_live': True,
'apply_images_live': True,
}
self.sendCommand('refresh', settings, self.original_filename)
3 changes: 3 additions & 0 deletions CompassPlugin.sublime-settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"create_configrb": 1
}
14 changes: 14 additions & 0 deletions Default.sublime-commands
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"caption": "LiveReload: Self test",
"command": "live_reload_test"
},
{
"caption": "LiveReload: Help",
"command": "live_reload_help"
},
{
"caption": "LiveReload: Enable/disable plug-ins",
"command": "live_reload_enable_plugin"
}
]
Loading