sake 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. data/Manifest.txt +2 -1
  2. data/README +4 -5
  3. data/lib/pastie.rb +31 -0
  4. data/lib/sake.rb +18 -5
  5. metadata +4 -3
@@ -1,7 +1,8 @@
1
1
  ./bin/sake
2
+ ./lib/help.rb
3
+ ./lib/pastie.rb
2
4
  ./lib/sake.rb
3
5
  ./lib/server.rb
4
- ./lib/help.rb
5
6
  ./Manifest.txt
6
7
  ./Rakefile
7
8
  ./README
data/README CHANGED
@@ -27,16 +27,14 @@ Install tasks from a Rakefile, optionally specifying specific tasks.
27
27
  Examine the source of a Rake task.
28
28
  $ sake -e routes
29
29
 
30
- Want to share just a few tasks, bundle them up?
31
- $ sake -e routes remigrate > my_tasks.rake
32
-
33
30
  You can also examine the source of a task not yet installed.
34
31
  $ sake -e Rakefile db:remigrate
35
32
 
36
- Uninstall an installed task.
33
+ Uninstall an installed task. (Can be passed one or more tasks.)
37
34
  $ sake -u db:remigrate
38
35
 
39
- Can be passed one or more tasks.
36
+ Post a task to Pastie!
37
+ $ sake -p routes
40
38
 
41
39
  Invoke a Sake task.
42
40
  $ sake <taskname>
@@ -69,6 +67,7 @@ You can also daemonize your server for long term serving fun.
69
67
  * Josh Susser
70
68
  * Brian Donovan
71
69
  * Zack Chandler
70
+ * Dr Nic Williams
72
71
 
73
72
  == Author
74
73
 
@@ -0,0 +1,31 @@
1
+ require 'tempfile'
2
+
3
+ class Pastie
4
+ PASTE_URL = ENV['SAKE_PASTIE_URL'] || ENV['PASTIE_URL'] || 'http://pastie.caboo.se/pastes/create'
5
+
6
+ def self.paste(text)
7
+ text_file = Tempfile.open('w+')
8
+ text_file << text
9
+ text_file.flush
10
+
11
+ cmd = <<-EOS
12
+ curl #{PASTE_URL} \
13
+ -s -L -o /dev/null -w "%{url_effective}" \
14
+ -H "Expect:" \
15
+ -F "paste[parser]=ruby" \
16
+ -F "paste[restricted]=0" \
17
+ -F "paste[authorization]=burger" \
18
+ -F "paste[body]=<#{text_file.path}" \
19
+ -F "key=" \
20
+ -F "x=27" \
21
+ -F "y=27"
22
+ EOS
23
+
24
+ out = %x{
25
+ #{cmd}
26
+ }
27
+
28
+ text_file.close(true)
29
+ out
30
+ end
31
+ end
@@ -14,6 +14,7 @@ rescue LoadError
14
14
  die "# Sake requires the ruby2ruby gem and Ruby 1.8.6."
15
15
  end
16
16
  require File.dirname(__FILE__) + '/help'
17
+ require File.dirname(__FILE__) + '/pastie'
17
18
 
18
19
  ##
19
20
  # Show all Sake tasks (but no local Rake tasks), optionally only those matching a pattern.
@@ -38,6 +39,10 @@ require File.dirname(__FILE__) + '/help'
38
39
  # Uninstall an installed task.
39
40
  # $ sake -u db:remigrate
40
41
  #
42
+ # Stores the source of a task into a pastie (http://pastie.caboo.se).
43
+ # Returns the url of the pastie to stdout.
44
+ # $ sake -p routes
45
+ #
41
46
  # Can be passed one or more tasks.
42
47
  #
43
48
  # Invoke a Sake task.
@@ -68,7 +73,7 @@ class Sake
68
73
  module Version
69
74
  Major = '1'
70
75
  Minor = '0'
71
- Tweak = '4'
76
+ Tweak = '5'
72
77
  String = [ Major, Minor, Tweak ].join('.')
73
78
  end
74
79
 
@@ -123,7 +128,15 @@ class Sake
123
128
  # $ sake -e routes
124
129
  # $ sake -e Rakefile db:remigrate
125
130
  elsif index = @args.index('-e')
126
- return examine(index)
131
+ die examine(index)
132
+
133
+ ##
134
+ # Save one or more tasks to Pastie (http://pastie.caboos.se)
135
+ # then return the new Pastie's url
136
+ # $ sake -p routes
137
+ # $ sake -p Rakefile db:remigrate
138
+ elsif index = @args.index('-p')
139
+ die Pastie.paste(examine(index))
127
140
 
128
141
  ##
129
142
  # Start a Mongrel handler which will serve local Rake tasks
@@ -213,20 +226,20 @@ class Sake
213
226
 
214
227
  # They didn't pass any args in, so just show the ~/.sake file
215
228
  unless task
216
- die Store.tasks.to_ruby
229
+ return Store.tasks.to_ruby
217
230
  end
218
231
 
219
232
  # Try to find the task we think they asked for.
220
233
  tasks = file ? TasksFile.parse(file).tasks : Store.tasks
221
234
 
222
235
  if tasks[task]
223
- die tasks[task].to_ruby
236
+ return tasks[task].to_ruby
224
237
  end
225
238
 
226
239
  # Didn't find the task. See if it's a file and, if so, spit
227
240
  # it out.
228
241
  unless (tasks = TasksFile.parse(task).tasks).empty?
229
- die tasks.to_ruby
242
+ return tasks.to_ruby
230
243
  end
231
244
 
232
245
  # Failure. On all counts.
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: sake
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.4
7
- date: 2007-06-25 00:00:00 -07:00
6
+ version: 1.0.5
7
+ date: 2007-06-26 00:00:00 -07:00
8
8
  summary: Sake tastes great and helps maintain system-level Rake files.
9
9
  require_paths:
10
10
  - lib
@@ -30,9 +30,10 @@ authors:
30
30
  - Chris Wanstrath
31
31
  files:
32
32
  - ./bin/sake
33
+ - ./lib/help.rb
34
+ - ./lib/pastie.rb
33
35
  - ./lib/sake.rb
34
36
  - ./lib/server.rb
35
- - ./lib/help.rb
36
37
  - ./Manifest.txt
37
38
  - ./Rakefile
38
39
  - ./README