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

Build Broken in Sublime Text Version 2.0.1 Build 2217 #9

Open
topher515 opened this issue Jul 17, 2012 · 20 comments
Open

Build Broken in Sublime Text Version 2.0.1 Build 2217 #9

topher515 opened this issue Jul 17, 2012 · 20 comments
Labels
Milestone

Comments

@topher515
Copy link

Attempts to build any Coffeescript file using the Sublime Text build system results in the following error:

/usr/local/lib/node_modules/coffee-script/lib/cake.js:38
        throw new Error("Cakefile not found in " + (process.cwd()));
              ^
Error: Cakefile not found in <my_directory>/<my_coffeescript_file>
    at /usr/local/lib/node_modules/coffee-script/lib/cake.js:38:15
    at path.js:292:19
[Finished in 0.4s with exit code 1]
@deweller
Copy link

This is also happening to me.

@Xavura
Copy link
Collaborator

Xavura commented Jul 18, 2012

For me, at least, it looks like $project_path is not being set correctly in all cases. It seems this is an issue with Sublime.

Does this fix it? I don't know why that would fix it but apparently it works.

@deweller
Copy link

I did try removing and reinstalling the package. That fixed the "Error parsing plist xml" issue. But I am still unable to run the build system. I am seeing a "Cakefile not found" error similar to Topher515's.

@Xavura
Copy link
Collaborator

Xavura commented Jul 18, 2012

It is assumed that your .sublime-project file will be in your project's base directory. It is also assumed that the Cakefile will be there too. This is because of a limitation with build systems that means I am unable to determine your project's actual directory - the one added via Project » Add Folder(s) to Project - see the docs.

Currently the build system is using $project_path which means, the directory containing the .sublime-project file.

If I don't specify a working directory for the build system, then Sublime will default to the directory containing the file that is focused when you run the build system. The problem with that is it will also look for the Cakefile in the same place.

So you need to put your .sublime-project in your project directory along with your Cakefile. If you don't want it in source control then you can add it to your .gitignore.

Does this solve the issue?

@deweller
Copy link

I added an empty Cakefile and .sublime-project at my project's root. That helped a little. Now I get the following message when I run the build:

No such task: sbuild

To see a list of all tasks/options, run "cake"

I've never had a Cakefile or a .sublime-project in my project directory tree until now.

@deweller
Copy link

It occurs to me now that I've probably been using this plugin incorrectly. The build system is meant to be used with a Cakefile. I just naively used the build system without knowing anything about cake.

What the build did before recently is created a .js file in the same folder as the .coffee file I had highlighted. This was not useful as a build system, but it did provide feedback about any syntax errors.

I will read up on cake and add a meaningful Cakefile to my project.

For those of us who were using this plugin without a Cakefile, is it possible to restore this default behavior?

@Xavura
Copy link
Collaborator

Xavura commented Jul 18, 2012

That's all the build system does - it runs a Cake task which you would define in your Cakefile as such:

task 'sbuild', ->
    doStuff()
    andThings()

Typically this is where you would say concatenate your files, minify them, or whatever else building your project entails... which could be a myriad of things which is why it is done this way.

I was fairly certain there was also a Compile File command that would compile the current file to CoffeeScript but it appears I was wrong about that. I'm guessing the reason no one has complained about it yet is because everyone uses the coffee command line utility to compile their files, presumably with the --watch option.

For the moment, you can use alt+shift+d and then save the generated javascript file manually. I will add the missing Compile File command now, literally the package will be updated in 10-20 minutes.

If you're interested, in an upcoming update you will be able to just use watch integration.

Xavura added a commit that referenced this issue Jul 18, 2012
This was supposed to exist but didn't for some reason, see #9.
@Xavura
Copy link
Collaborator

Xavura commented Jul 18, 2012

Windows decided to hard crash so that took a little longer than expected. You can now use alt+shift+c to compile the current file.

Pinging @topher515.

@Xavura
Copy link
Collaborator

Xavura commented Jul 18, 2012

@deweller By the way, alt+shift+s will run a syntax check and display the status in the status bar.

@deweller
Copy link

Well would you look at that! It turns out that alt-shift-s is exactly what I wanted and I didn't even know it.

I would probably be amazed at the treasure trove of helpful information I might find if I read the documentation.

Thanks for your help on this.

@Xavura
Copy link
Collaborator

Xavura commented Jul 18, 2012

Indeed, GitHub shows the documentation right there at the forefront for a reason. 😄

@topher515
Copy link
Author

@Xavura, thanks for addressing this so quickly!

When I use alt-shift-s command it compiles the current CoffeeScript file into a new file which I then need to save as .js file.

The behavior which I originally used out-of-the-box was: cmd-b compiles the current CoffeeScript file into a Javascript file of the same name (but with a .js extension of course) and silently saves (w/ overwrite) in the background.

With the latest commit (fb04af1), the cmd-b command continues to error with Error("Cakefile not found in " + (process.cwd())).

Is there a way to get this behavior back? I realize that having a proper cakefile is great in many cases but I also have several projects which simply dont warrant the complexity.

@Xavura
Copy link
Collaborator

Xavura commented Jul 18, 2012

You want alt±shift+c (c for compile).

Regarding ctrl+b, that's a shortcut for F7 and that does this.

@Xavura
Copy link
Collaborator

Xavura commented Jul 18, 2012

Regarding your error, I think I know what the problem may be. I'll look into it, you're on Windows right?

@topher515
Copy link
Author

Regarding the cmd+B error--no, actually I'm running OS X 10.7.

Regarding the alt-shift-c--Great, that's actually exactly what I was hoping for.

@Xavura
Copy link
Collaborator

Xavura commented Jul 18, 2012

Good to hear and I see the problem now, I'll fix it in the next update.

@topher515
Copy link
Author

Great! Thanks!

@brihogan
Copy link

brihogan commented Aug 3, 2012

My install didn't seem to be broken as mentioned in the original post, however the symbol list wasn't indenting properly and it was displaying unnecessary symbols (console, Object, etc). When I installed the files directly from https://github.com/jashkenas/coffee-script-tmbundle it worked (once I moved around some files from their subdirectories).

The problem can also be fixed if I install your plugin and then copy the "Symbol List*.tmPreferences" files from the "preferences" folder from jashkenas's repo straight into your plugin folder. Perhaps Sublime Text 2 added the need for these Symbol List files in the latest build? Looks like maybe you need to include them in your plugin?

Thanks for your work on this plugin.

@peterschmidler
Copy link

It would still be very nice to use cmd-B without a cakefile, as it works with Less. It would be cool to simply remember one shortcut. Is there any easy way to achieve this?

@attenzione
Copy link

i modified CoffeeScript.sublime-build

{
  // "path": "$HOME/bin:/usr/local/bin:$PATH",
  "cmd": ["coffeelint -f ~/.coffeelint --nocolor -q $file"],
  "file_regex": "([^\\s]+\\.coffee)$",
  "line_regex": "#(\\d+):(.*)$",
  "selector": "source.coffee, source.litcoffee, source.coffee.md",
  "shell": true,
  "osx": {
    "path": "~/:/usr/local/share/npm/bin:/usr/local/bin:/opt/local/bin"
  }
}

be careful with your path!

default ~/.coffeelint

{
  "no_tabs" : {
    "level" : "error"
  },

  "no_trailing_whitespace" : {
    "level" : "error"
  },

  "max_line_length" : {
    "value": 80,
    "level" : "error"
  },

  "camel_case_classes" : {
    "level" : "error"
  },

  "indentation" : {
    "value" : 2,
    "level" : "error"
  },

  "no_implicit_braces" : {
    "level" : "ignore"
  },

  "no_trailing_semicolons" : {
    "level" : "error"
  },

  "no_plusplus" : {
    "level" : "ignore"
  },

  "no_throwing_strings" : {
    "level" : "error"
  },

  "cyclomatic_complexity" : {
    "value" : 11,
    "level" : "ignore"
  },

  "line_endings" : {
    "value" : "unix",
    "level" : "ignore"
  },

  "no_implicit_parens" : {
    "level" : "ignore"
  },

  "no_stand_alone_at" : {
    "level": "ignore"
  }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants