dev_tasks 1.0.9 → 1.0.10
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 +4 -4
- data/lib/command.rb +18 -10
- data/lib/spec.json +1 -1
- data/spec/command_spec.rb +9 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 835ddd4c63c02ff79d9151c8752782c6076f912f
|
4
|
+
data.tar.gz: 23ebff2cd260f5b3f802975e5406df6364358dca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fce902f51422665d96733862dca900279c0d66a7aff56ca79324e0d76cfa1198bdb6c36db917456ef99cdfca23ba1e29a0ead57c68689f18a1988ee58236cdb
|
7
|
+
data.tar.gz: ba4752504b3ac38e38301b62510532885600efbd9bb7093175032e778d915835b5ed236c5915f364e67e72a8b8fae1cda1875adf4ea4d05bcb7853a26eec9f56
|
data/lib/command.rb
CHANGED
@@ -1,16 +1,24 @@
|
|
1
1
|
class Command < Hash
|
2
2
|
def initialize command
|
3
|
-
self[:input] = command
|
4
|
-
self[:timeout] = 0
|
5
|
-
self[:directory] = ''
|
6
|
-
self[:exit_code] = 0
|
7
|
-
self[:output] = ''
|
8
|
-
self[:error] = ''
|
9
|
-
self[:machine_name] = ''
|
10
|
-
self[:user_name] = ''
|
11
|
-
self[:start_time] = nil
|
12
|
-
self[:end_time] = nil
|
13
3
|
|
4
|
+
if(command.kind_of?(String))
|
5
|
+
self[:input] = command
|
6
|
+
self[:timeout] = 0
|
7
|
+
self[:directory] = ''
|
8
|
+
self[:exit_code] = 0
|
9
|
+
self[:output] = ''
|
10
|
+
self[:error] = ''
|
11
|
+
self[:machine_name] = ''
|
12
|
+
self[:user_name] = ''
|
13
|
+
self[:start_time] = nil
|
14
|
+
self[:end_time] = nil
|
15
|
+
end
|
16
|
+
|
17
|
+
if(command.kind_of?(Hash))
|
18
|
+
command.each{|k,v|
|
19
|
+
self[k.to_sym]=v
|
20
|
+
}
|
21
|
+
end
|
14
22
|
end
|
15
23
|
|
16
24
|
def execute
|
data/lib/spec.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"name":"dev_tasks","version":"1.0.
|
1
|
+
{"name":"dev_tasks","version":"1.0.10"}
|
data/spec/command_spec.rb
CHANGED
@@ -55,6 +55,15 @@ describe Command do
|
|
55
55
|
|
56
56
|
end
|
57
57
|
|
58
|
+
it "should be able to write to/load from JSON" do
|
59
|
+
cmd=Command.new("ruby --version")
|
60
|
+
expect(cmd[:timeout]).to eq(0)
|
61
|
+
expect(cmd[:input]).to eq("ruby --version")
|
62
|
+
cmd2=Command.new(JSON.parse(cmd.to_json))
|
63
|
+
expect(cmd2[:timeout]).to eq(0)
|
64
|
+
expect(cmd2[:input]).to eq("ruby --version")
|
65
|
+
end
|
66
|
+
|
58
67
|
it "should be able to execute rake command in specific directory" do
|
59
68
|
dir="#{DEV[:dev_root]}/tmp/rake_test"
|
60
69
|
FileUtils.mkdir_p(dir) if(!File.exists?(dir))
|