fezzik 0.2.0 → 0.3.0

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 (6) hide show
  1. data/README.md +13 -3
  2. data/bin/fez +40 -1
  3. data/bin/fezify +1 -1
  4. data/fezzik.gemspec +1 -1
  5. data/lib/fezzik.rb +2 -5
  6. metadata +4 -4
data/README.md CHANGED
@@ -15,9 +15,9 @@ and gets out of your way.
15
15
  $ ls
16
16
  server.rb
17
17
  $ fezify
18
- [new] bin/run_app.sh created
19
- [new] config/recipes/core.rb created
20
- [new] config/deploy.rb created
18
+ [new] bin/run_app.sh created
19
+ [new] config/recipes/core.rb created
20
+ [new] config/deploy.rb created
21
21
  [done]
22
22
 
23
23
  **config/deploy.rb**: set your app name and destination servers
@@ -54,3 +54,13 @@ Use this function if you would like to hide or capture the normal output that th
54
54
  # prints "hello"
55
55
  puts server_output
56
56
  end
57
+
58
+ ## Recipes
59
+
60
+ Fezzik uses a recipe system similar to Capistrano. Any recipe placed in your config/recipes directory will be
61
+ picked up and available to the fez command. Some useful recipes that are not part of the fezzik core can be
62
+ found in the fezzik project recipes directory. You can download them with fezzik:
63
+
64
+ fez get <recipes>
65
+
66
+ If you write a recipe that would be useful to other developers, please submit a pull request!
data/bin/fez CHANGED
@@ -9,5 +9,44 @@ require "colorize"
9
9
  # Include everything in config/recipes
10
10
  Dir[File.join(Dir.pwd, 'config/recipes/**/*.rb')].sort.each { |lib| require lib }
11
11
 
12
- Rake.application["fezzik:run"].invoke
12
+ def usage
13
+ <<-EOF
14
+ fez <destination> <tasks> # Run deployment tasks on destination servers
15
+ fez get <recipes> # Download recipes to use in your project
16
+ fez -T # Display all tasks
17
+ EOF
18
+ end
19
+
20
+ def display_tasks_and_exit
21
+ Rake.application.options.show_task_pattern = //
22
+ output = capture_output { Rake.application.display_tasks_and_comments }
23
+ output.gsub!(/^rake fezzik:/, "fez <destination> ")
24
+ puts output
25
+ exit 0
26
+ end
27
+
28
+ RECIPE_URL = "https://github.com/dmacdougall/fezzik/raw/master/recipes"
29
+ def download_recipes_and_exit
30
+ system("mkdir -p config/recipes")
31
+ ARGV[1..-1].each do |recipe|
32
+ recipe += ".rb" unless recipe[-3..-1] == ".rb"
33
+ system("curl -f #{RECIPE_URL}/#{recipe} -o config/recipes/#{recipe} > /dev/null 2>&1")
34
+ if $? == 0
35
+ puts " [new]".green + " config/recipes/#{recipe}"
36
+ else
37
+ puts " [fail]".red + " config/recipes/#{recipe}"
38
+ end
39
+ end
40
+ exit 0
41
+ end
13
42
 
43
+ if ARGV.size == 0
44
+ puts usage
45
+ exit 1
46
+ elsif ARGV[0] == "-T"
47
+ display_tasks_and_exit
48
+ elsif ARGV[0] == "get"
49
+ download_recipes_and_exit
50
+ end
51
+
52
+ Rake.application["fezzik:run"].invoke
data/bin/fezify CHANGED
@@ -132,7 +132,7 @@ files.each do |filename, content|
132
132
  if File.exists?(filename) && ARGV[0] != "-f"
133
133
  puts " [skip] #{filename} already exists"
134
134
  else
135
- puts " [new] #{filename} created".green
135
+ puts " [new] #{filename} created".green
136
136
  File.open(filename, "w") { |file| file.write(content) }
137
137
  if filename == "bin/run_app.sh"
138
138
  system("chmod a+x bin/run_app.sh")
data/fezzik.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "fezzik"
3
- s.version = "0.2.0"
3
+ s.version = "0.3.0"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">=0") if s.respond_to? :required_rubygems_version=
6
6
  s.specification_version = 2 if s.respond_to? :specification_version=
data/lib/fezzik.rb CHANGED
@@ -1,9 +1,5 @@
1
1
  namespace :fezzik do
2
2
  task :run do
3
- if ARGV.size == 0
4
- puts " Usage: fez to_destination task"
5
- exit 1
6
- end
7
3
  destination = ARGV[0]
8
4
  destination = $1 if destination.match(/to_(.+)/)
9
5
  tasks = ARGV[1..-1]
@@ -45,7 +41,8 @@ namespace :fezzik do
45
41
  output = StringIO.new
46
42
  $stdout = output
47
43
  block.call
44
+ return output.string
45
+ ensure
48
46
  $stdout = STDOUT
49
- output.string
50
47
  end
51
48
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fezzik
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 0.2.0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Daniel MacDougall
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-25 00:00:00 -07:00
18
+ date: 2011-06-01 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency