guard-play 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README_zh.md +127 -0
- data/VERSION +1 -1
- data/guard-play.gemspec +5 -3
- data/lib/guard/play.rb +2 -2
- metadata +15 -13
data/README_zh.md
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
目标
|
2
|
+
===
|
3
|
+
|
4
|
+
Play单元测试是默认是通过浏览器执行的,在开发时需要不停的在IDE和浏览器之间切换,并点击按钮启动测试,十分不方便。
|
5
|
+
|
6
|
+
而Play auto-test提供了无界面运行测试的方法,但启动时间比较长。
|
7
|
+
|
8
|
+
Guard是ruby界一个文件变更触发框架,可以在指定的文件发生修改后,执行相关的命令。
|
9
|
+
|
10
|
+
为此,我实现了一个Play集成的Guard扩展: https://github.com/crazycode/guard-play
|
11
|
+
|
12
|
+
安装准备
|
13
|
+
======
|
14
|
+
|
15
|
+
Guard需要Ruby运行环境,并通过Bundler进行包管理,为此,需要确保安装有bundler包:
|
16
|
+
|
17
|
+
```bash
|
18
|
+
sudo gem install bundler
|
19
|
+
```
|
20
|
+
|
21
|
+
配置说明
|
22
|
+
======
|
23
|
+
|
24
|
+
在Play应用目录,建立Gemfile,用于管理需要的gems包,内容如下:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
source 'http://rubygems.org'
|
28
|
+
gem 'guard'
|
29
|
+
gem 'guard-play'
|
30
|
+
group :linux do
|
31
|
+
gem 'rb-inotify', require: nil
|
32
|
+
gem 'libnotify', require: nil
|
33
|
+
end
|
34
|
+
group :darwin do
|
35
|
+
gem 'rb-fsevent', require: nil
|
36
|
+
gem 'growl_notify', require: nil
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
同时,在reeb/trunk目录有Guardfile,定义了Guard规则,内容见最后附录,也不需要修改。
|
41
|
+
|
42
|
+
|
43
|
+
第一次运行需要执行以下命令
|
44
|
+
---------------------
|
45
|
+
|
46
|
+
对于Linux系统:
|
47
|
+
|
48
|
+
```bash
|
49
|
+
sudo bundle install --without darwin
|
50
|
+
```
|
51
|
+
|
52
|
+
对于Mac用户:
|
53
|
+
|
54
|
+
```bash
|
55
|
+
sudo bundle install --without linux
|
56
|
+
```
|
57
|
+
|
58
|
+
运行
|
59
|
+
===
|
60
|
+
|
61
|
+
运行以下命令,打开Guard监视:
|
62
|
+
|
63
|
+
```bash
|
64
|
+
bundle exec guard
|
65
|
+
```
|
66
|
+
guard会进入到每一个Play应用,执行play auto-test,然后静默在后台;在发生文件修改时,guard会运行对应项目的auto-test。
|
67
|
+
|
68
|
+
如果测试失败,桌面会出来提示信息
|
69
|
+
如果出现编译问题,会提示编译错
|
70
|
+
在修正上一次测试失败或编译问题时,会提示测试成功
|
71
|
+
其它情况下,测试都通过,不会有提示信息干扰你
|
72
|
+
请不要关闭Guard 让它一直在后台运行。
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
附录
|
77
|
+
---
|
78
|
+
|
79
|
+
单Play!项目Guardfile样例:
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
# More info at https://github.com/guard/guard#readme
|
83
|
+
interactor :readline
|
84
|
+
|
85
|
+
case RbConfig::CONFIG['host_os'].downcase
|
86
|
+
when /linux/
|
87
|
+
# notification :libnotify
|
88
|
+
notification :notifysend
|
89
|
+
when /darwin/
|
90
|
+
notification :growl_notify
|
91
|
+
end
|
92
|
+
|
93
|
+
guard 'play' do
|
94
|
+
watch(%r{^app/})
|
95
|
+
watch(%r{^conf/})
|
96
|
+
watch(%r{^test/})
|
97
|
+
end
|
98
|
+
````
|
99
|
+
|
100
|
+
多Play!项目Guardfile样例,把Guardfile放到所有子项目的上级目录中,通过app_path指定具体项目的路径:
|
101
|
+
|
102
|
+
```ruby
|
103
|
+
# More info at https://github.com/guard/guard#readme
|
104
|
+
interactor :readline
|
105
|
+
|
106
|
+
case RbConfig::CONFIG['host_os'].downcase
|
107
|
+
when /linux/
|
108
|
+
# notification :libnotify
|
109
|
+
notification :notifysend
|
110
|
+
when /darwin/
|
111
|
+
notification :growl_notify
|
112
|
+
end
|
113
|
+
|
114
|
+
guard 'play', app_path: "website/www" do
|
115
|
+
watch(%r{^website/www/app/})
|
116
|
+
watch(%r{^website/www/conf/})
|
117
|
+
watch(%r{^website/www/test/})
|
118
|
+
watch(%r{^module/})
|
119
|
+
end
|
120
|
+
|
121
|
+
guard 'play', app_path: "website/home" do
|
122
|
+
watch(%r{^website/home/app/})
|
123
|
+
watch(%r{^website/home/conf/})
|
124
|
+
watch(%r{^website/home/test/})
|
125
|
+
watch(%r{^module/})
|
126
|
+
end
|
127
|
+
````
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/guard-play.gemspec
CHANGED
@@ -5,16 +5,17 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "guard-play"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["crazycode"]
|
12
|
-
s.date = "2012-03-
|
12
|
+
s.date = "2012-03-22"
|
13
13
|
s.description = "guard helper for play! framework 1.x"
|
14
14
|
s.email = "crazycode@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE.txt",
|
17
|
-
"README.rdoc"
|
17
|
+
"README.rdoc",
|
18
|
+
"README_zh.md"
|
18
19
|
]
|
19
20
|
s.files = [
|
20
21
|
".document",
|
@@ -22,6 +23,7 @@ Gem::Specification.new do |s|
|
|
22
23
|
"Gemfile.lock",
|
23
24
|
"LICENSE.txt",
|
24
25
|
"README.rdoc",
|
26
|
+
"README_zh.md",
|
25
27
|
"Rakefile",
|
26
28
|
"VERSION",
|
27
29
|
"guard-play.gemspec",
|
data/lib/guard/play.rb
CHANGED
@@ -18,8 +18,8 @@ module Guard
|
|
18
18
|
@last_failed = false
|
19
19
|
@app_path = @options[:app_path]
|
20
20
|
@notify_title = @app_path.empty? ? "Play!" : "Play! on #{@app_path}"
|
21
|
-
@cmd_auto_test_deps = "
|
22
|
-
@cmd_auto_test = "play auto-test
|
21
|
+
@cmd_auto_test_deps = "cd #{@app_path}; play auto-test --deps; cd -"
|
22
|
+
@cmd_auto_test = "cd #{@app_path}; play auto-test; cd -"
|
23
23
|
end
|
24
24
|
|
25
25
|
# Call once when Guard starts. Please override initialize method to init stuff.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-play
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: shoulda
|
16
|
-
requirement: &
|
16
|
+
requirement: &18132840 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *18132840
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rdoc
|
27
|
-
requirement: &
|
27
|
+
requirement: &18131880 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '3.12'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *18131880
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &18130960 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.0.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *18130960
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: jeweler
|
49
|
-
requirement: &
|
49
|
+
requirement: &18129760 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.8.3
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *18129760
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: guard
|
60
|
-
requirement: &
|
60
|
+
requirement: &18128440 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *18128440
|
69
69
|
description: guard helper for play! framework 1.x
|
70
70
|
email: crazycode@gmail.com
|
71
71
|
executables: []
|
@@ -73,12 +73,14 @@ extensions: []
|
|
73
73
|
extra_rdoc_files:
|
74
74
|
- LICENSE.txt
|
75
75
|
- README.rdoc
|
76
|
+
- README_zh.md
|
76
77
|
files:
|
77
78
|
- .document
|
78
79
|
- Gemfile
|
79
80
|
- Gemfile.lock
|
80
81
|
- LICENSE.txt
|
81
82
|
- README.rdoc
|
83
|
+
- README_zh.md
|
82
84
|
- Rakefile
|
83
85
|
- VERSION
|
84
86
|
- guard-play.gemspec
|
@@ -101,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
103
|
version: '0'
|
102
104
|
segments:
|
103
105
|
- 0
|
104
|
-
hash:
|
106
|
+
hash: 3460943723590285304
|
105
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
108
|
none: false
|
107
109
|
requirements:
|