dev 2.1.70 → 2.1.71
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +202 -202
- data/lib/apps/svn.rb +151 -151
- data/lib/apps/xcodebuild.rb +15 -15
- data/lib/apps.rb +2 -2
- data/lib/base/dir.rb +98 -98
- data/lib/base/file.rb +34 -34
- data/lib/base/gemspec.rb +50 -50
- data/lib/base/hash.rb +20 -20
- data/lib/base/history.rb +38 -38
- data/lib/base/internet.rb +24 -24
- data/lib/base/project.rb +458 -458
- data/lib/base/string.rb +6 -6
- data/lib/base/text.rb +29 -29
- data/lib/base/timeout.rb +121 -121
- data/lib/base/timer.rb +44 -44
- data/lib/base/version.rb +82 -82
- data/lib/base.rb +4 -4
- data/lib/dev.config.rb +7 -7
- data/lib/tasks/clean.rb +9 -9
- data/lib/tasks/clobber.rb +25 -25
- data/lib/tasks/doc.rb +9 -9
- data/lib/tasks/info.rb +9 -9
- data/lib/tasks/publish.rb +33 -33
- data/lib/tasks/pull.rb +11 -11
- data/lib/tasks/setup.rb +12 -0
- data/lib/tasks/update.rb +14 -14
- metadata +3 -4
data/lib/base/gemspec.rb
CHANGED
@@ -1,51 +1,51 @@
|
|
1
|
-
puts __FILE__ if defined?(DEBUG)
|
2
|
-
require_relative('command.rb')
|
3
|
-
|
4
|
-
class Gemspec
|
5
|
-
def self.update gemspec_file
|
6
|
-
Text.replace_in_file gemspec_file,
|
7
|
-
/('\d{4}-\d{2}-\d{2}')/,
|
8
|
-
"'#{Time.now.strftime('%Y-%m-%d')}'"
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.gemfile gemspec_file
|
12
|
-
spec=Gem::Specification.load(gemspec_file)
|
13
|
-
return "#{spec.name}-#{spec.version}.gem" if !spec.nil?
|
14
|
-
return ""
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.version gemspec_file
|
18
|
-
spec=Gem::Specification.load(gemspec_file)
|
19
|
-
return spec.version.to_s
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.latest_published_version gemname
|
23
|
-
scan=`gem list -r #{gemname}`.scan(/^dev\s*\(([\d.]+)\)/)
|
24
|
-
if(!scan.nil?)
|
25
|
-
return scan[0][0] if(scan.length > 0 && !scan[0].nil? && scan[0].length > 0)
|
26
|
-
end
|
27
|
-
''
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.published_version gemspec_file
|
31
|
-
published_version=''
|
32
|
-
spec=Gem::Specification.load(gemspec_file)
|
33
|
-
begin
|
34
|
-
published_version = latest_published_version spec.name# `gem list -r #{spec.name}`.scan(/\((\d+.\d+.\d+)\)/)[0][0]
|
35
|
-
rescue
|
36
|
-
published_version=''
|
37
|
-
end
|
38
|
-
published_version
|
39
|
-
end
|
40
|
-
def self.published? gemspec_file
|
41
|
-
published_version(gemspec_file)==version(gemspec_file) ? true : false
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.normalize gemspec_file
|
45
|
-
spec=Gem::Specification.load(gemspec_file)
|
46
|
-
File.open(gemspec_file,'w'){|f|f.write(spec.to_ruby)}
|
47
|
-
end
|
48
|
-
|
49
|
-
def self.upgrade gemspec_file
|
50
|
-
end
|
1
|
+
puts __FILE__ if defined?(DEBUG)
|
2
|
+
require_relative('command.rb')
|
3
|
+
|
4
|
+
class Gemspec
|
5
|
+
def self.update gemspec_file
|
6
|
+
Text.replace_in_file gemspec_file,
|
7
|
+
/('\d{4}-\d{2}-\d{2}')/,
|
8
|
+
"'#{Time.now.strftime('%Y-%m-%d')}'"
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.gemfile gemspec_file
|
12
|
+
spec=Gem::Specification.load(gemspec_file)
|
13
|
+
return "#{spec.name}-#{spec.version}.gem" if !spec.nil?
|
14
|
+
return ""
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.version gemspec_file
|
18
|
+
spec=Gem::Specification.load(gemspec_file)
|
19
|
+
return spec.version.to_s
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.latest_published_version gemname
|
23
|
+
scan=`gem list -r #{gemname}`.scan(/^dev\s*\(([\d.]+)\)/)
|
24
|
+
if(!scan.nil?)
|
25
|
+
return scan[0][0] if(scan.length > 0 && !scan[0].nil? && scan[0].length > 0)
|
26
|
+
end
|
27
|
+
''
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.published_version gemspec_file
|
31
|
+
published_version=''
|
32
|
+
spec=Gem::Specification.load(gemspec_file)
|
33
|
+
begin
|
34
|
+
published_version = latest_published_version spec.name# `gem list -r #{spec.name}`.scan(/\((\d+.\d+.\d+)\)/)[0][0]
|
35
|
+
rescue
|
36
|
+
published_version=''
|
37
|
+
end
|
38
|
+
published_version
|
39
|
+
end
|
40
|
+
def self.published? gemspec_file
|
41
|
+
published_version(gemspec_file)==version(gemspec_file) ? true : false
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.normalize gemspec_file
|
45
|
+
spec=Gem::Specification.load(gemspec_file)
|
46
|
+
File.open(gemspec_file,'w'){|f|f.write(spec.to_ruby)}
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.upgrade gemspec_file
|
50
|
+
end
|
51
51
|
end
|
data/lib/base/hash.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
puts __FILE__ if defined?(DEBUG)
|
2
|
-
|
3
|
-
class Hash
|
4
|
-
def execute value=nil
|
5
|
-
self.each{|k,v|
|
6
|
-
v.update if v.respond_to?(:update)
|
7
|
-
if(v.is_a?(Array) && v.length==0)
|
8
|
-
self.delete k
|
9
|
-
else
|
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
|
+
puts __FILE__ if defined?(DEBUG)
|
2
|
+
|
3
|
+
class Hash
|
4
|
+
def execute value=nil
|
5
|
+
self.each{|k,v|
|
6
|
+
v.update if v.respond_to?(:update)
|
7
|
+
if(v.is_a?(Array) && v.length==0)
|
8
|
+
self.delete k
|
9
|
+
else
|
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/base/history.rb
CHANGED
@@ -1,39 +1,39 @@
|
|
1
|
-
puts __FILE__ if defined?(DEBUG)
|
2
|
-
|
3
|
-
class History
|
4
|
-
attr_accessor :dev
|
5
|
-
|
6
|
-
def initialize dev=nil
|
7
|
-
@dev=dev
|
8
|
-
@dev=Dev.new if @dev.nil?
|
9
|
-
end
|
10
|
-
|
11
|
-
# .0. for 0 exit codes
|
12
|
-
# .X. for non 0 exit codes
|
13
|
-
# project name is contained in directory name
|
14
|
-
def get_commands pattern
|
15
|
-
commands=Array.new
|
16
|
-
Dir.chdir(@dev.log_dir) do
|
17
|
-
Dir.glob("*#{pattern.gsub('/','-')}*.*").each{|logfile|
|
18
|
-
commands << Command.new(JSON.parse(IO.read(logfile)))
|
19
|
-
}
|
20
|
-
end
|
21
|
-
commands
|
22
|
-
end
|
23
|
-
|
24
|
-
def add_command command
|
25
|
-
code="0"
|
26
|
-
code="X" if command[:exit_code] !=0
|
27
|
-
directory=command[:directory].gsub(@dev.root_dir,'').gsub('/','-')
|
28
|
-
name="#{command[:input]}.#{code}.#{directory}.json"
|
29
|
-
filename="#{@dev.log_dir}/#{name}"
|
30
|
-
puts "add command #{filename}" if @dev.debug?
|
31
|
-
File.open(filename,'w'){|f|f.write(command.to_json)}
|
32
|
-
end
|
33
|
-
|
34
|
-
def get_wrk_command project_fullname
|
35
|
-
commands=get_commands("#{project_fullname}".gsub('/','-'))
|
36
|
-
return commands[0] if commands.length > 0
|
37
|
-
nil
|
38
|
-
end
|
1
|
+
puts __FILE__ if defined?(DEBUG)
|
2
|
+
|
3
|
+
class History
|
4
|
+
attr_accessor :dev
|
5
|
+
|
6
|
+
def initialize dev=nil
|
7
|
+
@dev=dev
|
8
|
+
@dev=Dev.new if @dev.nil?
|
9
|
+
end
|
10
|
+
|
11
|
+
# .0. for 0 exit codes
|
12
|
+
# .X. for non 0 exit codes
|
13
|
+
# project name is contained in directory name
|
14
|
+
def get_commands pattern
|
15
|
+
commands=Array.new
|
16
|
+
Dir.chdir(@dev.log_dir) do
|
17
|
+
Dir.glob("*#{pattern.gsub('/','-')}*.*").each{|logfile|
|
18
|
+
commands << Command.new(JSON.parse(IO.read(logfile)))
|
19
|
+
}
|
20
|
+
end
|
21
|
+
commands
|
22
|
+
end
|
23
|
+
|
24
|
+
def add_command command
|
25
|
+
code="0"
|
26
|
+
code="X" if command[:exit_code] !=0
|
27
|
+
directory=command[:directory].gsub(@dev.root_dir,'').gsub('/','-')
|
28
|
+
name="#{command[:input]}.#{code}.#{directory}.json"
|
29
|
+
filename="#{@dev.log_dir}/#{name}"
|
30
|
+
puts "add command #{filename}" if @dev.debug?
|
31
|
+
File.open(filename,'w'){|f|f.write(command.to_json)}
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_wrk_command project_fullname
|
35
|
+
commands=get_commands("#{project_fullname}".gsub('/','-'))
|
36
|
+
return commands[0] if commands.length > 0
|
37
|
+
nil
|
38
|
+
end
|
39
39
|
end
|
data/lib/base/internet.rb
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
puts __FILE__ if defined?(DEBUG)
|
2
|
-
|
3
|
-
require 'open-uri'
|
4
|
-
require 'timeout'
|
5
|
-
class Internet
|
6
|
-
|
7
|
-
@@available=true
|
8
|
-
|
9
|
-
def self.available?
|
10
|
-
return @@available if !@@available.nil?
|
11
|
-
|
12
|
-
begin
|
13
|
-
index=open('http://www.google.com').read
|
14
|
-
if index.include?('<Title>Google')
|
15
|
-
@@available = true
|
16
|
-
else
|
17
|
-
puts "open('http://www.google.com') returned false"
|
18
|
-
end
|
19
|
-
rescue Exception => e
|
20
|
-
puts "open('http://www.google.com') raised an exception: #{e.to_s}"
|
21
|
-
@@available = false
|
22
|
-
end
|
23
|
-
@@available
|
24
|
-
end
|
1
|
+
puts __FILE__ if defined?(DEBUG)
|
2
|
+
|
3
|
+
require 'open-uri'
|
4
|
+
require 'timeout'
|
5
|
+
class Internet
|
6
|
+
|
7
|
+
@@available=true
|
8
|
+
|
9
|
+
def self.available?
|
10
|
+
return @@available if !@@available.nil?
|
11
|
+
|
12
|
+
begin
|
13
|
+
index=open('http://www.google.com').read
|
14
|
+
if index.include?('<Title>Google')
|
15
|
+
@@available = true
|
16
|
+
else
|
17
|
+
puts "open('http://www.google.com') returned false"
|
18
|
+
end
|
19
|
+
rescue Exception => e
|
20
|
+
puts "open('http://www.google.com') raised an exception: #{e.to_s}"
|
21
|
+
@@available = false
|
22
|
+
end
|
23
|
+
@@available
|
24
|
+
end
|
25
25
|
end
|