Coder Social home page Coder Social logo

guard / guard-coffeescript Goto Github PK

View Code? Open in Web Editor NEW

This project forked from netzpirat/guard-coffeescript

96.0 96.0 14.0 508 KB

Guard::CoffeeScript automatically compiles your CoffeeScripts

Home Page: https://rubygems.org/gems/guard-coffeescript

License: MIT License

Ruby 100.00%

guard-coffeescript's Introduction

Guard

Gem Version Build Status Code Climate Test Coverage Inline docs Reviewed by Hound

Guard Icon

Guard automates various tasks by running custom rules whenever file or directories are modified.

It's frequently used by software developers, web designers, writers and other specialists to avoid mundane, repetitive actions and commands such as "relaunching" tools after changing source files or configurations.

Common use cases include: an IDE replacement, web development tools, designing "smart" and "responsive" build systems/workflows, automating various project tasks and installing/monitoring various system services.

For a full categorized list of known Guard plugins, look here: https://github.com/guard/guard/wiki/Guard-Plugins

If you have any questions about Guard or want to share some information with the Guard community, please go to one of the following places:

Before you file an issue, make sure you have read the known issues and file an issue sections that contains some important information.

Features

  • File system changes handled by our awesome Listen gem.
  • Support for visual system notifications.
  • Huge eco-system with more than 300 Guard plugins.
  • Tested against the latest Ruby 2.4.x, 2.5.x, 2.6.x, JRuby & Rubinius. See .travis-ci.yml for the exact versions.

Screencast

Two nice screencasts are available to help you get started:

Installation

The simplest way to install Guard is to use Bundler.

Add Guard (and any other dependencies) to a Gemfile in your project’s root:

group :development do
  gem 'guard'
end

then install it by running Bundler:

$ bundle

Generate an empty Guardfile with:

$ bundle exec guard init

Run Guard through Bundler with:

$ bundle exec guard

If you are on Mac OS X and have problems with either Guard not reacting to file changes or Pry behaving strange, then you should add proper Readline support to Ruby on macOS.

Avoiding gem/dependency problems

It's important that you always run Guard through Bundler to avoid errors.

If you're getting sick of typing bundle exec all the time, try one of the following:

  • (Recommended) Running bundle binstub guard will create bin/guard in your project, which means running bin/guard (tab completion will save you a key stroke or two) will have the exact same result as bundle exec guard.

  • Or, you can alias be="bundle exec" in your .bashrc or similar and the execute only be guard. Protip: It will work for all comands executed in bundle exec context!

  • Or, for RubyGems >= 2.2.0 (at least, though the more recent the better), simply set the RUBYGEMS_GEMDEPS environment variable to - (for autodetecting the Gemfile in the current or parent directories) or set it to the path of your Gemfile.

(To upgrade RubyGems from RVM, use the rvm rubygems command).

NOTE: this Rubygems feature is still under development still lacks many features of bundler

Add Guard plugins

Guard is now ready to use and you should add some Guard plugins for your specific use. Start exploring the many Guard plugins available by browsing the Guard organization on GitHub or by searching for guard- on RubyGems.

When you have found a Guard plugin of your interest, add it to your Gemfile:

group :development do
  gem '<guard-plugin-name>'
end

See the init section of the Guard usage below to see how to install the supplied plugin template that you can install and to suit your needs.

Usage

Guard is run from the command line. Please open your terminal and go to your project work directory.

Look here for a full list of Guard commands

Start

Just launch Guard inside your Ruby or Rails project with:

$ bundle exec guard

Guard will look for a Guardfile or guardfile.rb in your current directory. If it does not find one, it will look in your $HOME directory for a .Guardfile.

Please look here to see all the command line options for Guard

Interactions

Please read how to interact with Guard on the console and which signals Guard accepts

Guardfile DSL

For details on extending your Guardfile look at Guardfile examples or look at a list of commands Guardfile-DSL / Configuring-Guard

Issues

Before reporting a problem, please read how to File an issue.

Development / Contributing

See the Contributing Guide.

Releasing

Prerequisites

  • You must have commit rights to the GitHub repository.
  • You must have push rights for rubygems.org.

How to release

  1. Determine which would be the correct next version number according to semver.
  2. Update the version in ./lib/guard/version.rb.
  3. Commit the version in a single commit, the message should be "Bump VERSION to X.Y.Z".
  4. Push and open a pull request.
  5. Once CI is green, merge the pull request.
  6. Pull the changes locally and run bundle exec rake release:full; this will tag, push to GitHub, publish to rubygems.org, and publish the release notes .

Author

Thibaud Guillaume-Gentil (@thibaudgg)

Core Team

Contributors

https://github.com/guard/guard/graphs/contributors

guard-coffeescript's People

Contributors

aaronjensen avatar akahigeg avatar caldwell avatar e2 avatar hoverbird avatar jabbawookiees avatar jqr avatar jtolio avatar netzpirat avatar oychang avatar raldred avatar randoum avatar rogueg avatar rymai avatar vizjerai avatar whatcould avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

guard-coffeescript's Issues

Files are not getting watched or generated

No files are getting watched or generated.

guard-coffeescript (2.0.1)

guard 'coffeescript', :input => 'app/js', :output => 'www/js'
guard 'haml', :input => 'app/html', :output => 'www'
guard 'sass', :input => 'app/css', :output => 'www/css'

Included other guards in the example because they are working perfectly.
Quadruple-checked my directory tree, it's all good.
(also have rake working nice for the same task)

Guard run all:

04:47:50 - INFO - Run all
04:47:50 - INFO - Compile
04:47:50 - INFO - 04:47:50 AM Successfully generated 

04:47:50 - INFO - Successfully compiled haml to html!
> [#EB3785E208D4] # app/html/foo.haml -> www/foo.html

04:47:50 - INFO - Sass [0.00s] foo.sass -> foo.css

But again, nothing generated.

Guard is unresponsive

I'm not sure what I did. It was working fine yesterday, and when I got in this morning, I try to change the Guardfile to add new directories. I also added a new guard block to see if it would work with multiple output folder, and then I went back to the original. Now guard does not detect any change I make to the files in the directory being watched.

My guardfile is very simple:

guard 'coffeescript', :input => '.', :output => 'js' do 
    watch(%r{^specs/(.+\.coffee)$})
end

error using standard watch syntax

So based on the example provided through guard init coffeescript, i can get it working... however i prefer the approach of calling multiple watch methods explicitly, however that does not seem to work with this guard plugin.

# this works
coffeescript_options = {
  input: '.',
  output: '.dist',
  patterns: [%r{^(.+\.(?:coffee|coffee\.md|litcoffee))$}]
}

guard :coffeescript, coffeescript_options do
  coffeescript_options[:patterns].each { |pattern| watch(pattern) }
end
# this does NOT work
guard :coffeescript, input: '.', output: '.dist' do
  watch(%r{^(.+\.(?:coffee|coffee\.md|litcoffee))$})
end

also (despite the examples in the README), without providing an input value, throws the error :input option not provided (see current template Guardfile)

having all my guard plugin declarations contained to the guard block makes my larger Guardfile much easier to read, so hopefully i just have some syntax incorrect.

ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14]
Guard version 2.13.0
guard-coffeescript (2.0.1)

thanks!

Compile doesn't work

Hello, @e2 and all ruby hackers!
On this small library i am trying to exec

$ bundle exec guard --debug
10:28:55 - DEBUG - Notiffany: gntp not available (Please add "gem 'ruby_gntp'" to your Gemfile and run your app with "bundle exec".).
10:28:55 - DEBUG - Notiffany: growl not available (Please add "gem 'growl'" to your Gemfile and run your app with "bundle exec".).
10:28:55 - DEBUG - Command execution: emacsclient --eval '1'
10:28:55 - DEBUG - Notiffany: emacs not available (Emacs client failed).
10:28:55 - DEBUG - Notiffany: tmux not available (:tmux notifier is only available inside a TMux session.).
10:28:55 - DEBUG - Notiffany: file not available (No :path option given).
10:28:56 - DEBUG - Notiffany is using TerminalNotifier to send notifications.
10:28:56 - DEBUG - Notiffany is using TerminalTitle to send notifications.
10:28:56 - DEBUG - Command execution: hash stty
10:28:56 - DEBUG - Guard starts all plugins
10:28:56 - DEBUG - Hook :start_begin executed for Guard::CoffeeScript
10:28:56 - DEBUG - Hook :start_end executed for Guard::CoffeeScript
10:28:56 - DEBUG - Hook :start_begin executed for Guard::CoffeeScript
10:28:56 - DEBUG - Hook :start_end executed for Guard::CoffeeScript
10:28:56 - DEBUG - Hook :start_begin executed for Guard::CoffeeScript
10:28:56 - DEBUG - Hook :start_end executed for Guard::CoffeeScript
10:28:56 - INFO - Guard is now watching at '/Users/ruslan/fun/websocket-rails-js'
10:28:56 - DEBUG - Start interactor
10:28:56 - DEBUG - Command execution: stty -g 2>/dev/null
[1] guard(main)> all
10:28:58 - DEBUG - Interactor was stopped or killed
10:28:58 - DEBUG - Command execution: stty  2>/dev/null
10:28:58 - INFO - Run all
10:28:58 - DEBUG - Hook :run_all_begin executed for Guard::CoffeeScript
10:28:58 - INFO - Compile
10:28:58 - INFO - 10:28:58 AM Successfully generated

10:28:58 - DEBUG - Hook :run_all_end executed for Guard::CoffeeScript
10:28:58 - DEBUG - Hook :run_all_begin executed for Guard::CoffeeScript
10:28:58 - INFO - Compile
10:28:58 - INFO - 10:28:58 AM Successfully generated

10:28:59 - DEBUG - Hook :run_all_end executed for Guard::CoffeeScript
10:28:59 - DEBUG - Hook :run_all_begin executed for Guard::CoffeeScript
10:28:59 - INFO - Compile
10:28:59 - INFO - 10:28:59 AM Successfully generated

10:28:59 - DEBUG - Hook :run_all_end executed for Guard::CoffeeScript
10:28:59 - DEBUG - Start interactor
10:28:59 - DEBUG - Command execution: stty -g 2>/dev/null

It notify, that everythins is compile but there is no js output here!
I read carefully Guard README, guard-coffescript readme, but i can't understand what is going wrong
Here is Guard file

guard 'coffeescript', :input => 'assets/javascripts', :output => 'src/'
guard 'coffeescript', :input => 'spec/javascripts/websocket_rails', :output => 'spec/javascripts/generated'
guard 'coffeescript', :input => 'spec/javascripts/helpers', :output => 'spec/javascripts/helpers'

I am trying also to create output dir like this

rm -rf src
mkdir src
chmod 700 src

But it also, doesn't compile anything

Note: To reproduce the bug, just clone the library above, and reproduce the obviouse steps, descriped above.

I will also repost this issue in google group 😄

With best regards, Ruslan.

Compiler fails silently if no output file is selected

Create this folder structure:

.
|-- Gemfile
|-- Guardfile
|-- application.coffee
`-- static/

With this Guardfile:

guard 'coffeescript', input: '', output: 'static' do
  watch 'application.coffee'
end

Guard will output Successfully generated static/application.js when application.coffee is changed, but no file will be created.

This is due to the detect_nested_directories method using patterns.product(files) to generate output locations when :shallow is set to false (the default).

Perhaps this error message would be appropriate:

ArgumentError: Ambiguous output directory for application.js. Try setting :shallow to true.

support for cmd option

since coffeescript has an executable binary, it would be great to be able to customize how it is called (similar to guard-rspec). i want to have guard-coffeescript listed in my package.json as a dependency, however that doesn't mean it will be installed globally, and therefore not accessible in my $PATH. so to be able to run the binary included in my local project node_modules, and be able to run that, would be very helpful. something like...

guard :coffeescript, cmd: 'npm bin coffeescript' do
end

Multiple output directories?

Is it possible to support compiling to multiple directories? For example, one directory could be for the production javascript and another one for your spec tests.

no output files

When i run guard command, guard-less works, but guard-coffeescript doesn't work.
Any file is producced in output directory.
Any idea??

Here is my Guardfile:

guard 'less', :output => 'public/stylesheets' do
watch(%r{^app/assets/stylesheets/(.+.less)$})
end

guard 'coffeescript', :input => 'app/assets/coffeescripts', :output => 'public/javascripts'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.