sixcore 0.3.3 → 0.3.4

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.
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ require 'rake/testtask'
13
13
  spec = Gem::Specification.new do |s|
14
14
  s.name = 'sixcore'
15
15
  s.rubyforge_project = s.name
16
- s.version = '0.3.3'
16
+ s.version = '0.3.4'
17
17
  s.has_rdoc = true
18
18
  s.extra_rdoc_files = ['README', 'LICENSE']
19
19
  s.summary = 'Basic Function Library for other six projects'
@@ -23,8 +23,8 @@ spec = Gem::Specification.new do |s|
23
23
  s.homepage = 'http://6thsense.eu'
24
24
  # s.executables = ['your_executable_here']
25
25
  s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,lib,spec}/**/*.rb") + Dir.glob("{bin,lib,spec}/**/*.yaml")
26
- s.require_path = "lib"
27
- s.bindir = "bin"
26
+ s.require_path = 'lib'
27
+ s.bindir = 'bin'
28
28
  end
29
29
 
30
30
  Rake::GemPackageTask.new(spec) do |p|
@@ -36,8 +36,8 @@ end
36
36
  Rake::RDocTask.new do |rdoc|
37
37
  files =['README', 'LICENSE', 'lib/**/*.rb']
38
38
  rdoc.rdoc_files.add(files)
39
- rdoc.main = "README" # page to start on
40
- rdoc.title = "sixcore Docs"
39
+ rdoc.main = 'README' # page to start on
40
+ rdoc.title = 'sixcore Docs'
41
41
  rdoc.rdoc_dir = 'doc/rdoc' # rdoc output folder
42
42
  rdoc.options << '--line-numbers'
43
43
  end
@@ -1 +1 @@
1
- PROGRAM_NSIS = "C:\\Program Files (x86)\\NSIS\\makensis.exe"
1
+ PROGRAM_NSIS = 'C:\\Program Files (x86)\\NSIS\\makensis.exe'
@@ -2,5 +2,4 @@ INFO = true
2
2
  DEBUG = false
3
3
  LOG = true
4
4
  VERBOSE = false
5
- CLEAN_LOG = true
6
- LOGFILE = "temp.log"
5
+ CLEAN_LOG = true
@@ -1 +1 @@
1
- SVN_BIN = "svn"
1
+ SVN_BIN = 'svn'
data/lib/sixcore/ftp.rb CHANGED
@@ -12,8 +12,8 @@ module SixCore
12
12
  # host:: String, Hostname
13
13
  # user:: String, Username
14
14
  # pass:: String, Password
15
- def initialize(host, user = "", pass = "")
16
- SixCore::debugs "#{COMPONENT} Initialize"
15
+ def initialize(host, user = '', pass = '')
16
+ SixCore::debugs('Initialize', COMPONENT)
17
17
  SixCore::debug "Creating connection to ftp://#{user}:#{pass}@#{host} ..."
18
18
  @host = host
19
19
  @user = user
@@ -26,16 +26,16 @@ module SixCore
26
26
  # filename:: String, Filename
27
27
  # localpath:: String, Localpath
28
28
  # remotepath:: String, Remotepath
29
- def get(filename = "", localpath = "", remotepath = "")
29
+ def get(filename = '', localpath = '', remotepath = '')
30
30
  SixCore::debug "Downloading #{filename} from #{@host}#{remotepath} ..."
31
- @ftp.getbinaryfile("#{remotepath}#{filename}", "#{localpath}#{filename}", 1024) unless filename == ""
31
+ @ftp.getbinaryfile("#{remotepath}#{filename}", "#{localpath}#{filename}", 1024) unless filename == ''
32
32
  end
33
33
 
34
34
  # Renames file on FTP
35
35
  # filename:: String, Filename
36
36
  # newfn:: String, New Filename
37
37
  # remotepath:: String, Remotepath
38
- def rename(filename = "", newfn = "", remotepath = "")
38
+ def rename(filename = '', newfn = '', remotepath = '')
39
39
  @ftp.rename("#{remotepath}#{filename}", "#{remotepath}#{newfn}")
40
40
  end
41
41
 
@@ -45,11 +45,11 @@ module SixCore
45
45
  # remotepath:: String, Remotepath
46
46
  # temp:: Boolean, When true, Uploads file as #{filename}_tmp
47
47
  # staytemp:: Boolean, When true, Uploaded file will remain as _tmp even after finishing
48
- def put(filename = "", localpath = "", remotepath = "", temp = false, staytemp = false)
48
+ def put(filename = '', localpath = '', remotepath = '', temp = false, staytemp = false)
49
49
  file = filename
50
50
  file = "#{file}_tmp" if temp
51
51
  SixCore::debug "Uploading #{filename} to #{@host}#{remotepath} ..."
52
- @ftp.putbinaryfile("#{localpath}#{filename}", "#{remotepath}#{file}", 1024) unless filename == ""
52
+ @ftp.putbinaryfile("#{localpath}#{filename}", "#{remotepath}#{file}", 1024) unless filename == ''
53
53
  @ftp.rename("#{remotepath}#{file}", "#{remotepath}#{filename}") if temp && !staytemp
54
54
  end
55
55
  end
data/lib/sixcore/nsis.rb CHANGED
@@ -14,36 +14,36 @@ module SixCore
14
14
  def initialize(template, output)
15
15
  @template = template
16
16
  @output = output
17
- SixCore::debug("Initialize", COMPONENT, [template, output])
17
+ SixCore::debug('Initialize', COMPONENT, [template, output])
18
18
  end
19
19
 
20
20
  # Creates the NSIS Setup output file
21
21
  # replace:: Array, Per Entry: [Search, Replace]
22
22
  def create_output(replace = [])
23
- SixCore::debug("Build", COMPONENT, replace)
23
+ SixCore::debug('Build', COMPONENT, replace)
24
24
 
25
25
  # Read NSIS template file
26
- nsis = File.open("#{@template}") do |file|
26
+ nsis = File.open(@template) do |file|
27
27
  file.read
28
28
  end
29
29
 
30
30
  # exchange regex for new strings
31
- SixCore::debug("Replacing regex...", COMPONENT, [@output, replace])
31
+ SixCore::debug('Replacing regex...', COMPONENT, [@output, replace])
32
32
  nsis = SixCore::gsub_ar(nsis, replace) unless replace.empty?
33
33
 
34
34
  # write new nsis file
35
- SixCore::debug("Creating new nsis file...", COMPONENT, @output)
36
- newfile = File.new("#{@output}", "w")
37
- newfile.write nsis
38
- newfile.close
35
+ SixCore::debug('Creating new nsis file...', COMPONENT, @output)
36
+ File.new(@output, 'w') do |f|
37
+ f.write nsis
38
+ end
39
39
 
40
40
  # compile new nsis file
41
- SixCore::debug("Creating output exe...", COMPONENT)
41
+ SixCore::debug('Creating output exe...', COMPONENT)
42
42
  r = SixCore::proc_cmd("\"#{PROGRAM_NSIS}\" \"#{@output}\"")
43
43
  r.each do |l|
44
44
  # TODO: Regex?
45
- if l.gsub("Error - aborting creation process", "") != l
46
- raise "Failed creating NSIS Installed"
45
+ if l =~ /Error \- aborting creation process/
46
+ raise 'Failed creating NSIS Installed'
47
47
  end
48
48
  end
49
49
 
data/lib/sixcore/svn.rb CHANGED
@@ -12,7 +12,7 @@ module SixCore
12
12
  # repos:: String, Repository folder or URL
13
13
  # user:: String, Username
14
14
  # pass:: String, Password
15
- def initialize(repos = "", user = "", pass = "")
15
+ def initialize(repos = '', user = '', pass = '')
16
16
  @repos = repos
17
17
  @user = user
18
18
  @pass = pass
@@ -21,7 +21,7 @@ module SixCore
21
21
  # Command Execution function
22
22
  # cmd:: Command to execute, excl repositor, username, password
23
23
  def cmd(cmd)
24
- SixCore::debug("Command", COMPONENT, cmd)
24
+ SixCore::debug('Command', COMPONENT, cmd)
25
25
  cmd = "#{cmd} #{@repos}" unless @repos.empty?
26
26
  cmd = "#{cmd} --username #{@user}" unless @user.empty?
27
27
  cmd = "#{cmd} --password #{@pass}" unless @pass.empty?
@@ -34,26 +34,26 @@ module SixCore
34
34
  # old:: String or Integer, start revision number
35
35
  # new:: String or Integer, end revision number
36
36
  def diff(old, new)
37
- r = cmd("diff -r #{old}:#{new} --summarize").split("\n")
37
+ r = cmd("diff -r #{old}:#{new} --summarize").split('\n')
38
38
  return r
39
39
  end
40
40
 
41
41
  # Fetches SVN info
42
42
  def info()
43
- r = cmd("info").split("\n")
43
+ r = cmd('info').split('\n')
44
44
  return r
45
45
  end
46
46
 
47
47
  # Fetches SVN List
48
48
  def list()
49
- r = cmd("list").split("/\n")
49
+ r = cmd('list').split('/\n')
50
50
  return r
51
51
  end
52
52
 
53
53
  # Executes SVN Update
54
54
  # Returns Array of Strings
55
55
  def update()
56
- r = cmd("update").split("\n")
56
+ r = cmd('update').split('\n')
57
57
  return r
58
58
  end
59
59
 
@@ -62,7 +62,7 @@ module SixCore
62
62
  # new:: String or Integer, end revision number
63
63
  # Returns Array of Strings (log)
64
64
  def log(old, new)
65
- r = cmd("log -r#{old}:#{new}").split("\n")
65
+ r = cmd("log -r#{old}:#{new}").split('\n')
66
66
  return r
67
67
  end
68
68
 
@@ -104,11 +104,9 @@ module SixCore
104
104
  # Returns revision number
105
105
  def read_rev()
106
106
  inf = info()
107
- r = [nil, nil]
108
- inf.each do |l|
109
- r = /Revision\: (.*)/.match(l) if /Revision\: (.*)/.match(l) != nil
107
+ inf.each do |line|
108
+ return $1 if line[/Revision\: (.*)/]
110
109
  end
111
- return r[1]
112
110
  end
113
111
 
114
112
 
@@ -117,18 +115,18 @@ module SixCore
117
115
  # folders:: Boolean, include folders?
118
116
  # slash:: String, what type of file system / \ should be used
119
117
  # Returns Array, Per Entry format: [integer, formatted entry string]
120
- def parse_entry(entry, folders = true, slash = "\\")
118
+ def parse_entry(entry, folders = true, slash = '\\')
121
119
  # TODO: slash!
122
120
  # substract everything after first \
123
121
  if folders
124
- entrymod = entry.gsub(/\\(.*)/, "")
122
+ entrymod = entry.gsub(/\\(.*)/, '')
125
123
  else
126
124
  entrymod = entry
127
125
  end
128
126
 
129
127
  case entrymod
130
128
  when /A /
131
- entrymod.gsub!(/A /, "")
129
+ entrymod.gsub!(/A /, '')
132
130
  if folders and entry =~ /(.*)\\(.*)/
133
131
  # subfolder, so it's a change
134
132
  return [1, entrymod]
@@ -136,10 +134,10 @@ module SixCore
136
134
  return [0, entrymod]
137
135
  end
138
136
  when /M /
139
- entrymod.gsub!(/M /, "")
137
+ entrymod.gsub!(/M /, '')
140
138
  return [1, entrymod]
141
139
  when /D /
142
- entrymod.gsub!(/D /, "")
140
+ entrymod.gsub!(/D /, '')
143
141
  if folders and entry =~ /(.*)\\(.*)/
144
142
  # subfolder, so it's a change
145
143
  if entry =~ /(.*)\.pbo(.*)/
data/lib/sixcore.rb CHANGED
@@ -29,7 +29,7 @@ module SixCore
29
29
 
30
30
  @@log.outputters << o_out << o_err
31
31
 
32
- # @@log = File.new(LOGFILE, "a")
32
+ # @@log = File.new(LOGFILE, 'a')
33
33
  # @@log.sync = true
34
34
 
35
35
  module_function
@@ -41,7 +41,7 @@ module SixCore
41
41
  # Halts operation waiting for user input <enter>
42
42
  def halt()
43
43
  puts
44
- puts "Press enter to continue"
44
+ puts 'Press enter to continue'
45
45
  gets
46
46
  end
47
47
 
@@ -63,10 +63,10 @@ module SixCore
63
63
  str = "#{component} - #{str}" unless component.empty?
64
64
  case type
65
65
  when 0
66
- str += " - " + verbose.to_s if VERBOSE and verbose != ""
66
+ str += ' - ' + verbose.to_s if VERBOSE and verbose != ''
67
67
  when 1
68
68
  str = "(#{Time.now().strftime('%H:%M:%S')}) #{str}"
69
- str += " - " + verbose.to_s if VERBOSE and verbose != ""
69
+ str += ' - ' + verbose.to_s if VERBOSE and verbose != ''
70
70
  str = "=== #{str} ==="
71
71
  end
72
72
  return str
@@ -76,7 +76,7 @@ module SixCore
76
76
  # str:: String, Input
77
77
  # component:: String, Component
78
78
  # verbose:: String, Verbose (Only displayed when VERBOSE is true)
79
- def info(str, component = "", verbose = "")
79
+ def info(str, component = '', verbose = '')
80
80
  unless str.empty?
81
81
  @@log.info prep_msg(str, component, verbose, 0)
82
82
  end
@@ -86,7 +86,7 @@ module SixCore
86
86
  # str:: String, Input
87
87
  # component:: String, Component
88
88
  # verbose:: String, Verbose (Only displayed when VERBOSE is true)
89
- def infos(str, component = "", verbose = "")
89
+ def infos(str, component = '', verbose = '')
90
90
  unless str.empty?
91
91
  puts
92
92
  @@log.info prep_msg(str, component, verbose, 1)
@@ -97,7 +97,7 @@ module SixCore
97
97
  # str:: String, Input
98
98
  # component:: String, Component
99
99
  # verbose:: String, Verbose (Only displayed when VERBOSE is true)
100
- def debug(str, component = "", verbose = "")
100
+ def debug(str, component = '', verbose = '')
101
101
  unless str.empty? || !DEBUG
102
102
  puts
103
103
  @@log.debug prep_msg(str, component, verbose, 0)
@@ -108,7 +108,7 @@ module SixCore
108
108
  # str:: String, Input
109
109
  # component:: String, Component
110
110
  # verbose:: String, Verbose (Only displayed when VERBOSE is true)
111
- def debugs(str, component = "", verbose = "")
111
+ def debugs(str, component = '', verbose = '')
112
112
  unless str.empty? || !DEBUG
113
113
  puts
114
114
  @@log.debug prep_msg(str, component, verbose, 1)
@@ -136,7 +136,7 @@ module SixCore
136
136
  # cmd:: String, command to eval
137
137
  def eval_cmd(cmd)
138
138
  eval cmd unless DEBUG or cmd.empty?
139
- SixCore::debug("Eval Command", COMPONENT, cmd)
139
+ SixCore::debug('Eval Command', COMPONENT, cmd)
140
140
  end
141
141
 
142
142
  # Executes system command and logs to debug if enabled
@@ -144,7 +144,7 @@ module SixCore
144
144
  def proc_cmd(cmd)
145
145
  unless DEBUG or cmd.empty?
146
146
  r = (%x[#{cmd}])
147
- SixCore::debug("Proc Command", COMPONENT, [cmd, r])
147
+ SixCore::debug('Proc Command', COMPONENT, [cmd, r])
148
148
  return r
149
149
  end
150
150
  end
@@ -153,8 +153,8 @@ module SixCore
153
153
  # source:: String, Source folder
154
154
  # destination:: String, Destination folder
155
155
  # extra:: Extra parameters to supply to Robocopy
156
- def fileupdate(source, destination, extra = "")
157
- debug("Updating Files...", COMPONENT, [source, destination, extra])
156
+ def fileupdate(source, destination, extra = '')
157
+ debug('Updating Files...', COMPONENT, [source, destination, extra])
158
158
  proc_cmd("robocopy #{source} #{destination} /S /TIMFIX /ZB /R:5 /W:5 #{extra}")
159
159
  end
160
160
 
@@ -162,8 +162,8 @@ module SixCore
162
162
  # source:: String, Source folder
163
163
  # destination:: String, Destination folder
164
164
  # extra:: Extra parameters to supply to Robocopy
165
- def filemirror(source, destination, extra = "")
166
- debug("Mirroring Files...", COMPONENT, [source, destination, extra])
165
+ def filemirror(source, destination, extra = '')
166
+ debug('Mirroring Files...', COMPONENT, [source, destination, extra])
167
167
  proc_cmd("robocopy #{source} #{destination} /MIR /TIMFIX /ZB /R:5 /W:5 #{extra}")
168
168
  end
169
169
 
@@ -171,7 +171,7 @@ module SixCore
171
171
  # source:: String, Source folder
172
172
  # destination:: String, Destination folder
173
173
  def filecopy(source, destination)
174
- debug("Copying Files...", COMPONENT, [source, destination])
174
+ debug('Copying Files...', COMPONENT, [source, destination])
175
175
  proc_cmd("copy /y \"#{source}\" \"#{destination}\\\"")
176
176
  end
177
177
 
@@ -179,18 +179,18 @@ module SixCore
179
179
  # source:: String, Source folder
180
180
  # destination:: String, Destination folder
181
181
  def filemove(source, destination)
182
- debug("Moving Files...", COMPONENT, [source, destination])
182
+ debug('Moving Files...', COMPONENT, [source, destination])
183
183
  proc_cmd("move /y \"#{source}\" \"#{destination}\"")
184
184
  end
185
185
 
186
186
  # Deletes files from source
187
187
  # source:: String, Source folder
188
188
  def filedel(source)
189
- debug("Deleting Files...", COMPONENT, [source])
189
+ debug('Deleting Files...', COMPONENT, [source])
190
190
  proc_cmd("del /f /q #{source}")
191
191
  end
192
192
  end
193
193
 
194
194
  component = '6thSense.eu Core'
195
- version = '0.3.3'
195
+ version = '0.3.4'
196
196
  SixCore::debugs "#{component} #{version} loaded"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sixcore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sickboy
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-29 00:00:00 +01:00
12
+ date: 2008-11-30 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15