sidekick 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,10 @@
1
+
2
+ module Sidekick::Helpers::Shell
3
+
4
+ def sh(cmd)
5
+ log cmd
6
+ puts result = `#{cmd}`
7
+ result
8
+ end
9
+
10
+ end
@@ -0,0 +1,12 @@
1
+
2
+ module Sidekick::Helpers::SidekickItself
3
+
4
+ def log(str)
5
+ puts ' -> ' + str
6
+ end
7
+
8
+ def stop(*prms)
9
+ ::Sidekick.stop(*prms)
10
+ end
11
+
12
+ end
@@ -0,0 +1,36 @@
1
+
2
+ require 'rbconfig'
3
+
4
+
5
+
6
+ module Sidekick::Helpers::System
7
+ def platform
8
+ {
9
+ :linux => /linux/,
10
+ :darwin => /darwin/,
11
+ :windows => /mswin|mingw|cygwin/
12
+ }.each do |platform, regex|
13
+ return platform if Config::CONFIG['host_os'] =~ regex
14
+ end; :other
15
+ end
16
+
17
+ def gem_load?(gemname)
18
+ begin
19
+ require gemname
20
+ true
21
+ rescue LoadError; false; end
22
+ end
23
+
24
+ def needs(gem_name, reason)
25
+ unless gem_load?(gem_name)
26
+ ::Sidekick.stop "You must install the #{gem_name} gem #{reason}."
27
+ end
28
+ end
29
+
30
+ def prefers(gem_name, reason)
31
+ unless gem_load?(gem_name)
32
+ log "Please install the #{gem_name} gem #{reason}."
33
+ end
34
+ end
35
+ end
36
+
@@ -0,0 +1,15 @@
1
+
2
+ module Sidekick::Helpers::Shell
3
+ def notify(message, title='Sidekick')
4
+
5
+ log "### #{title}: #{message}"
6
+ case platform
7
+ when :linux
8
+ needs 'libnotify', 'to display status messages on linux'
9
+ Libnotify.show :body => message, :summary => title
10
+ when :darwin
11
+ needs 'growl', 'to display status messages on a Mac.'
12
+ Growl.notify message, :title => title, :name => 'Sidekick'
13
+ end
14
+ end
15
+ end
@@ -1,13 +1,12 @@
1
1
 
2
2
 
3
- require 'em-dir-watcher'
4
-
5
-
6
3
  module Sidekick::Triggers
7
4
 
8
- # default triggers
5
+ extend ::Sidekick::Helpers
9
6
 
10
7
  register :watch do |callback, glob|
8
+ needs 'em-dir-watcher', 'to watch file changes'
9
+
11
10
  EMDirWatcher.watch(
12
11
  File.expand_path('.'),
13
12
  :include_only => [glob],
@@ -1,14 +1,12 @@
1
1
 
2
2
 
3
-
4
-
5
3
  stop "A new .sidekick file was generated -- now you just have to edit it."
6
4
 
7
5
 
8
6
  # now delete the above, and set up some actions.
9
7
  # here are some samples:
10
8
 
11
- # watch('**/*.rb') { restart_passenger }
9
+ # watch('**.rb') { restart_passenger }
12
10
  #
13
11
  # auto_compile 'assets/css/*.sass', 'public/css/:name.css'
14
12
  #
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 5
8
- - 1
9
- version: 0.5.1
7
+ - 6
8
+ - 0
9
+ version: 0.6.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jostein Berre Eliassen,
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-27 00:00:00 +02:00
17
+ date: 2010-10-31 00:00:00 +02:00
18
18
  default_executable: sidekick
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -68,18 +68,28 @@ extra_rdoc_files:
68
68
  files:
69
69
  - .document
70
70
  - .gitignore
71
+ - .gitmodules
71
72
  - .sidekick
72
73
  - LICENSE
73
74
  - README.textile
74
75
  - Rakefile
75
76
  - VERSION
77
+ - annotated/helpers.html
78
+ - annotated/index.html
79
+ - annotated/lib/sidekick.html
80
+ - annotated/sidekick.html
81
+ - annotated/triggers.html
82
+ - annotated/util.html
76
83
  - bin/sidekick
77
84
  - lib/sidekick.rb
78
- - lib/sidekick/helpers.rb
79
- - lib/sidekick/helpers/util.rb
85
+ - lib/sidekick/helpers/compile.rb
86
+ - lib/sidekick/helpers/passenger.rb
87
+ - lib/sidekick/helpers/shell.rb
88
+ - lib/sidekick/helpers/sidekick.rb
89
+ - lib/sidekick/helpers/system.rb
90
+ - lib/sidekick/helpers/user_interaction.rb
80
91
  - lib/sidekick/triggers.rb
81
92
  - lib/template
82
- - sidekick.gemspec
83
93
  - test/fixtures/page.haml
84
94
  - test/fixtures/site.coffee
85
95
  - test/fixtures/styles.sass
@@ -1,71 +0,0 @@
1
- require 'fileutils'
2
- require 'rbconfig'
3
- require 'tilt'
4
-
5
-
6
- # default helpers
7
-
8
- module Sidekick::Helpers
9
-
10
- # system
11
-
12
- require 'sidekick/helpers/util'
13
- include Util
14
-
15
- def log(str)
16
- puts ' -> ' + str
17
- end
18
-
19
- def stop(*prms)
20
- Sidekick.stop(*prms)
21
- end
22
-
23
- # notifications
24
-
25
- def notify(message, title='Sidekick')
26
-
27
- gems = {:linux => 'libnotify', :darwin => 'growl'}
28
-
29
- stop('Notifications not supported.') unless platform_load?(
30
- gems, 'notifications')
31
- case platform
32
- when :linux
33
- Libnotify.show :body => message, :summary => title
34
- when :darwin
35
- Growl.notify message, :title => title, :name => 'Sidekick'
36
- end
37
- end
38
-
39
- def sh(cmd)
40
- log cmd
41
- puts result = `#{cmd}`
42
- result
43
- end
44
-
45
- def restart_passenger
46
- FileUtils.touch './tmp/restart.txt'
47
- log 'restarted passenger'
48
- end
49
-
50
- # watches for changes matching the source glob,
51
- # compiles using the tilt gem, and saves to
52
- # target. Target is interpolated for :name
53
- def auto_compile(source, target)
54
- watch(source) do |files|
55
- files.each do |file|
56
- if File.exists?(file)
57
- begin
58
- t = target.gsub(':name', File.basename(file, '.*'))
59
- File.open(t, 'w') do |f|
60
- f.write(Tilt.new(file).render)
61
- end
62
- log "render #{file} => #{t}"
63
- rescue Exception => e
64
- notify "Error in #{file}:\n#{e}"
65
- end
66
- end
67
- end
68
- end
69
- end
70
-
71
- end
@@ -1,26 +0,0 @@
1
-
2
-
3
-
4
-
5
- module Util
6
- # :linux, :darwin, :other
7
- def platform
8
- [:linux, :darwin].each do |plf|
9
- return plf if Config::CONFIG['target_os'] =~ /#{plf}/i
10
- end; :other
11
- end
12
-
13
- def gem_load?(gemname, function='full')
14
- @installed ||= begin
15
- require gemname
16
- true
17
- rescue LoadError
18
- "Please gem install #{gemname} for #{function} support."
19
- ::Sidekick.stop
20
- end
21
- end
22
-
23
- def platform_load?(gems, function='full')
24
- gem_load?(gems[platform], function)
25
- end
26
- end
@@ -1,71 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{sidekick}
8
- s.version = "0.5.1"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Jostein Berre Eliassen,"]
12
- s.date = %q{2010-10-27}
13
- s.default_executable = %q{sidekick}
14
- s.description = %q{Automatically run common development tasks on events, as defined by a local .sidekick file. Easy, powerful DSL. Powered by EventMachine. Easy to extend.}
15
- s.email = %q{post@jostein.be}
16
- s.executables = ["sidekick"]
17
- s.extra_rdoc_files = [
18
- "LICENSE",
19
- "README.textile"
20
- ]
21
- s.files = [
22
- ".document",
23
- ".gitignore",
24
- ".sidekick",
25
- "LICENSE",
26
- "README.textile",
27
- "Rakefile",
28
- "VERSION",
29
- "bin/sidekick",
30
- "lib/sidekick.rb",
31
- "lib/sidekick/helpers.rb",
32
- "lib/sidekick/helpers/util.rb",
33
- "lib/sidekick/triggers.rb",
34
- "lib/template",
35
- "sidekick.gemspec",
36
- "test/fixtures/page.haml",
37
- "test/fixtures/site.coffee",
38
- "test/fixtures/styles.sass",
39
- "test/helper.rb",
40
- "test/test_sidekick.rb"
41
- ]
42
- s.homepage = %q{http://github.com/jbe/sidekick}
43
- s.rdoc_options = ["--charset=UTF-8"]
44
- s.require_paths = ["lib"]
45
- s.rubygems_version = %q{1.3.7}
46
- s.summary = %q{Automatically run common development tasks on events, as defined by a local .sidekick file.}
47
- s.test_files = [
48
- "test/helper.rb",
49
- "test/test_sidekick.rb"
50
- ]
51
-
52
- if s.respond_to? :specification_version then
53
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
54
- s.specification_version = 3
55
-
56
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
57
- s.add_runtime_dependency(%q<tilt>, [">= 1"])
58
- s.add_runtime_dependency(%q<eventmachine>, [">= 0"])
59
- s.add_runtime_dependency(%q<em-dir-watcher>, [">= 0"])
60
- else
61
- s.add_dependency(%q<tilt>, [">= 1"])
62
- s.add_dependency(%q<eventmachine>, [">= 0"])
63
- s.add_dependency(%q<em-dir-watcher>, [">= 0"])
64
- end
65
- else
66
- s.add_dependency(%q<tilt>, [">= 1"])
67
- s.add_dependency(%q<eventmachine>, [">= 0"])
68
- s.add_dependency(%q<em-dir-watcher>, [">= 0"])
69
- end
70
- end
71
-