Permalink
Browse files

Removed autoexport option; Guard is now the preferred way.

The generator creates a Guardfile example.
  • Loading branch information...
1 parent b5abf41 commit 8466eb34890a4cce38972078971fc3fcbd477cab @fnando committed Oct 16, 2012
Showing with 26 additions and 27 deletions.
  1. +7 −4 Gemfile.lock
  2. +0 −2 kitabu.gemspec
  3. +2 −1 lib/kitabu.rb
  4. +0 −1 lib/kitabu/cli.rb
  5. +1 −19 lib/kitabu/exporter.rb
  6. +4 −0 lib/kitabu/generator.rb
  7. +4 −0 spec/support/shared.rb
  8. +8 −0 templates/Guardfile
View
@@ -6,12 +6,12 @@ PATH
activesupport
coderay
eeepub-with-cover-support
+ guard
i18n
nokogiri
notifier
rdiscount
thor
- watchr
GEM
remote: http://rubygems.org/
@@ -21,13 +21,17 @@ GEM
i18n (~> 0.6)
multi_json (~> 1.0)
awesome_print (1.0.2)
- builder (3.0.0)
+ builder (3.1.3)
coderay (1.0.7)
diff-lcs (1.1.3)
eeepub-with-cover-support (0.8.7)
builder
rubyzip
- i18n (0.6.0)
+ guard (1.4.0)
+ listen (>= 0.4.2)
+ thor (>= 0.14.6)
+ i18n (0.6.1)
+ listen (0.5.3)
method_source (0.8)
multi_json (1.3.6)
nokogiri (1.5.5)
@@ -53,7 +57,6 @@ GEM
test_notifier (1.0.0)
notifier
thor (0.16.0)
- watchr (0.7)
PLATFORMS
ruby
View
@@ -26,8 +26,6 @@ Gem::Specification.new do |s|
s.add_dependency "i18n"
s.add_dependency "thor"
s.add_dependency "eeepub-with-cover-support"
- s.add_dependency "watchr"
- s.add_dependency "notifier"
s.add_dependency "coderay"
s.add_development_dependency "rspec"
View
@@ -10,9 +10,10 @@
require "ostruct"
require "RedCloth"
require "tempfile"
+require "pathname"
require "thor"
require "thor/group"
-require "watchr"
+require "listen"
require "yaml"
require "cgi"
View
@@ -26,7 +26,6 @@ def new(path)
desc "export [OPTIONS]", "Export e-book"
method_option :only, :type => :string, :desc => "Can be one of: #{FORMATS.join(", ")}"
- method_option :auto, :type => :boolean, :desc => "Watch changes and automatically export files"
method_option :open, :type => :boolean, :desc => "Automatically open PDF (Mac OS X only)"
def export
View
@@ -2,13 +2,7 @@ module Kitabu
class Exporter
def self.run(root_dir, options)
exporter = new(root_dir, options)
-
- if options[:auto]
- exporter.export!
- exporter.auto! if options[:auto]
- else
- exporter.export!
- end
+ exporter.export!
end
attr_accessor :root_dir
@@ -64,17 +58,5 @@ def export!
def config
Kitabu.config(root_dir)
end
-
- def auto!
- script = Watchr::Script.new
-
- script.watch(%r[(code|config|images|templates|text)/.*]) do |match|
- ui.say "* #{match[0]}... ", :yellow, false
- export!
- end
-
- contrl = Watchr::Controller.new(script, Watchr.handler.new)
- contrl.run
- end
end
end
View
@@ -59,6 +59,10 @@ def create_git_files
create_file "code/.gitkeep"
end
+ def copy_guardfile
+ copy_file "Guardfile", "Guardfile"
+ end
+
private
# Retrieve user's name using finger.
# Defaults to <tt>John Doe</tt>.
View
@@ -33,6 +33,10 @@
mybook.join("text/01_Welcome.md")
end
+ it "copies Guardfile" do
+ mybook.join("Guardfile")
+ end
+
it "copies html template files" do
mybook.join("templates/html/user.css").should be_file
mybook.join("templates/html/layout.css").should be_file
View
@@ -0,0 +1,8 @@
+notification :off
+interactor :off
+
+guard :shell do
+ watch %r[^(?!output)] do |m|
+ `kitabu export`
+ end
+end

0 comments on commit 8466eb3

Please sign in to comment.