dev 2.1.75 → 2.1.76

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.
@@ -1,16 +1,16 @@
1
- #COMMANDS[:build]=['xcodebuild clean -scheme Hydrogen -destination "name=iPhone 6"',
2
- # 'xcodebuild build -scheme Hydrogen -destination "name=iPhone 6"']
3
- # COMMANDS[:test]=['xcodebuild test -scheme Hydrogen -destination "name=iPhone 6"'] if RUBY_PLATFORM.include?('darwin')
4
-
5
- class XCodeBuild < Hash
6
- def self.get_build_commands xcodeproj_filename
7
- #build_commands=Array.new
8
- #build_command=Command.new('xcodebuild build')
9
- #build_command[:directory] = File.dirname(xcodeproj_filename)
10
-
11
- #name=xcodeproj_filename.gsub('.xcodeproj','')
12
- #build_commands << "xcodebuild clean -scheme #{name} -destination \"name=iPhone 6\""
13
- #build_commands << "xcodebuild build -scheme #{name} -destination \"name=iPhone 6\""
14
- #build_commands << build_command
15
- end
1
+ #COMMANDS[:build]=['xcodebuild clean -scheme Hydrogen -destination "name=iPhone 6"',
2
+ # 'xcodebuild build -scheme Hydrogen -destination "name=iPhone 6"']
3
+ # COMMANDS[:test]=['xcodebuild test -scheme Hydrogen -destination "name=iPhone 6"'] if RUBY_PLATFORM.include?('darwin')
4
+
5
+ class XCodeBuild < Hash
6
+ def self.get_build_commands xcodeproj_filename
7
+ #build_commands=Array.new
8
+ #build_command=Command.new('xcodebuild build')
9
+ #build_command[:directory] = File.dirname(xcodeproj_filename)
10
+
11
+ #name=xcodeproj_filename.gsub('.xcodeproj','')
12
+ #build_commands << "xcodebuild clean -scheme #{name} -destination \"name=iPhone 6\""
13
+ #build_commands << "xcodebuild build -scheme #{name} -destination \"name=iPhone 6\""
14
+ #build_commands << build_command
15
+ end
16
16
  end
data/lib/base.rb CHANGED
@@ -1,5 +1,5 @@
1
- puts __FILE__ if defined?(DEBUG)
2
-
3
- ['array','command','dir','environment','file','gemspec',
4
- 'hash','history','internet','project','projects','source',
1
+ puts __FILE__ if defined?(DEBUG)
2
+
3
+ ['array','command','dir','environment','file','gemspec',
4
+ 'hash','history','internet','project','projects','source',
5
5
  'string','text','timeout','timer','version'].each{|name| require_relative("base/#{name}.rb")}
data/lib/base/dir.rb CHANGED
@@ -1,99 +1,99 @@
1
- require 'fileutils'
2
-
3
- class Dir
4
- def self.make directory
5
- FileUtils.mkdir_p directory if !File.exists? directory
6
- end
7
- def self.remove directory, remove_empty_parents=false
8
- begin
9
- FileUtils.rm_rf directory if(!Dir.empty?(directory))
10
- FileUtils.rm_r directory if(File.exists?(directory))
11
- if(remove_empty_parents)
12
- parent_dir=File.dirname(directory)
13
- Dir.remove parent_dir, true if(Dir.empty?(parent_dir))
14
- end
15
- rescue
16
- end
17
- end
18
- def self.empty? directory
19
- if((Dir.entries(directory) - %w{ . .. }).empty?)
20
- return true
21
- end
22
- false
23
- end
24
-
25
- def self.get_latest_mtime directory
26
- mtime=Time.new(1980)
27
- Dir.chdir(directory) do
28
- latest_filename=''
29
- Dir.glob('**/*.*').each{|f|
30
- if mtime.nil? || File.mtime(f) > mtime
31
- mtime=File.mtime(f)
32
- latest_filename=f
33
- end
34
- }
35
- puts " latest_mtime #{mtime.to_s} #{latest_filename}" if Environment.default.debug?
36
- end
37
- mtime
38
- end
39
-
40
- def self.zip(directory,files,zipfilename)
41
- if Gem::Specification::find_all_by_name('rubyzip').any?
42
- require 'zip'
43
- File.delete(zipfilename) if(File.exists?(zipfilename))
44
- Zip::File.open(zipfilename,Zip::File::CREATE) do |zipfile|
45
- Dir.chdir(directory) do
46
- count = 0
47
- files.each{|source_file|
48
- zipfile.add(source_file,"#{directory}/#{source_file}")
49
- count = count + 1
50
- }
51
- puts "added #{count} files to #{zipfilename}"
52
- end
53
- end
54
- else
55
- puts "rubyzip gem is not installed 'gem install rubyzip'"
56
- end
57
- end
58
-
59
- def self.unzip(zipfilename,directory)
60
- if Gem::Specification::find_all_by_name('rubyzip').any?
61
- require 'zip'
62
- count = 0
63
- Zip::File.open(zipfilename) do |zip_file|
64
- zip_file.each do |entry|
65
- dest = "#{directory}/#{entry.to_s}"
66
- parent_dir=File.dirname(dest)
67
- FileUtils.mkdir_p parent_dir if(!Dir.exists?(parent_dir))
68
- entry.extract("#{directory}/#{entry.to_s}")
69
- count = count + 1
70
- end
71
- end
72
- puts "extracted #{count} files to #{directory}"
73
- else
74
- puts "rubyzip gem is not installed 'gem install rubyzip'"
75
- end
76
- end
77
-
78
- def self.copy_files(src_dir,glob_pattern,exclude_patterns,target_dir)
79
- if(Dir.exists?(src_dir))
80
- Dir.chdir(src_dir) do
81
- Dir.glob(glob_pattern).each{|f|
82
- if(File.file?(f))
83
- exclude = false
84
- if(!exclude_patterns.nil?)
85
- exclude_patterns.each{|p|
86
- exclude = true if(f.include?(p))
87
- }
88
- end
89
- if(!exclude)
90
- dest = "#{target_dir}/#{f}"
91
- FileUtils.mkdir_p(File.dirname(dest)) if(!Dir.exists?(File.dirname(dest)))
92
- FileUtils.cp(f,dest)
93
- end
94
- end
95
- }
96
- end
97
- end
98
- end
1
+ require 'fileutils'
2
+
3
+ class Dir
4
+ def self.make directory
5
+ FileUtils.mkdir_p directory if !File.exists? directory
6
+ end
7
+ def self.remove directory, remove_empty_parents=false
8
+ begin
9
+ FileUtils.rm_rf directory if(!Dir.empty?(directory))
10
+ FileUtils.rm_r directory if(File.exists?(directory))
11
+ if(remove_empty_parents)
12
+ parent_dir=File.dirname(directory)
13
+ Dir.remove parent_dir, true if(Dir.empty?(parent_dir))
14
+ end
15
+ rescue
16
+ end
17
+ end
18
+ def self.empty? directory
19
+ if((Dir.entries(directory) - %w{ . .. }).empty?)
20
+ return true
21
+ end
22
+ false
23
+ end
24
+
25
+ def self.get_latest_mtime directory
26
+ mtime=Time.new(1980)
27
+ Dir.chdir(directory) do
28
+ latest_filename=''
29
+ Dir.glob('**/*.*').each{|f|
30
+ if mtime.nil? || File.mtime(f) > mtime
31
+ mtime=File.mtime(f)
32
+ latest_filename=f
33
+ end
34
+ }
35
+ puts " latest_mtime #{mtime.to_s} #{latest_filename}" if Environment.default.debug?
36
+ end
37
+ mtime
38
+ end
39
+
40
+ def self.zip(directory,files,zipfilename)
41
+ if Gem::Specification::find_all_by_name('rubyzip').any?
42
+ require 'zip'
43
+ File.delete(zipfilename) if(File.exists?(zipfilename))
44
+ Zip::File.open(zipfilename,Zip::File::CREATE) do |zipfile|
45
+ Dir.chdir(directory) do
46
+ count = 0
47
+ files.each{|source_file|
48
+ zipfile.add(source_file,"#{directory}/#{source_file}")
49
+ count = count + 1
50
+ }
51
+ puts "added #{count} files to #{zipfilename}"
52
+ end
53
+ end
54
+ else
55
+ puts "rubyzip gem is not installed 'gem install rubyzip'"
56
+ end
57
+ end
58
+
59
+ def self.unzip(zipfilename,directory)
60
+ if Gem::Specification::find_all_by_name('rubyzip').any?
61
+ require 'zip'
62
+ count = 0
63
+ Zip::File.open(zipfilename) do |zip_file|
64
+ zip_file.each do |entry|
65
+ dest = "#{directory}/#{entry.to_s}"
66
+ parent_dir=File.dirname(dest)
67
+ FileUtils.mkdir_p parent_dir if(!Dir.exists?(parent_dir))
68
+ entry.extract("#{directory}/#{entry.to_s}")
69
+ count = count + 1
70
+ end
71
+ end
72
+ puts "extracted #{count} files to #{directory}"
73
+ else
74
+ puts "rubyzip gem is not installed 'gem install rubyzip'"
75
+ end
76
+ end
77
+
78
+ def self.copy_files(src_dir,glob_pattern,exclude_patterns,target_dir)
79
+ if(Dir.exists?(src_dir))
80
+ Dir.chdir(src_dir) do
81
+ Dir.glob(glob_pattern).each{|f|
82
+ if(File.file?(f))
83
+ exclude = false
84
+ if(!exclude_patterns.nil?)
85
+ exclude_patterns.each{|p|
86
+ exclude = true if(f.include?(p))
87
+ }
88
+ end
89
+ if(!exclude)
90
+ dest = "#{target_dir}/#{f}"
91
+ FileUtils.mkdir_p(File.dirname(dest)) if(!Dir.exists?(File.dirname(dest)))
92
+ FileUtils.cp(f,dest)
93
+ end
94
+ end
95
+ }
96
+ end
97
+ end
98
+ end
99
99
  end
data/lib/base/file.rb CHANGED
@@ -1,35 +1,35 @@
1
- puts __FILE__ if defined?(DEBUG)
2
-
3
- require 'fileutils'
4
-
5
- class File
6
- def self.amalgamate filename,source
7
- File.open(filename,'w'){|file|
8
- source.each{|source_file|
9
- file.puts IO.read(source_file)
10
- }
11
- }
12
- end
13
-
14
- def self.publish destination, source_dir, source_glob='**/*', overwrite_existing=false
15
-
16
- output = "\n"
17
- FileUtils.mkdir_p destination if !File.exists? destination
18
-
19
- files=nil
20
- Dir.chdir(source_dir) do
21
- files=FileList.new(source_glob).to_a
22
- end
23
- output = output + "\nfiles: #{files}.to_s"
24
-
25
- Dir.chdir(source_dir) do
26
- files.each{|f|
27
- file="#{destination}/#{f}"
28
- dirname=File.dirname(file)
29
- FileUtils.mkdir_p dirname if !File.exists? dirname
30
- FileUtils.cp(f,file) if !File.exists? file || overwrite_existing
31
- }
32
- end
33
- output
34
- end
1
+ puts __FILE__ if defined?(DEBUG)
2
+
3
+ require 'fileutils'
4
+
5
+ class File
6
+ def self.amalgamate filename,source
7
+ File.open(filename,'w'){|file|
8
+ source.each{|source_file|
9
+ file.puts IO.read(source_file)
10
+ }
11
+ }
12
+ end
13
+
14
+ def self.publish destination, source_dir, source_glob='**/*', overwrite_existing=false
15
+
16
+ output = "\n"
17
+ FileUtils.mkdir_p destination if !File.exists? destination
18
+
19
+ files=nil
20
+ Dir.chdir(source_dir) do
21
+ files=FileList.new(source_glob).to_a
22
+ end
23
+ output = output + "\nfiles: #{files}.to_s"
24
+
25
+ Dir.chdir(source_dir) do
26
+ files.each{|f|
27
+ file="#{destination}/#{f}"
28
+ dirname=File.dirname(file)
29
+ FileUtils.mkdir_p dirname if !File.exists? dirname
30
+ FileUtils.cp(f,file) if !File.exists? file || overwrite_existing
31
+ }
32
+ end
33
+ output
34
+ end
35
35
  end
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