peony 0.1.6 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/recipes/php.rake CHANGED
@@ -5,26 +5,26 @@ set_default :fcgi_run_dir, ->{"#{run_dir}/fcgi"}
5
5
 
6
6
  namespace :php do
7
7
  namespace :fcgi do
8
- desc "Create fcgi running directory."
8
+ desc 'Create fcgi running directory.'
9
9
  task :init do
10
10
  mkdir_p("#{run_dir}/fcgi")
11
11
  end
12
12
 
13
- desc "Start fcgi."
13
+ desc 'Start fcgi.'
14
14
  task :start => :init do
15
15
  run "#{spawn_fcgi} -a 127.0.0.1 -p 6666 -C 6 -f #{php_cgi} -u #{user} -P #{fcgi_run_dir}/spawn_fcgi.pid > /dev/null"
16
16
  end
17
17
 
18
- desc "Kill fcgi."
18
+ desc 'Kill fcgi.'
19
19
  task :stop do
20
20
  run 'killall -9 php-fcgi > /dev/null 2>&1 || echo -n "not running"'
21
21
  end
22
22
 
23
- desc "Restart fcgi."
23
+ desc 'Restart fcgi.'
24
24
  task :restart => :stop do
25
- invoke "php:fcgi:stop"
25
+ invoke 'php:fcgi:stop'
26
26
  sleep(6)
27
- invoke "php:fcgi:start"
27
+ invoke 'php:fcgi:start'
28
28
  end
29
29
  end
30
30
  end
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+
3
+ describe Peony do
4
+ describe 'Shell' do
5
+ it 'should can print something with colors' do
6
+ peony do
7
+ say_status :success, 'say_status: Unintall it.', :green
8
+ say_status :failure, 'say_status: No premission', :red
9
+
10
+ print_in_columns %w{A BB CCC DDDD EEEEE FFFFFF GGGGGGG}
11
+
12
+ print_table [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
13
+
14
+ print_wrapped 'print_wrapped: I know you knew that.', indent: 16
15
+
16
+ say 'say: I know you knew that.', :yellow, false
17
+ say 'say: I know you knew that.', :blue, true
18
+
19
+ error 'error: I know you knew that.'
20
+ end
21
+ end
22
+ end
23
+
24
+ describe 'Actions' do
25
+ it 'should can run command' do
26
+ peony do
27
+ run "echo 'Hello World!'"
28
+ run 'ls -l'
29
+
30
+ inside 'lib/peony' do
31
+ run 'ls -l'
32
+ end
33
+
34
+ report_time do
35
+ inside 'lib/peony' do
36
+ run 'ls -la'
37
+ end
38
+ run 'ls -la'
39
+ end
40
+ end
41
+ end
42
+ end
43
+
44
+
45
+ end
@@ -2,38 +2,38 @@ require 'spec_helper'
2
2
 
3
3
  describe 'Settings in rake tasks' do
4
4
  it '#set should work' do
5
- rake { set :domain, 'localhost' }
5
+ peony { set :domain, 'localhost' }
6
6
 
7
- rake.domain.should == 'localhost'
8
- rake.settings.domain.should == 'localhost'
7
+ peony.domain.should == 'localhost'
8
+ peony.settings.domain.should == 'localhost'
9
9
  end
10
10
 
11
11
  it '#settings ||= should work' do
12
- rake {
12
+ peony {
13
13
  set :version, '2'
14
14
  settings.version ||= '3'
15
15
  }
16
16
 
17
- rake.settings.version.should == '2'
18
- rake.version.should == '2'
17
+ peony.settings.version.should == '2'
18
+ peony.version.should == '2'
19
19
  end
20
20
 
21
21
  it '#settings with lambdas should work' do
22
- rake {
22
+ peony {
23
23
  set :version, '42'
24
24
  set :path, lambda { "/var/www/#{version}" }
25
25
  }
26
26
 
27
- rake.path.should == "/var/www/42"
28
- rake.path?.should be_true
27
+ peony.path.should == '/var/www/42'
28
+ peony.settings.path?.should be_true
29
29
  end
30
30
 
31
31
  it '#settings with a bang should work' do
32
32
  expect {
33
- rake {
34
- set :path, lambda { "/var/www/#{version!}" }
33
+ peony {
34
+ set :path, lambda { "/var/www/#{settings.version!}" }
35
35
  }
36
- rake.path
36
+ peony.path
37
37
  }.to raise_error(Peony::Error, /version/)
38
38
  end
39
39
  end
@@ -11,7 +11,7 @@ describe Peony::Settings do
11
11
  end
12
12
 
13
13
  it 'setting proc should work' do
14
- @settings.email = ->{"zhiqiangzhan@gmail.com"}
14
+ @settings.email = ->{ 'zhiqiangzhan@gmail.com' }
15
15
  @settings.email.should == 'zhiqiangzhan@gmail.com'
16
16
  end
17
17
 
@@ -20,11 +20,11 @@ describe Peony::Settings do
20
20
  @settings.version = '3'
21
21
 
22
22
  @settings.path?.should be_true
23
- @settings.path.should == "/var/www/3"
23
+ @settings.path.should == '/var/www/3'
24
24
  end
25
25
 
26
26
  it 'setting block should work' do
27
- @settings.send(:email=){"zhiqiangzhan@gmail.com"}
27
+ @settings.send(:email=){ 'zhiqiangzhan@gmail.com' }
28
28
  @settings.email.should == 'zhiqiangzhan@gmail.com'
29
29
  end
30
30
 
data/spec/spec_helper.rb CHANGED
@@ -11,18 +11,18 @@ require 'bundler/setup'
11
11
  require 'rake'
12
12
  require 'peony'
13
13
 
14
-
15
- class RakeScope
14
+ class PeonyScope
16
15
  include Rake::DSL if Rake.const_defined?(:DSL)
17
16
  include Peony::Utils
17
+ include Peony::Shell
18
+ include Peony::Actions
18
19
  end
19
20
 
20
- def rake(&blk)
21
+ def peony(&blk)
21
22
  if block_given?
22
- @scope ||= RakeScope.new
23
+ @scope ||= PeonyScope.new
23
24
  @scope.instance_eval &blk
24
25
  end
25
-
26
26
  @scope
27
27
  end
28
28
 
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peony
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Zhan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-22 00:00:00.000000000 Z
11
+ date: 2014-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '10.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '10.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.3'
33
+ version: '1.5'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.3'
40
+ version: '1.5'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '2'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '2'
55
55
  description: Local Script Management System Using Rake
56
56
  email:
57
57
  - zhiqiangzhan@gmail.com
@@ -60,19 +60,27 @@ executables:
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - .gitignore
64
- - .rspec
63
+ - ".gitignore"
64
+ - ".rspec"
65
65
  - Gemfile
66
66
  - LICENSE.txt
67
67
  - README.md
68
68
  - Rakefile
69
69
  - bin/peony
70
70
  - lib/peony.rb
71
+ - lib/peony/actions.rb
71
72
  - lib/peony/application.rb
72
73
  - lib/peony/default.rb
74
+ - lib/peony/line_editor.rb
75
+ - lib/peony/line_editor/basic.rb
76
+ - lib/peony/line_editor/readline.rb
73
77
  - lib/peony/parse_arguments.rb
74
78
  - lib/peony/rake.rb
75
79
  - lib/peony/settings.rb
80
+ - lib/peony/shell.rb
81
+ - lib/peony/shell/basic.rb
82
+ - lib/peony/shell/color.rb
83
+ - lib/peony/shell/html.rb
76
84
  - lib/peony/utils.rb
77
85
  - lib/peony/version.rb
78
86
  - peony.gemspec
@@ -85,6 +93,7 @@ files:
85
93
  - recipes/nginx.rake
86
94
  - recipes/nginx/www.rake
87
95
  - recipes/php.rake
96
+ - spec/peony_spec.rb
88
97
  - spec/settings_in_rake_spec.rb
89
98
  - spec/settings_spec.rb
90
99
  - spec/spec_helper.rb
@@ -131,22 +140,22 @@ require_paths:
131
140
  - lib
132
141
  required_ruby_version: !ruby/object:Gem::Requirement
133
142
  requirements:
134
- - - '>='
143
+ - - ">="
135
144
  - !ruby/object:Gem::Version
136
145
  version: '0'
137
146
  required_rubygems_version: !ruby/object:Gem::Requirement
138
147
  requirements:
139
- - - '>='
148
+ - - ">="
140
149
  - !ruby/object:Gem::Version
141
150
  version: '0'
142
151
  requirements: []
143
152
  rubyforge_project:
144
- rubygems_version: 2.0.6
153
+ rubygems_version: 2.2.2
145
154
  signing_key:
146
155
  specification_version: 4
147
156
  summary: Local Script Management System Using Rake.
148
157
  test_files:
158
+ - spec/peony_spec.rb
149
159
  - spec/settings_in_rake_spec.rb
150
160
  - spec/settings_spec.rb
151
161
  - spec/spec_helper.rb
152
- has_rdoc: