taskr 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.2.1 :: 2008-02-28
2
+
3
+ * Updated for compatibility with picnic 0.6.1.
4
+
1
5
  === 0.2.0 :: 2008-01-03
2
6
 
3
7
  * Added Taskr4rails action and accompanying Rails plugin for
@@ -6,6 +10,9 @@
6
10
  details.
7
11
  * The Howlr action now takes an optional content_type parameter
8
12
  to allow for sending out HTML-formatted messages.
13
+ * Better error reporting for Restr-based actions. The remote server's
14
+ response body is now included in Taskr's error report and the
15
+ remote output is printed to the log more cleanly.
9
16
  * Change to REST API: the 'action(s)' parameter is now a bit looser.
10
17
  You can use 'action' or 'actions' interchangeably, whether you're
11
18
  scheduling multiple actions or just one.
data/Rakefile CHANGED
@@ -53,6 +53,10 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
53
53
  #p.extra_deps - An array of rubygem dependencies.
54
54
  #p.spec_extras - A hash of extra values to set in the gemspec.
55
55
 
56
- p.extra_deps = ['picnic', ['reststop', '~>0.2.0'], 'openwferu-scheduler']
56
+ p.extra_deps = [
57
+ ['picnic', '~>0.6.1'],
58
+ ['reststop', '~>0.2.0'],
59
+ 'openwferu-scheduler'
60
+ ]
57
61
  p.spec_extras = {:executables => ['taskr', 'taskr-ctl']}
58
62
  end
data/lib/taskr.rb CHANGED
@@ -39,10 +39,24 @@ require 'taskr/controllers'
39
39
 
40
40
  module Taskr
41
41
  include Taskr::Models
42
+
43
+ def self.authenticate(credentials)
44
+ credentials[:username] == Taskr::Conf[:authentication][:username] &&
45
+ credentials[:password] == Taskr::Conf[:authentication][:password]
46
+ end
42
47
  end
43
48
 
44
49
  include Taskr::Models
45
50
 
51
+ if Taskr::Conf[:authentication]
52
+ Taskr.authenticate_using(Taskr::Conf[:authentication][:method] || :basic)
53
+ end
54
+
55
+ $CONF[:public_dir] = {
56
+ :path => "public",
57
+ :dir => File.join(File.expand_path(File.dirname(__FILE__)),"public")
58
+ }
59
+
46
60
  def Taskr.create
47
61
  $LOG.info "Initializing Taskr..."
48
62
  Taskr::Models::Base.establish_connection(Taskr::Conf.database)
@@ -130,6 +130,7 @@ module Taskr::Controllers
130
130
 
131
131
  unless @task.valid?
132
132
  @status = 500
133
+ @actions = Taskr::Actions.list
133
134
  return render(:new_task)
134
135
  end
135
136
 
@@ -39,7 +39,7 @@ unless Object.method_defined? :gem
39
39
  alias gem require_gem
40
40
  end
41
41
 
42
- require 'picnic.rb'
42
+ require 'picnic'
43
43
  require 'camping/db'
44
44
 
45
45
  require 'reststop'
data/lib/taskr/version.rb CHANGED
@@ -2,7 +2,7 @@ module Taskr #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -35,17 +35,24 @@ class Taskr4railsController < ActionController::Base
35
35
  return false
36
36
  end
37
37
 
38
- out = ""
38
+ io = StringIO.new
39
+ prev_stdout, prev_stderr = $stdout, $stderr
40
+ output = ""
41
+ $stdout = io
42
+ $stderr = io
39
43
  begin
40
- out << (eval(params[:ruby_code]) || "") if params[:ruby_code]
41
- out << (`cd #{RAILS_ROOT}; #{params[:shell_command]}` || "") if params[:shell_command]
44
+ eval(params[:ruby_code]) if params[:ruby_code]
45
+ #output << (`cd #{RAILS_ROOT}; #{params[:shell_command]}` || "") if params[:shell_command]
42
46
  err = false
43
47
  rescue => e
44
- out << e
48
+ output << "#{e.class}: #{e}\n\nBACKTRACE:\n#{e.backtrace.join("\n")}"
45
49
  err = true
46
50
  end
51
+ $stdout = prev_stdout
52
+ $stderr = prev_stderr
53
+ output = io.read(nil)
47
54
 
48
- render :text => out, :status => (err ? 500 : 200)
55
+ render :text => output, :status => (err ? 500 : 200)
49
56
  end
50
57
 
51
58
  end
metadata CHANGED
@@ -1,33 +1,58 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.2
3
- specification_version: 1
4
2
  name: taskr
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.2.0
7
- date: 2008-01-03 00:00:00 -05:00
8
- summary: description of gem
9
- require_paths:
10
- - lib
11
- email: your contact email for bug fixes and info
12
- homepage: http://taskr.rubyforge.org
13
- rubyforge_project: taskr
14
- description: description of gem
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 0.2.1
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - URBACONmzukowski
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-02-28 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: picnic
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 0.6.1
23
+ version:
24
+ - !ruby/object:Gem::Dependency
25
+ name: reststop
26
+ version_requirement:
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ version: 0.2.0
32
+ version:
33
+ - !ruby/object:Gem::Dependency
34
+ name: openwferu-scheduler
35
+ version_requirement:
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: "0"
41
+ version:
42
+ description: description of gem
43
+ email: your contact email for bug fixes and info
44
+ executables:
45
+ - taskr
46
+ - taskr-ctl
47
+ extensions: []
48
+
49
+ extra_rdoc_files:
50
+ - CHANGELOG.txt
51
+ - GPLv3-LICENSE.txt
52
+ - History.txt
53
+ - Manifest.txt
54
+ - README.txt
55
+ - taskr4rails/LICENSE.txt
31
56
  files:
32
57
  - CHANGELOG.txt
33
58
  - GPLv3-LICENSE.txt
@@ -63,50 +88,32 @@ files:
63
88
  - test.rb
64
89
  - test/taskr_test.rb
65
90
  - test/test_helper.rb
66
- test_files:
67
- - test/taskr_test.rb
91
+ has_rdoc: true
92
+ homepage: http://taskr.rubyforge.org
93
+ post_install_message:
68
94
  rdoc_options:
69
95
  - --main
70
96
  - README.txt
71
- extra_rdoc_files:
72
- - CHANGELOG.txt
73
- - GPLv3-LICENSE.txt
74
- - History.txt
75
- - Manifest.txt
76
- - README.txt
77
- - taskr4rails/LICENSE.txt
78
- executables:
79
- - taskr
80
- - taskr-ctl
81
- extensions: []
82
-
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: "0"
104
+ version:
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: "0"
110
+ version:
83
111
  requirements: []
84
112
 
85
- dependencies:
86
- - !ruby/object:Gem::Dependency
87
- name: picnic
88
- version_requirement:
89
- version_requirements: !ruby/object:Gem::Version::Requirement
90
- requirements:
91
- - - ">"
92
- - !ruby/object:Gem::Version
93
- version: 0.0.0
94
- version:
95
- - !ruby/object:Gem::Dependency
96
- name: reststop
97
- version_requirement:
98
- version_requirements: !ruby/object:Gem::Version::Requirement
99
- requirements:
100
- - - ~>
101
- - !ruby/object:Gem::Version
102
- version: 0.2.0
103
- version:
104
- - !ruby/object:Gem::Dependency
105
- name: openwferu-scheduler
106
- version_requirement:
107
- version_requirements: !ruby/object:Gem::Version::Requirement
108
- requirements:
109
- - - ">"
110
- - !ruby/object:Gem::Version
111
- version: 0.0.0
112
- version:
113
+ rubyforge_project: taskr
114
+ rubygems_version: 1.0.1
115
+ signing_key:
116
+ specification_version: 2
117
+ summary: description of gem
118
+ test_files:
119
+ - test/taskr_test.rb