rmk-ruby 0.1.1 → 0.2.0

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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/exe/rmk +28 -34
  3. data/lib/rmk/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2f8e946c94da26efa07f21a22538d1c03a41def9990c7a51123366fff63f6dc
4
- data.tar.gz: 6484a1d3da557c05b7b8b9356fd99f319ede7616e65122282fbf0f19add6f3c0
3
+ metadata.gz: 3493f1bf596eaa8ded4e0fa5fedf9dfb2466225e56d905e6a39110f403d024e3
4
+ data.tar.gz: 6b367be611ddf7a97ff77a9c3f7d4a128c82cc538edee17e5083f8fda9390bcc
5
5
  SHA512:
6
- metadata.gz: 1ce6f5455e2e95323c1222fbb3ddb7f2c17f93f773789fff69810ae5103dbe62f5b35b004eec91805248721c5d85a004011e1e6d57e1ef11deef423dff4a7d3f
7
- data.tar.gz: 6aea3ab211a8297850136e56deaeb6c735d5716863c93eb9ee3b5f86adfa567b33d9b01529f8c20696efe64f76f4a98e8e77565b5645a449d978b82d2dda4a83
6
+ metadata.gz: f92c924b833147271a64d082f955957bd0c58e58fa0de3f0151a852e4280d6c4cfdb4d2a37cb4d20a41b7ece6d1d1962c0f61b3402e8758c5aaf7d494ac8fe45
7
+ data.tar.gz: 85771986004ab0d4f42a8f4889d27d4382d53c8319e32e92fd77f730e5f2990c34cc2d29404b1025a8988ad48abaf8a0bf0d3efaae1cb7ebad17604508994fb0
data/exe/rmk CHANGED
@@ -44,54 +44,48 @@ targets = parser.parse(ARGV)
44
44
  Dir.chdir options[:prjroot] if options[:prjroot]
45
45
  options_file = '.rmk/options'
46
46
  loaded_options = File.exist?(options_file) ? Marshal.load(IO.binread options_file) : {}
47
- changed = false
48
- %i(outroot srcroot link name).each do |key|
49
- next changed = true if cache_options.include? key
50
- next cache_options[key] = loaded_options[key] if loaded_options[key]
51
- changed = true
52
- end
53
- cache_options[:outroot] ||= '_Build'
54
- cache_options[:srcroot] ||= '..'
55
- cache_options[:name] ||= File.basename Dir.pwd
56
- cache_options[:link] ||= File.join ENV['TMP'], cache_options[:name]
57
- if changed
47
+ if cache_options.empty?
48
+ cache_options = loaded_options
49
+ elsif cache_options.any?{|k, v| v != loaded_options[k]}
58
50
  Dir.mkdir '.rmk' unless Dir.exist? '.rmk'
59
51
  IO.binwrite options_file, Marshal.dump(cache_options)
60
52
  end
61
- dir, link = cache_options[:outroot], cache_options[:link]
53
+ srcroot = cache_options[:srcroot] || '..'
54
+ outroot = cache_options[:outroot] || '_Build'
55
+ link = cache_options[:link] || File.join(ENV['TMP'], cache_options[:name] || File.basename(Dir.pwd))
62
56
  if link && link != '/'
63
57
  require 'fileutils'
64
58
  link = link.gsub(/\$(?:(\$)|{(.*?)})/){$1 || ENV[$2]}.gsub! ?\\, ?\/
65
59
  FileUtils.mkpath link unless Dir.exist? link
66
- if File.symlink? dir
67
- if File.readlink(dir) != link
68
- Dir.rmdir dir
69
- File.symlink link, dir
60
+ if File.symlink? outroot
61
+ if File.readlink(outroot) != link
62
+ Dir.rmdir outroot
63
+ File.symlink link, outroot
70
64
  end
71
- elsif Dir.exist?(dir) || File.exist?(dir)
72
- raise "need symlink '#{dir}' as outroot, but file(or dir) '#{dir}' already exist"
65
+ elsif Dir.exist?(outroot) || File.exist?(outroot)
66
+ raise "need symlink '#{outroot}' as outroot, but file(or dir) '#{outroot}' already exist"
73
67
  else
74
- FileUtils.mkpath File.dirname dir
75
- File.symlink link, dir
68
+ FileUtils.mkpath File.dirname outroot
69
+ File.symlink link, outroot
76
70
  end
77
71
  else
78
- FileUtils.mkpath dir
72
+ FileUtils.mkpath outroot
79
73
  end
80
74
  variants = options[:variants]
81
- if variants && variants.size != 1
82
- targets = targets.map{|tgt| %|"#{tgt}"|}.join ' '
83
- exe = File.join RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name']
84
- thrs = []
85
- variants.each {|name| thrs << Thread.new {system %|"#{exe}" "#{__FILE__}" -V #{name} #{targets}|}}
86
- thrs.each{|thr| thr.join}
87
- exit
88
- end
89
75
  if variants
90
- variants = variants[0]
91
- src = cache_options[:srcroot].match?(/^[a-z]:\//i) ? cache_options[:srcroot] : File.join('..', cache_options[:srcroot])
92
- rmk = Rmk.new srcroot:src, outroot:File.join(cache_options[:outroot], variants), variant:variants
93
- else
94
- rmk = Rmk.new srcroot:cache_options[:srcroot], outroot:cache_options[:outroot]
76
+ if variants.size == 1
77
+ variants = variants[0]
78
+ outroot = File.join outroot, variants
79
+ srcroot = File.join '..', srcroot unless srcroot.match?(/^[a-z]:\//i)
80
+ else
81
+ targets = targets.map{|tgt| %|"#{tgt}"|}.join ' '
82
+ exe = File.join RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name']
83
+ thrs = []
84
+ variants.each {|name| thrs << Thread.new {system %|"#{exe}" "#{__FILE__}" -V #{name} #{targets}|}}
85
+ thrs.each{|thr| thr.join}
86
+ exit
87
+ end
95
88
  end
89
+ rmk = Rmk.new srcroot:srcroot, outroot:outroot, variant:variants
96
90
  rmk.parse
97
91
  rmk.build *targets
data/lib/rmk/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Rmk
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rmk-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - pbl