Home Download Buy Blog Forum Support

Creating build systems

Creating build systems

Postby harpyon on Tue May 24, 2011 7:34 pm

Hey there!

I'm trying to write a build system for Sublime Text, but for some reason it's not working. First of all, I'd like to say that the information at http://www.sublimetext.com/docs/build seems out of date, and is only misleading.

Anyway, I'm trying to write a build system for CleanCSS. This requires me to run a command like this:

Code: Select all
python -m cleancss file.ccss > file.css


This is my attempt:

Code: Select all
{
   "cmd": ["python2.7 -m cleancss $file > $basename.css"],
   "selector": "source.ccss"
}


However, when I hit CMD-B (I'm on a mac), I get this error:

[Errno 2] No such file or directory


So I open up the console to see what's going on, and I find this:

Running python2.7 -m cleancss /Users/haavard/Dropbox/syncing/Programming/miniscurl/css/styles.ccss > .css


As you can see, the filename to output to is missing, and it's trying to write to the file ".css". However, this is not the error. I tried removing the "> $basename.css" part, and still get the "No such file or directory" error. The console says this:

Running python2.7 -m cleancss /Users/haavard/Dropbox/syncing/Programming/miniscurl/css/styles.ccss


See the error? There is none. When I copy this exact command into terminal, it works exactly like expected, but Sublime Text says "no such file". It gets even weirder: if I run cleancss in terminal with an invalid file, I get this:

Code: Select all
$ python2.7 -m cleancss foo
[Errno 2] No such file or directory: 'foo'


The difference is that it says what is actually invalid; in this case, "foo". When building in sublime text, it only says "[Errno 2] No such file or directory". The logical thing would be that sublime text does not supply a file at all, but this is not correct, then cleancss would print a usage message.

Are anyone able to shed some light on this issue? Hope I'm not confusing you too much.
harpyon
 
Posts: 2
Joined: Tue May 24, 2011 7:20 pm

Re: Creating build systems

Postby guillermooo on Tue May 24, 2011 9:06 pm

guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

Re: Creating build systems

Postby harpyon on Wed May 25, 2011 9:22 pm

Thanks, that site helped. I discovered the main problem though.

Sublime Text is not bash, so piping the output using > did not work. I wrote my own version of CleanCSS that does not require this, and it works like a charm. Thanks!
harpyon
 
Posts: 2
Joined: Tue May 24, 2011 7:20 pm

Re: Creating build systems

Postby theophani on Thu Jul 07, 2011 8:19 am

theophani
 
Posts: 1
Joined: Thu Jul 07, 2011 8:15 am

Re: Creating build systems

Postby Arioch on Thu Aug 04, 2011 6:52 pm

I'm getting the same error using a different build system:

Code: Select all
{
    "cmd": ["puppet", "parser", "validate", "--color=false", "--confdir=/tmp/puppet", "--vardir=/tmp/puppet", "$file"],
    "working_dir": "${project_path:${folder:${file_path}}}",
    "selector": "source.pp"
}


When I run cmd-B I get the following output:

Code: Select all
[Errno 2] No such file or directory
[Finished]


However the command run in the console is correct. When I copy/paste this and run it manually in a terminal it exits ok.
Arioch
 
Posts: 7
Joined: Thu Aug 04, 2011 10:33 am

Re: Creating build systems

Postby Arioch on Mon Aug 29, 2011 11:57 am

Anyone?
Arioch
 
Posts: 7
Joined: Thu Aug 04, 2011 10:33 am

Re: Creating build systems

Postby jps on Mon Aug 29, 2011 12:13 pm

Applications launched from finder have a different path than apps launched from the terminal - the issue is that 'puppet' isn't in your path. Simplest option is to adjust the build system to give the full path to puppet.
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm

Re: Creating build systems

Postby Arioch on Wed Sep 28, 2011 7:28 am

Already tried that but it made no difference at all.
And puppet actually is listed in $PATH.
Arioch
 
Posts: 7
Joined: Thu Aug 04, 2011 10:33 am

Re: Creating build systems

Postby Arioch on Wed Sep 28, 2011 7:47 am

This is what I have now:
Code: Select all
{
    "cmd": [ "/opt/local/bin/puppet parser", "validate", "--color=false", "--confdir=/tmp", "--vardir=/tmp", "$file" ],
    "working_dir": "${project_path:${folder:${file_path}}}",
    "selector": "source.pp",
    "path": "/opt/local/bin:$PATH"
}


If anyone could tell me what I'm doing wrong here...
Arioch
 
Posts: 7
Joined: Thu Aug 04, 2011 10:33 am

Re: Creating build systems

Postby guillermooo on Wed Sep 28, 2011 8:21 am

Try this:

Code: Select all
{
    "cmd": [ "puppet", "parser", "validate", "--color=false", "--confdir=/tmp", "--vardir=/tmp", "$file" ],
    "working_dir": "${project_path:${folder:${file_path}}}",
    "selector": "source.pp",
    "path": "/opt/local/bin:$PATH"
}


... or this:

Code: Select all
{
    "cmd": [ "/opt/local/bin/puppet", "parser", "validate", "--color=false", "--confdir=/tmp", "--vardir=/tmp", "$file" ],
    "working_dir": "${project_path:${folder:${file_path}}}",
    "selector": "source.pp",
    "path": "/opt/local/bin:$PATH"
}
guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

Next

Return to Technical Support

Who is online

Users browsing this forum: Google [Bot], Wuza, Yahoo [Bot] and 17 guests