dev_commands 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/command.rb +4 -3
- data/lib/dev_commands.rb +2 -1
- data/lib/text.rb +14 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 387fefe39cf6b1995bf4fc7f148383a7dff9d1df
|
4
|
+
data.tar.gz: fb17b16fa43b70947b40b45ea79e0179b89770c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b88dc36d380987a06144aebc8e79aa5e87ab062ee53355c436019216e825a31af5f5c7d9df6edeba397679aa3a67f39a4097e35041d0d0c9a6c0b54c830dd7d9
|
7
|
+
data.tar.gz: 992e094f9357b76d3b25d425d848da9bb08f3d3ca5d4826be3d8d12a46994477d1ecfea2b328afa9ff285f9128d66eb8535a4535d564748e1229abd574b15ffb
|
data/lib/command.rb
CHANGED
@@ -41,11 +41,12 @@ class Command < Hash
|
|
41
41
|
ruby = self[:input].gsub("<%","").gsub("%>","")
|
42
42
|
|
43
43
|
begin
|
44
|
-
puts "eval(#{ruby})"
|
44
|
+
#puts "eval(#{ruby})"
|
45
45
|
self[:output]=eval(ruby)
|
46
46
|
rescue
|
47
|
-
puts "unable to eval(#{ruby})"
|
48
|
-
raise "unable to eval(#{ruby})"
|
47
|
+
#puts "unable to eval(#{ruby})"
|
48
|
+
#raise "unable to eval(#{ruby})"
|
49
|
+
self[:error]="unable to eval(#{ruby})"
|
49
50
|
end
|
50
51
|
|
51
52
|
self[:elapsed] = timer.elapsed_str
|
data/lib/dev_commands.rb
CHANGED
data/lib/text.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
class Text
|
2
|
+
def self.replace_in_glob(glob,search,replace)
|
3
|
+
Dir.glob(glob).each{ |f| replace_text_in_file(f,search,replace) }
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.replace_in_file(filename,search,replace)
|
7
|
+
text1 = File.read(filename)
|
8
|
+
text2 = text1.gsub(search) { |str| str=replace }
|
9
|
+
unless text1==text2
|
10
|
+
File.open(filename,"w") { |f| f.puts text2 }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dev_commands
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lou Parslow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- lib/command.rb
|
77
77
|
- lib/dev_commands.rb
|
78
78
|
- lib/hash.rb
|
79
|
+
- lib/text.rb
|
79
80
|
- lib/timer.rb
|
80
81
|
- spec/command_spec.rb
|
81
82
|
- LICENSE
|