dev_commands 0.0.54 → 0.0.55

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fc34a8eec50eb7c362bdf92aaecec5cadb551980
4
+ data.tar.gz: 8d9e71410c9b1cfaccfbe2fa866385a222395ade
5
+ SHA512:
6
+ metadata.gz: 591448377487e2e3deaa2aa8ea37251fc0f7386aff8ab0aacaef8cd61374af3e6b07730d69b661add3c1704d05be48d1c1553e2ddb980801669e706ca6e84aaf
7
+ data.tar.gz: 3dbb378b987ba3b175c16b6b697d275ed1e6e7fcf1426185c47470ea2e12bbd6c29253a356bc45c5572246c6b1093055bff6bcf7a23859980dcf62de7125632d
data/lib/analyze.rb CHANGED
@@ -1,8 +1,8 @@
1
- class Analyze < Array
2
- def update
3
- if(`gem list countloc`.include?('countloc ('))
4
- FileUtils.mkdir('doc') if(!File.exists?('doc'))
5
- add 'countloc -r * --html doc/countloc.html'
6
- end
7
- end
1
+ class Analyze < Array
2
+ def update
3
+ if(`gem list countloc`.include?('countloc ('))
4
+ FileUtils.mkdir('doc') if(!File.exists?('doc'))
5
+ add 'countloc -r * --html doc/countloc.html'
6
+ end
7
+ end
8
8
  end
data/lib/array.rb CHANGED
@@ -1,30 +1,30 @@
1
- class Array
2
- def execute value=nil
3
- i=0
4
- while i < self.length
5
- self[i]=Command.new(self[i]) if(self[i].is_a?(String))
6
- self[i]=Command.new(self[i]) if(self[i].is_a?(Hash) && !self[i].is_a?(Command))
7
-
8
- if(!value.nil? && value.is_a?(Hash))
9
- value.each{|k,v|self[i][k]=v}
10
- end
11
-
12
- self[i].execute if(self[i].is_a?(Command))
13
- i=i+1
14
- end
15
- end
16
-
17
- def add command
18
- self << command if(!include?(command))
19
- end
20
-
21
- def to_html
22
- html=Array.new
23
- html << '<div>'
24
- self.each{|e|
25
- html << e.to_html if e.respond_to?(:to_html)
26
- }
27
- html << '</div>'
28
- html.join
29
- end
1
+ class Array
2
+ def execute value=nil
3
+ i=0
4
+ while i < self.length
5
+ self[i]=Command.new(self[i]) if(self[i].is_a?(String))
6
+ self[i]=Command.new(self[i]) if(self[i].is_a?(Hash) && !self[i].is_a?(Command))
7
+
8
+ if(!value.nil? && value.is_a?(Hash))
9
+ value.each{|k,v|self[i][k]=v}
10
+ end
11
+
12
+ self[i].execute if(self[i].is_a?(Command))
13
+ i=i+1
14
+ end
15
+ end
16
+
17
+ def add command
18
+ self << command if(!include?(command))
19
+ end
20
+
21
+ def to_html
22
+ html=Array.new
23
+ html << '<div>'
24
+ self.each{|e|
25
+ html << e.to_html if e.respond_to?(:to_html)
26
+ }
27
+ html << '</div>'
28
+ html.join
29
+ end
30
30
  end
data/lib/build.rb CHANGED
@@ -8,8 +8,8 @@ class Build < Array
8
8
  def update
9
9
 
10
10
  changed = true
11
- changed = Git.has_changes? if(File.exists?('.git') && defined?(Git))
12
- changed = Svn.has_changes? if(File.exists?('.svn') && defined?(Svn))
11
+ #changed = Git.has_changes? if(File.exists?('.git') && defined?(Git))
12
+ #changed = Svn.has_changes? if(File.exists?('.svn') && defined?(Svn))
13
13
  if(changed)
14
14
  Dir.glob('*.gemspec'){|gemspec|
15
15
  add "gem build #{gemspec}" if !File.exist?(Gemspec.gemfile gemspec)
data/lib/doc.rb CHANGED
@@ -1,9 +1,9 @@
1
- class Doc < Array
2
- def update
3
- #cmd=Command.new ({ :input => 'yard --version', :ignore_failure => true})
4
- #cmd.execute
5
- if(Command.exit_code('yard --version'))
6
- add 'yard doc - LICENSE' if File.exists?('README.md') && File.exists?('LICENSE')
7
- end
8
- end
1
+ class Doc < Array
2
+ def update
3
+ #cmd=Command.new ({ :input => 'yard --version', :ignore_failure => true})
4
+ #cmd.execute
5
+ if(Command.exit_code('yard --version'))
6
+ add 'yard doc - LICENSE' if File.exists?('README.md') && File.exists?('LICENSE')
7
+ end
8
+ end
9
9
  end
data/lib/gemspec.rb CHANGED
@@ -1,39 +1,40 @@
1
- class Gemspec
2
- def self.update gemspec_file
3
- Text.replace_in_file gemspec_file,
4
- /('\d{4}-\d{2}-\d{2}')/,
5
- "'#{Time.now.strftime('%Y-%m-%d')}'"
6
- end
7
-
8
- def self.gemfile gemspec_file
9
- spec=Gem::Specification.load(gemspec_file)
10
- return "#{spec.name}-#{spec.version}.gem"
11
- end
12
-
13
- def self.version gemspec_file
14
- spec=Gem::Specification.load(gemspec_file)
15
- return spec.version.to_s
16
- end
17
-
18
- def self.published_version gemspec_file
19
- published_version=''
20
- spec=Gem::Specification.load(gemspec_file)
21
- begin
22
- published_version = `gem list -r #{spec.name}`.scan(/\((\d+.\d+.\d+)\)/)[0][0]
23
- rescue
24
- published_version=''
25
- end
26
- published_version
27
- end
28
- def self.published? gemspec_file
29
- published_version(gemspec_file)==version(gemspec_file) ? true : false
30
- end
31
-
32
- def self.normalize gemspec_file
33
- spec=Gem::Specification.load(gemspec_file)
34
- File.open(gemspec_file,'w'){|f|f.write(spec.to_ruby)}
35
- end
36
-
37
- def self.upgrade gemspec_file
38
- end
1
+ class Gemspec
2
+ def self.update gemspec_file
3
+ Text.replace_in_file gemspec_file,
4
+ /('\d{4}-\d{2}-\d{2}')/,
5
+ "'#{Time.now.strftime('%Y-%m-%d')}'"
6
+ end
7
+
8
+ def self.gemfile gemspec_file
9
+ spec=Gem::Specification.load(gemspec_file)
10
+ return "#{spec.name}-#{spec.version}.gem" if !spec.nil?
11
+ return ""
12
+ end
13
+
14
+ def self.version gemspec_file
15
+ spec=Gem::Specification.load(gemspec_file)
16
+ return spec.version.to_s
17
+ end
18
+
19
+ def self.published_version gemspec_file
20
+ published_version=''
21
+ spec=Gem::Specification.load(gemspec_file)
22
+ begin
23
+ published_version = `gem list -r #{spec.name}`.scan(/\((\d+.\d+.\d+)\)/)[0][0]
24
+ rescue
25
+ published_version=''
26
+ end
27
+ published_version
28
+ end
29
+ def self.published? gemspec_file
30
+ published_version(gemspec_file)==version(gemspec_file) ? true : false
31
+ end
32
+
33
+ def self.normalize gemspec_file
34
+ spec=Gem::Specification.load(gemspec_file)
35
+ File.open(gemspec_file,'w'){|f|f.write(spec.to_ruby)}
36
+ end
37
+
38
+ def self.upgrade gemspec_file
39
+ end
39
40
  end
data/lib/git.rb CHANGED
@@ -1,22 +1,22 @@
1
- class Git
2
- def self.branch
3
- begin
4
- `git branch`.scan(/\* ([.\w-]+)/)[0][0]
5
- rescue
6
- ''
7
- end
8
- end
9
-
10
- def self.remote_origin directory=''
11
- url=''
12
- directory=Dir.pwd if directory.length == 0
13
- Dir.chdir(directory) do
14
- begin
15
- url=`git remote show origin`.scan(/Fetch URL: ([\.\-:\/\w\d]+)/)[0]
16
- rescue
17
- url=''
18
- end
19
- end
20
- url
21
- end
1
+ class Git
2
+ def self.branch
3
+ begin
4
+ `git branch`.scan(/\* ([.\w-]+)/)[0][0]
5
+ rescue
6
+ ''
7
+ end
8
+ end
9
+
10
+ def self.remote_origin directory=''
11
+ url=''
12
+ directory=Dir.pwd if directory.length == 0
13
+ Dir.chdir(directory) do
14
+ begin
15
+ url=`git remote show origin`.scan(/Fetch URL: ([\.\-:\/\w\d]+)/)[0]
16
+ rescue
17
+ url=''
18
+ end
19
+ end
20
+ url
21
+ end
22
22
  end
data/lib/hash.rb CHANGED
@@ -1,21 +1,21 @@
1
- class Hash
2
- def execute value=nil
3
- self.each{|k,v|
4
- v.update if v.respond_to?(:update)
5
- if(v.is_a?(Array) && v.length==0)
6
- self.delete k
7
- else
8
- #puts "executing #{k}"
9
-
10
- v.execute(value) if v.respond_to?(:execute)
11
- end
12
- }
13
- end
14
- def to_html
15
- [
16
- '<div>',
17
- map { |k, v| ["<br/><div><strong>#{k}</strong>", v.respond_to?(:to_html) ? v.to_html : "<span>#{v}</span></div><br/>"] },
18
- '</div>'
19
- ].join
20
- end
1
+ class Hash
2
+ def execute value=nil
3
+ self.each{|k,v|
4
+ v.update if v.respond_to?(:update)
5
+ if(v.is_a?(Array) && v.length==0)
6
+ self.delete k
7
+ else
8
+ #puts "executing #{k}"
9
+
10
+ v.execute(value) if v.respond_to?(:execute)
11
+ end
12
+ }
13
+ end
14
+ def to_html
15
+ [
16
+ '<div>',
17
+ map { |k, v| ["<br/><div><strong>#{k}</strong>", v.respond_to?(:to_html) ? v.to_html : "<span>#{v}</span></div><br/>"] },
18
+ '</div>'
19
+ ].join
20
+ end
21
21
  end
data/lib/publish.rb CHANGED
@@ -1,21 +1,21 @@
1
- require_relative('internet.rb')
2
- class Publish < Array
3
- def update
4
- if(Internet.available?)
5
- if(File.exists?('.git'))
6
- if(`git branch`.include?('* master'))
7
- Dir.glob('*.gemspec').each{|gemspec_file|
8
- add "gem push #{Gemspec.gemfile(gemspec_file)}" if !Gemspec.published? gemspec_file
9
- }
10
- end
11
- end
12
- if(File.exists?('.svn'))
13
- if(`svn info`.include?('/trunk'))
14
- Dir.glob('*.gemspec').each{|gemspec_file|
15
- add "gem push #{Gemspec.gemfile(gemspec_file)}" if !Gemspec.published? gemspec_file
16
- }
17
- end
18
- end
19
- end
20
- end
21
- end
1
+ require_relative('internet.rb')
2
+ class Publish < Array
3
+ def update
4
+ if(Internet.available?)
5
+ if(File.exists?('.git'))
6
+ if(`git branch`.include?('* master'))
7
+ Dir.glob('*.gemspec').each{|gemspec_file|
8
+ add "gem push #{Gemspec.gemfile(gemspec_file)}" if !Gemspec.published? gemspec_file
9
+ }
10
+ end
11
+ end
12
+ if(File.exists?('.svn'))
13
+ if(`svn info`.include?('/trunk'))
14
+ Dir.glob('*.gemspec').each{|gemspec_file|
15
+ add "gem push #{Gemspec.gemfile(gemspec_file)}" if !Gemspec.published? gemspec_file
16
+ }
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
data/lib/push.rb CHANGED
@@ -1,9 +1,9 @@
1
- require_relative('internet.rb')
2
- class Push < Array
3
- def update
4
- if(File.exists?('.git') && `git config --list`.include?('user.name='))
5
- add 'git config --global push.default simple'
6
- self << 'git push' if Git.branch != 'develop' && Internet.available?
7
- end
8
- end
1
+ require_relative('internet.rb')
2
+ class Push < Array
3
+ def update
4
+ if(File.exists?('.git') && `git config --list`.include?('user.name='))
5
+ add 'git config --global push.default simple'
6
+ self << 'git push' if Git.branch != 'develop' && Internet.available?
7
+ end
8
+ end
9
9
  end
data/lib/setup.rb CHANGED
@@ -1,25 +1,25 @@
1
- #
2
- # use the SVN_EXPORTS hash to define svn exports destined for DEV_ROOT/dep
3
- #
4
- # SVN_EXPORT={ 'System.Data.SQLite/1.0.93.0' => 'https://third-party.googlecode.com/svn/trunk/System.Data.SQLite/1.0.93.0' }
5
- #
6
- class Setup < Array
7
- def update
8
- add 'bundle install' if(File.exists?('Gemfile'))
9
-
10
- Dir.glob('*.gemspec').each{|gemspec_file|
11
- add "<%Gemspec.update('#{gemspec_file}')%>"
12
- }
13
-
14
- if(defined?(SVN_EXPORTS))
15
- SVN_EXPORTS.each{|k,v|
16
- if(!File.exists?("#{Command.dev_root}/dep/#{k}"))
17
- FileUtils.mkdir_p(File.dirname("#{Command.dev_root}/dep/#{k}")) if !File.exists?("#{Command.dev_root}/dep/#{k}")
18
- dest="#{Command.dev_root}/dep/#{k}"
19
- add "svn export #{v} #{Command.dev_root}/dep/#{k}" if !dest.include?("@")
20
- add "svn export #{v} #{Command.dev_root}/dep/#{k}@" if dest.include?("@")
21
- end
22
- }
23
- end
24
- end
1
+ #
2
+ # use the SVN_EXPORTS hash to define svn exports destined for DEV_ROOT/dep
3
+ #
4
+ # SVN_EXPORT={ 'System.Data.SQLite/1.0.93.0' => 'https://third-party.googlecode.com/svn/trunk/System.Data.SQLite/1.0.93.0' }
5
+ #
6
+ class Setup < Array
7
+ def update
8
+ add 'bundle install' if(File.exists?('Gemfile'))
9
+
10
+ Dir.glob('*.gemspec').each{|gemspec_file|
11
+ add "<%Gemspec.update('#{gemspec_file}')%>"
12
+ }
13
+
14
+ if(defined?(SVN_EXPORTS))
15
+ SVN_EXPORTS.each{|k,v|
16
+ if(!File.exists?("#{Command.dev_root}/dep/#{k}"))
17
+ FileUtils.mkdir_p(File.dirname("#{Command.dev_root}/dep/#{k}")) if !File.exists?("#{Command.dev_root}/dep/#{k}")
18
+ dest="#{Command.dev_root}/dep/#{k}"
19
+ add "svn export #{v} #{Command.dev_root}/dep/#{k}" if !dest.include?("@")
20
+ add "svn export #{v} #{Command.dev_root}/dep/#{k}@" if dest.include?("@")
21
+ end
22
+ }
23
+ end
24
+ end
25
25
  end
data/lib/text.rb CHANGED
@@ -1,15 +1,15 @@
1
- class Text
2
- def self.replace_in_glob(glob,search,replace)
3
- Dir.glob(glob).each{ |f| replace_in_file(f,search,replace) }
4
- end
5
-
6
- def self.replace_in_file(filename,search,replace)
7
- text1 = IO.read(filename).force_encoding("ISO-8859-1").encode("utf-8", replace: nil)
8
- #File.read(f,:encoding=>'UTF-8')
9
- text2 = text1.gsub(search) { |str| str=replace }
10
- unless text1==text2
11
- File.open(filename,"w") { |f| f.puts text2 }
12
- end
13
- end
14
-
1
+ class Text
2
+ def self.replace_in_glob(glob,search,replace)
3
+ Dir.glob(glob).each{ |f| replace_in_file(f,search,replace) }
4
+ end
5
+
6
+ def self.replace_in_file(filename,search,replace)
7
+ text1 = IO.read(filename).force_encoding("ISO-8859-1").encode("utf-8", replace: nil)
8
+ #File.read(f,:encoding=>'UTF-8')
9
+ text2 = text1.gsub(search) { |str| str=replace }
10
+ unless text1==text2
11
+ File.open(filename,"w") { |f| f.puts text2 }
12
+ end
13
+ end
14
+
15
15
  end
data/lib/timer.rb CHANGED
@@ -1,41 +1,41 @@
1
- class Timer
2
- attr_accessor :start_time
3
-
4
- def initialize
5
- @start_time=Time.now
6
- end
7
-
8
- def elapsed # in seconds
9
- return Time.now-@start_time
10
- end
11
-
12
- def elapsed_str
13
- elapsed_str="[" + "%.0f" %(elapsed) + "s]"
14
- end
15
-
16
- def self.elapsed_exceeds?(name,duration_seconds)
17
- if(Timer.get_elapsed(name).nil? || Timer.get_elapsed(name) > duration_seconds)
18
- return true
19
- end
20
- return false
21
- end
22
-
23
- def self.get_elapsed(name)
24
- timestamp=get_timestamp(name)
25
- return Time.now-timestamp if(!timestamp.nil?)
26
- nil
27
- end
28
-
29
- def self.get_timestamp(name)
30
- dir=Rake.application.original_dir
31
- if(File.exists?("#{DEV[:dev_root]}/log/#{name}.timestamp"))
32
- return Time.parse(File.read("#{DEV[:dev_root]}/log/#{name}.timestamp").strip)
33
- end
34
- nil
35
- end
36
-
37
- def self.set_timestamp(name)
38
- Dir.mkdir("#{DEV_TASKS[:dev_root]}/log") if(!Dir.exists?("#{DEV_TASKS[:dev_root]}/log"))
39
- File.open("#{DEV_TASKS[:dev_root]}/log/#{name}.timestamp",'w'){|f|f.puts(Time.now.to_s)}
40
- end
1
+ class Timer
2
+ attr_accessor :start_time
3
+
4
+ def initialize
5
+ @start_time=Time.now
6
+ end
7
+
8
+ def elapsed # in seconds
9
+ return Time.now-@start_time
10
+ end
11
+
12
+ def elapsed_str
13
+ elapsed_str="[" + "%.0f" %(elapsed) + "s]"
14
+ end
15
+
16
+ def self.elapsed_exceeds?(name,duration_seconds)
17
+ if(Timer.get_elapsed(name).nil? || Timer.get_elapsed(name) > duration_seconds)
18
+ return true
19
+ end
20
+ return false
21
+ end
22
+
23
+ def self.get_elapsed(name)
24
+ timestamp=get_timestamp(name)
25
+ return Time.now-timestamp if(!timestamp.nil?)
26
+ nil
27
+ end
28
+
29
+ def self.get_timestamp(name)
30
+ dir=Rake.application.original_dir
31
+ if(File.exists?("#{DEV[:dev_root]}/log/#{name}.timestamp"))
32
+ return Time.parse(File.read("#{DEV[:dev_root]}/log/#{name}.timestamp").strip)
33
+ end
34
+ nil
35
+ end
36
+
37
+ def self.set_timestamp(name)
38
+ Dir.mkdir("#{DEV_TASKS[:dev_root]}/log") if(!Dir.exists?("#{DEV_TASKS[:dev_root]}/log"))
39
+ File.open("#{DEV_TASKS[:dev_root]}/log/#{name}.timestamp",'w'){|f|f.puts(Time.now.to_s)}
40
+ end
41
41
  end
data/spec/publish_spec.rb CHANGED
@@ -1,28 +1,28 @@
1
- require_relative '../lib/publish.rb'
2
- require 'rake'
3
- describe Publish do
4
- it "should be able to publish file to subversion" do
5
- #FileUtils.rm_r('tmp') if(File.exists?('tmp'))
6
- #FileUtils.mkdir('tmp') if(!File.exists?('tmp'))
7
- #svn_repo="file:///#{Rake.application.original_dir}/tmp/svn_test_repo"
8
- #Dir.chdir('tmp') do
9
- #FileUtils.rm_r('tmp/svn_test_repo') if File.exists?('tmp/svn_test_repo')
10
- #puts `svnadmin create svn_test_repo`
11
- #expect(File.exists?('svn_test_repo')).to eq(true)
12
-
13
- #FileUtils.mkdir('publish') if(!File.exists?('publish'))
14
- #File.open('publish/file1.txt','w'){|f|f.write('abc')}
15
- #File.open('publish/file2.txt','w'){|f|f.write('def')}
16
-
17
-
18
- #expect(Command.exit_code('svn info #{svn_repo}/publish_test')).not_to eq(0)
19
- #Publish.to_subversion(FileList.new('publish/*.txt'),"#{svn_repo}/publish_test")
20
- #expect(Command.exit_code('svn info #{svn_repo}/publish_test')).to eq(0)
21
-
22
- #{}`svn checkout #{svn_repo} svn_test`
23
- #expect(File.exists?('svn_test'))
24
- #end
25
-
26
-
27
- end
1
+ require_relative '../lib/publish.rb'
2
+ require 'rake'
3
+ describe Publish do
4
+ it "should be able to publish file to subversion" do
5
+ #FileUtils.rm_r('tmp') if(File.exists?('tmp'))
6
+ #FileUtils.mkdir('tmp') if(!File.exists?('tmp'))
7
+ #svn_repo="file:///#{Rake.application.original_dir}/tmp/svn_test_repo"
8
+ #Dir.chdir('tmp') do
9
+ #FileUtils.rm_r('tmp/svn_test_repo') if File.exists?('tmp/svn_test_repo')
10
+ #puts `svnadmin create svn_test_repo`
11
+ #expect(File.exists?('svn_test_repo')).to eq(true)
12
+
13
+ #FileUtils.mkdir('publish') if(!File.exists?('publish'))
14
+ #File.open('publish/file1.txt','w'){|f|f.write('abc')}
15
+ #File.open('publish/file2.txt','w'){|f|f.write('def')}
16
+
17
+
18
+ #expect(Command.exit_code('svn info #{svn_repo}/publish_test')).not_to eq(0)
19
+ #Publish.to_subversion(FileList.new('publish/*.txt'),"#{svn_repo}/publish_test")
20
+ #expect(Command.exit_code('svn info #{svn_repo}/publish_test')).to eq(0)
21
+
22
+ #{}`svn checkout #{svn_repo} svn_test`
23
+ #expect(File.exists?('svn_test'))
24
+ #end
25
+
26
+
27
+ end
28
28
  end
@@ -1,12 +1,12 @@
1
- require_relative('../../lib/dev_commands.rb')
2
-
3
- CLOBBER.include('csharp-library/bin','csharp-library/obj','cpp-library/bin','cpp-library/obj')
4
- desc 'build'
5
- task :build do
6
- COMMANDS[:build].update
7
- COMMANDS[:build].execute
8
- end
9
-
10
- task :default do
11
- COMMANDS.execute
1
+ require_relative('../../lib/dev_commands.rb')
2
+
3
+ CLOBBER.include('csharp-library/bin','csharp-library/obj','cpp-library/bin','cpp-library/obj')
4
+ desc 'build'
5
+ task :build do
6
+ COMMANDS[:build].update
7
+ COMMANDS[:build].execute
8
+ end
9
+
10
+ task :default do
11
+ COMMANDS.execute
12
12
  end
@@ -1,12 +1,12 @@
1
- require_relative('../../lib/dev_commands.rb')
2
-
3
- CLOBBER.include('csharp-library/bin','csharp-library/obj','cpp-library/bin','cpp-library/obj')
4
- desc 'build'
5
- task :build do
6
- COMMANDS[:build].update
7
- COMMANDS[:build].execute
8
- end
9
-
10
- task :default do
11
- COMMANDS.execute
1
+ require_relative('../../lib/dev_commands.rb')
2
+
3
+ CLOBBER.include('csharp-library/bin','csharp-library/obj','cpp-library/bin','cpp-library/obj')
4
+ desc 'build'
5
+ task :build do
6
+ COMMANDS[:build].update
7
+ COMMANDS[:build].execute
8
+ end
9
+
10
+ task :default do
11
+ COMMANDS.execute
12
12
  end
data/spec/text_spec.rb CHANGED
@@ -1,12 +1,12 @@
1
- require_relative '../lib/text.rb'
2
-
3
- describe Text do
4
- it "should be able to replace text in file" do
5
- FileUtils.mkdir('tmp') if(!File.exists?('tmp'))
6
- File.open('tmp/test.txt','w'){|f|
7
- f.write("test thing")
8
- }
9
- Text.replace_in_file('tmp/test.txt','thing','string')
10
- expect(IO.read('tmp/test.txt').include?('test string')).to eq(true)
11
- end
1
+ require_relative '../lib/text.rb'
2
+
3
+ describe Text do
4
+ it "should be able to replace text in file" do
5
+ FileUtils.mkdir('tmp') if(!File.exists?('tmp'))
6
+ File.open('tmp/test.txt','w'){|f|
7
+ f.write("test thing")
8
+ }
9
+ Text.replace_in_file('tmp/test.txt','thing','string')
10
+ expect(IO.read('tmp/test.txt').include?('test string')).to eq(true)
11
+ end
12
12
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev_commands
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.54
5
- prerelease:
4
+ version: 0.0.55
6
5
  platform: ruby
7
6
  authors:
8
7
  - Lou Parslow
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-01-22 00:00:00.000000000 Z
11
+ date: 2015-01-24 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: yard
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: bundler
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
@@ -108,8 +99,8 @@ files:
108
99
  - lib/timer.rb
109
100
  - lib/update.rb
110
101
  - lib/upgrade.rb
111
- - spec/commands_spec.rb
112
102
  - spec/command_spec.rb
103
+ - spec/commands_spec.rb
113
104
  - spec/gem-example/rakefile.rb
114
105
  - spec/internet_spec.rb
115
106
  - spec/publish_spec.rb
@@ -123,27 +114,26 @@ files:
123
114
  homepage: http://github.com/lou-parslow/dev_commands.gem
124
115
  licenses:
125
116
  - Apache 2.0
117
+ metadata: {}
126
118
  post_install_message:
127
119
  rdoc_options: []
128
120
  require_paths:
129
121
  - lib
130
122
  required_ruby_version: !ruby/object:Gem::Requirement
131
- none: false
132
123
  requirements:
133
- - - ! '>='
124
+ - - '>='
134
125
  - !ruby/object:Gem::Version
135
126
  version: '0'
136
127
  required_rubygems_version: !ruby/object:Gem::Requirement
137
- none: false
138
128
  requirements:
139
- - - ! '>='
129
+ - - '>='
140
130
  - !ruby/object:Gem::Version
141
131
  version: '0'
142
132
  requirements: []
143
133
  rubyforge_project:
144
- rubygems_version: 1.8.28
134
+ rubygems_version: 2.0.3
145
135
  signing_key:
146
- specification_version: 3
136
+ specification_version: 4
147
137
  summary: gem to execute system commands
148
138
  test_files: []
149
139
  has_rdoc: