peony 0.1.2 → 0.1.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a2f2690dc7f3f57027f444f0dfe0350126e6c8fe
4
- data.tar.gz: 4c900dfe23657197d6c40d7a133b2820d09d051a
3
+ metadata.gz: 16e0e1fcade7821bc142d98e215ccb6d43c9eed9
4
+ data.tar.gz: 785136aaae5e9f7d0171b2a28e80c38efa0fb60d
5
5
  SHA512:
6
- metadata.gz: 0d5630993d11566de692e044066864dbc5ecfdcf01696b477d1dd8158d078f769c1699be21af9f43f9274b0306cd8178ef150bc704c2869ecb8d59a117266880
7
- data.tar.gz: b171294b70532269cb07bca37bb33c04e0ea344aa25b07ae61bafed68ab553e5312388267024ebafce4042a64894c87fb88606622e71f8db51f7a2e070bd983b
6
+ metadata.gz: 6e635b053ed9a7690aee9a2d1cec7abdac7170cad29064901e4bf5692dec2405db38a0a6308d0f2defeee1cc9d4e2cc86e81ce31bb1f9dc57028a6a6563e7db2
7
+ data.tar.gz: f5aa7e55ee1d3c7497c5845446e654f8d15f6fffe08a4a801b83d7f6554ec155e92eabdfe01f1c912305452b6955fe27b832b668d193d6aaeb85bb9fe6f803fb
data/README.md CHANGED
@@ -18,17 +18,44 @@ Or install it yourself as:
18
18
  $ gem install peony
19
19
 
20
20
  ## Usage
21
+
22
+ ### Simple Example
21
23
  Peony inherits from Rake, and added many useful methods for you to write rake scripts.
22
24
 
25
+ ~~~ruby
26
+
27
+ set :from, "Jack"
28
+ set :to, "Tom"
29
+
30
+ namespace :hello do
31
+ task :run do
32
+ run "echo '#{from} say hello to #{to}.'"
33
+ end
34
+ end
35
+ ~~~
36
+
37
+ peony hello:run
38
+ #Jack say hello to Tom
39
+ peony hello:run from=James
40
+ #James say hello to Tom
41
+
42
+
43
+
44
+
45
+ ## Useful recipes
23
46
  If you want to run nginx server on your local server, you can add the following to your Rakefile
24
-
25
- set :base_dir, "/u"
26
- set_default :www_http_port, 80
47
+
48
+ ~~~ruby
49
+
50
+ set :base_dir, "/u"
51
+ set :www_http_port, 80
27
52
  set :www_paths, {
28
53
  "/homebrew" => "/Library/Caches/Homebrew"
29
54
  }
30
55
  set :nginx, "/usr/local/bin/nginx"
31
56
 
57
+ ~~~
58
+
32
59
  Execute the following commands
33
60
 
34
61
  peony nginx:init
@@ -51,6 +78,11 @@ you can just add the following code to your Rakefile
51
78
  end
52
79
 
53
80
 
81
+
82
+
83
+
84
+
85
+
54
86
  ## Directory Convension
55
87
  <pre>
56
88
 
data/bin/peony CHANGED
@@ -2,8 +2,8 @@
2
2
  $:.unshift File.expand_path('../../lib', __FILE__)
3
3
 
4
4
  require 'rubygems' unless Object.const_defined?(:Gem)
5
- require 'peony'
6
5
  require 'rake'
6
+ require 'peony'
7
7
 
8
8
  # Intercept: if invoked as 'peony --help', don't let it pass through Rake, or else
9
9
  # we'll see the Rake help screen. Redirect it to 'peony help'.
@@ -12,7 +12,7 @@ if ARGV.delete('--help') || ARGV.delete('-h')
12
12
  end
13
13
 
14
14
  if ARGV.delete('--version') || ARGV.delete('-V')
15
- puts "Peony, version v#{Peony.version}"
15
+ puts "Peony, version v#{Peony::Version}"
16
16
  exit
17
17
  end
18
18
 
@@ -31,12 +31,13 @@ Rake.application.instance_eval do
31
31
  # Load the Peony DSL.
32
32
  require 'peony/rake'
33
33
 
34
- load_rakefile if have_rakefile
34
+ load_rakefile
35
35
 
36
36
  Dir.glob(File.expand_path("../recipes/**/*.rake", __dir__)) do|fn|
37
37
  load fn
38
38
  end
39
39
 
40
+ require 'peony/parse_arguments'
40
41
  top_level
41
42
  end
42
43
  end
@@ -0,0 +1,20 @@
1
+ module Rake
2
+ class Application
3
+ alias_method :origin_find_rakefile_location, :find_rakefile_location
4
+ def find_rakefile_location
5
+ ret = origin_find_rakefile_location
6
+ unless ret
7
+ if ENV["peony_root"]
8
+ Dir.chdir(ENV["peony_root"])
9
+ if fn = have_rakefile
10
+ ret = [fn, Dir.pwd]
11
+ end
12
+ end
13
+ end
14
+ ret
15
+ ensure
16
+ Dir.chdir(Rake.original_dir)
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1 @@
1
+ parse_args
data/lib/peony/rake.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  extend Peony::Utils
2
2
 
3
- require 'peony/default'
3
+ require "peony/default"
data/lib/peony/utils.rb CHANGED
@@ -1,5 +1,11 @@
1
1
  module Peony
2
2
  module Utils
3
+
4
+ def parse_args
5
+ ARGV.each do|arg|
6
+ set $1.strip.to_sym, $2 if arg =~ /([^=]+)=(.+)/
7
+ end
8
+ end
3
9
 
4
10
  def sudo(cmd, &block)
5
11
  run "sudo #{cmd}", &block
data/lib/peony/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Peony
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.6"
3
3
  end
data/lib/peony.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "peony/version"
2
+ require "peony/application"
2
3
 
3
4
  module Peony
4
5
  PREFIX = File.dirname(__FILE__)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peony
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Zhan
@@ -68,7 +68,9 @@ files:
68
68
  - Rakefile
69
69
  - bin/peony
70
70
  - lib/peony.rb
71
+ - lib/peony/application.rb
71
72
  - lib/peony/default.rb
73
+ - lib/peony/parse_arguments.rb
72
74
  - lib/peony/rake.rb
73
75
  - lib/peony/settings.rb
74
76
  - lib/peony/utils.rb