Top Level Namespace
Defined Under Namespace
Classes: Beaver, CacheManager, Command, FileDep, FileInfo, Files, MultiFiles, SilentAll, SilentCommand, SilentOutput, SingleFile
Instance Method Summary collapse
-
#all(dep) ⇒ Object
Command will be called for all files at once.
-
#call(cmd) ⇒ Object
Call a command.
-
#changed?(cmd_ctx, file) ⇒ Boolean
Returns wether a file has changed Also returns true if no information about file changes is found.
- #cmd(name, deps = nil, &fn) ⇒ Object
-
#each(dep) ⇒ Object
Command will be called for each file.
-
#full_silent(strcmd) ⇒ Object
Do not print the command, or the output of the command.
- #must_run(cmd) ⇒ Object
-
#output_silent(strcmd) ⇒ Object
Do not print out the output of the command.
- #reset_cache ⇒ Object
-
#sh(strcmd) ⇒ Object
Execute shell command.
-
#silent(strcmd) ⇒ Object
Do not print the command.
Instance Method Details
#all(dep) ⇒ Object
Command will be called for all files at once
85 86 87 |
# File 'lib/file_dep.rb', line 85 def all(dep) return FileDep.new dep, :all end |
#call(cmd) ⇒ Object
Call a command
120 121 122 |
# File 'lib/beaver.rb', line 120 def call(cmd) $beaver.call cmd end |
#changed?(cmd_ctx, file) ⇒ Boolean
Returns wether a file has changed Also returns true if no information about file changes is found
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/file.rb', line 101 def changed? cmd_ctx, file cached_modified = $cache.files.modified cmd_ctx, file if cached_modified.nil? # probably new file return true end last_modified = File.mtime(file).to_i if cached_modified < last_modified return true else return false end end |
#cmd(name, deps = nil, &fn) ⇒ Object
97 98 99 100 |
# File 'lib/command.rb', line 97 def cmd(name, deps = nil, &fn) cmd = Command.new name.to_sym, deps, fn $beaver.__appendCommand cmd end |
#each(dep) ⇒ Object
Command will be called for each file
80 81 82 |
# File 'lib/file_dep.rb', line 80 def each(dep) return FileDep.new dep, :each end |
#full_silent(strcmd) ⇒ Object
Do not print the command, or the output of the command
53 54 55 |
# File 'lib/sh.rb', line 53 def full_silent(strcmd) return SilentAll.new(strcmd) end |
#must_run(cmd) ⇒ Object
124 125 126 |
# File 'lib/beaver.rb', line 124 def must_run(cmd) $beaver.musts_run cmd end |
#output_silent(strcmd) ⇒ Object
Do not print out the output of the command
58 59 60 |
# File 'lib/sh.rb', line 58 def output_silent(strcmd) return SilentOutput.new(strcmd) end |
#reset_cache ⇒ Object
90 91 92 93 |
# File 'lib/file.rb', line 90 def reset_cache $cache.files = Files.new(Hash.new) $cache.files.add("__BEAVER__CONFIG__", $PROGRAM_NAME) end |
#sh(strcmd) ⇒ Object
Execute shell command
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/sh.rb', line 4 def sh(strcmd) unless strcmd.is_a?(SilentCommand) || strcmd.is_a?(SilentAll) then if $beaver.term_256_color puts "\u001b[38;5;246m#{strcmd}\u001b[0m" else puts "\u001b[30;1m#{strcmd}\u001b[0m" end end if strcmd.is_a?(SilentAll) || strcmd.is_a?(SilentOutput) `#{strcmd}` else system "#{strcmd}" end if $beaver.has(:e) if $?.to_i != 0 if $?.exitstatus.nil? puts $? end exit($?.exitstatus || -1) end elsif $?.to_i != 0 && $?.exitstatus.nil? puts $? end end |
#silent(strcmd) ⇒ Object
Do not print the command
48 49 50 |
# File 'lib/sh.rb', line 48 def silent(strcmd) return SilentCommand.new(strcmd) end |