xqcoretools 0.0.3 → 0.0.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.
Files changed (2) hide show
  1. data/bin/xqcoretools +23 -24
  2. metadata +2 -2
data/bin/xqcoretools CHANGED
@@ -38,38 +38,37 @@ class XQCoreTools < Thor
38
38
 
39
39
  desc "bundle [OUTPUT] [PATHS]", "Adds files to an existing bundle"
40
40
  def bundle(output, paths)
41
- if Dir.exists? output
42
- puts "Output must point to an existing bundle"
43
- return;
44
- end
41
+ contentDirectory = "#{output}/content"
45
42
 
46
- contentDirectory = "${output}/content"
43
+ FileUtils.rm_r(contentDirectory, :force=>true)
47
44
 
48
- FileUtils.rm(contentDirectory, :force=>true)
49
-
50
- pathList = paths.split(';')
45
+ FileUtils.mkdir(contentDirectory)
51
46
 
52
- puts "BUNDLE: #{output}"
47
+ pathList = paths.split(';')
48
+ packagesList = []
53
49
 
54
50
  pathList.each do |path|
55
- FileUtils.copy path contentDirectory
56
-
57
- XQCoreTools::logFilesRecursive(path)
58
- end
59
- end
60
-
61
- def self.logFilesRecursive(path, base = '')
62
- Dir.foreach(path) do |item|
63
- subPath = "#{path}/#{item}"
64
- relPath = base == '' ? item : "#{base}/#{item}"
65
- if File.file? subPath
66
- puts "COPYING: #{relPath}"
67
- else
68
- if item != '.' && item != '..'
69
- XQCoreTools::logFilesRecursive(subPath, relPath)
51
+ Dir.foreach(path) do |item|
52
+ subPath = "#{path}/#{item}"
53
+ if File.file? subPath
54
+ if item != '.DS_Store'
55
+ packagesList.push subPath
56
+ end
57
+ else
58
+ if item != '.' && item != '..'
59
+ packagesList.push subPath
60
+ end
70
61
  end
71
62
  end
72
63
  end
64
+
65
+ puts "BUNDLE: #{output}"
66
+
67
+ packagesList.each do |package|
68
+ FileUtils.cp_r(package, contentDirectory)
69
+
70
+ puts "COPYING: #{package}"
71
+ end
73
72
  end
74
73
  end
75
74
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mark Wong