summaryrefslogtreecommitdiffhomepage
path: root/tasks/ruby_ext.rake
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-07-29 07:15:10 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-07-29 07:15:10 +0900
commitc8fdab8725d58375ccdbd9816e48fdb021a199d4 (patch)
tree95546b572463e02463fc765dd5fccedc9a30a066 /tasks/ruby_ext.rake
parentb290e98f3b4e8623fd8932c9996d0481f56f766b (diff)
parente821c25d387b12805d3f3d773380b44e32c0d1f7 (diff)
downloadmruby-c8fdab8725d58375ccdbd9816e48fdb021a199d4.tar.gz
mruby-c8fdab8725d58375ccdbd9816e48fdb021a199d4.zip
Merge branch 'udzura-move-task-class-definitions'
Diffstat (limited to 'tasks/ruby_ext.rake')
-rw-r--r--tasks/ruby_ext.rake79
1 files changed, 0 insertions, 79 deletions
diff --git a/tasks/ruby_ext.rake b/tasks/ruby_ext.rake
deleted file mode 100644
index 4c6d3ca76..000000000
--- a/tasks/ruby_ext.rake
+++ /dev/null
@@ -1,79 +0,0 @@
-class Object
- class << self
- def attr_block(*syms)
- syms.flatten.each do |sym|
- class_eval "def #{sym}(&block);block.call(@#{sym}) if block_given?;@#{sym};end"
- end
- end
- end
-end
-
-class String
- def relative_path_from(dir)
- Pathname.new(File.expand_path(self)).relative_path_from(Pathname.new(File.expand_path(dir))).to_s
- end
-
- def relative_path
- relative_path_from(Dir.pwd)
- end
-
- # Compatible with 1.9 on 1.8
- def %(params)
- if params.is_a?(Hash)
- str = self.clone
- params.each do |k, v|
- str.gsub!("%{#{k}}") { v }
- end
- str
- else
- if params.is_a?(Array)
- sprintf(self, *params)
- else
- sprintf(self, params)
- end
- end
- end
-end
-
-class Symbol
- # Compatible with 1.9 on 1.8
- def to_proc
- proc { |obj, *args| obj.send(self, *args) }
- end
-end
-
-module Enumerable
- # Compatible with 1.9 on 1.8
- def each_with_object(memo)
- return to_enum :each_with_object, memo unless block_given?
- each { |obj| yield obj, memo }
- memo
- end
-end
-
-$pp_show = true
-
-if $verbose.nil?
- if Rake.respond_to?(:verbose) && !Rake.verbose.nil?
- if Rake.verbose.class == TrueClass
- # verbose message logging
- $pp_show = false
- else
- $pp_show = true
- Rake.verbose(false)
- end
- else
- # could not identify rake version
- $pp_show = false
- end
-else
- $pp_show = false if $verbose
-end
-
-def _pp(cmd, src, tgt=nil, options={})
- return unless $pp_show
-
- width = 5
- template = options[:indent] ? "%#{width*options[:indent]}s %s %s" : "%-#{width}s %s %s"
- puts template % [cmd, src, tgt ? "-> #{tgt}" : nil]
-end