facets 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ProjectInfo +32 -25
- data/data/facets/index.yml +30 -6
- data/data/facets/units/binary/base.yaml +12 -0
- data/data/facets/units/binary/extra.yaml +8 -0
- data/data/facets/units/cex.yaml +7 -0
- data/data/facets/units/currency/base.yaml +268 -0
- data/data/facets/units/default.yaml +22 -0
- data/data/facets/units/dump_yaml.rb +309 -0
- data/data/facets/units/si/base.yaml +36 -0
- data/data/facets/units/si/derived.yaml +133 -0
- data/data/facets/units/si/extra.yaml +107 -0
- data/data/facets/units/standard.yaml +5 -0
- data/data/facets/units/uk.yaml +16 -0
- data/data/facets/units/uk/base.yaml +107 -0
- data/data/facets/units/us.yaml +16 -0
- data/data/facets/units/us/base.yaml +112 -0
- data/data/facets/units/xmethods/cached.yaml +83 -0
- data/data/facets/units/xmethods/mapping.yaml +85 -0
- data/lib/facet/array/join_sentence.rb +1 -0
- data/lib/facet/class/cattr.rb +1 -0
- data/lib/facet/class/cattr_accessor.rb +1 -0
- data/lib/facet/class/cattr_reader.rb +1 -0
- data/lib/facet/class/cattr_writer.rb +1 -0
- data/lib/facet/elementor.rb +1 -0
- data/lib/facet/enumerable/accumulate.rb +1 -0
- data/lib/facet/enumerable/collect_if.rb +1 -0
- data/lib/facet/enumerable/map_if.rb +1 -0
- data/lib/facet/file/self/append.rb +1 -0
- data/lib/facet/file/self/read_binary.rb +1 -0
- data/lib/facet/file/self/write.rb +1 -0
- data/lib/facet/json.rb +1 -0
- data/lib/facet/kernel/__self__.rb +1 -0
- data/lib/facet/kernel/methodname.rb +1 -0
- data/lib/facet/module/attr_query.rb +1 -0
- data/lib/facet/module/attr_validator.rb +1 -0
- data/lib/facet/module/inherit.rb +1 -0
- data/lib/facet/module/let.rb +1 -0
- data/lib/facet/module/mattr.rb +1 -0
- data/lib/facet/module/mattr_accessor.rb +1 -0
- data/lib/facet/module/mattr_reader.rb +1 -0
- data/lib/facet/module/mattr_writer.rb +1 -0
- data/lib/facet/module/singleton_to_module.rb +1 -0
- data/lib/facet/nilclass/op_cmp.rb +1 -0
- data/lib/facet/nilclass/succ.rb +1 -0
- data/lib/facet/recorder.rb +1 -0
- data/lib/facet/xoxo.rb +1 -0
- data/lib/facets/core/array.rb +1 -0
- data/lib/facets/core/array/join_sentence.rb +12 -0
- data/lib/facets/core/class.rb +4 -0
- data/lib/facets/core/{module → class}/cattr.rb +7 -9
- data/lib/facets/core/class/cattr_accessor.rb +2 -0
- data/lib/facets/core/class/cattr_reader.rb +3 -0
- data/lib/facets/core/class/cattr_writer.rb +2 -0
- data/lib/facets/core/dir/self/ls_r.rb +4 -9
- data/lib/facets/core/enumerable.rb +3 -0
- data/lib/facets/core/enumerable/accumulate.rb +25 -0
- data/lib/facets/core/enumerable/collect_if.rb +15 -0
- data/lib/facets/core/enumerable/ew.rb +1 -5
- data/lib/facets/core/enumerable/map_if.rb +3 -0
- data/lib/facets/core/file.rb +3 -0
- data/lib/facets/core/file/self/append.rb +8 -0
- data/lib/facets/core/file/self/create.rb +14 -8
- data/lib/facets/core/file/self/open_as_string.rb +31 -13
- data/lib/facets/core/file/self/read_binary.rb +8 -0
- data/lib/facets/core/file/self/read_list.rb +11 -7
- data/lib/facets/core/file/self/write.rb +8 -0
- data/lib/facets/core/fileutils/wc.rb +4 -9
- data/lib/facets/core/fileutils/which.rb +4 -9
- data/lib/facets/core/kernel.rb +2 -1
- data/lib/facets/core/kernel/__self__.rb +32 -0
- data/lib/facets/core/kernel/as.rb +1 -1
- data/lib/facets/core/kernel/assign_from.rb +3 -3
- data/lib/facets/core/kernel/assign_with.rb +2 -0
- data/lib/facets/core/kernel/me.rb +3 -2
- data/lib/facets/core/kernel/method_name.rb +2 -49
- data/lib/facets/core/kernel/methodname.rb +49 -0
- data/lib/facets/core/module.rb +9 -4
- data/lib/facets/core/module/attr_query.rb +56 -0
- data/lib/facets/core/module/attr_validator.rb +18 -0
- data/lib/facets/core/module/inherit.rb +70 -0
- data/lib/facets/core/module/integrate.rb +1 -1
- data/lib/facets/core/module/let.rb +55 -0
- data/lib/facets/core/module/mattr.rb +180 -0
- data/lib/facets/core/module/{cattr_accessor.rb → mattr_accessor.rb} +0 -0
- data/lib/facets/core/module/{cattr_reader.rb → mattr_reader.rb} +0 -0
- data/lib/facets/core/module/{cattr_writer.rb → mattr_writer.rb} +0 -0
- data/lib/facets/core/module/on_included.rb +3 -1
- data/lib/facets/core/module/singleton_to_module.rb +23 -0
- data/lib/facets/core/nilclass.rb +2 -0
- data/lib/facets/core/string/methodize.rb +4 -3
- data/lib/facets/core/string/modulize.rb +3 -3
- data/lib/facets/more/ansicode.rb +1 -1
- data/lib/facets/more/aspects.rb +1 -1
- data/lib/facets/more/basicobject.rb +67 -22
- data/lib/facets/more/classinherit.rb +2 -2
- data/lib/facets/more/cloneable.rb +1 -1
- data/lib/facets/more/consoleapp.rb +31 -20
- data/lib/facets/more/dictionary.rb +1 -1
- data/lib/facets/more/filelist.rb +2 -10
- data/lib/facets/more/functor.rb +6 -6
- data/lib/facets/more/json.rb +891 -0
- data/lib/facets/more/methodprobe.rb +1 -1
- data/lib/facets/more/multiton.rb +16 -8
- data/lib/facets/more/nilcomparable.rb +31 -49
- data/lib/facets/more/openobject.rb +50 -10
- data/lib/facets/more/recorder.rb +125 -0
- data/lib/facets/more/rtals.rb +199 -4
- data/lib/facets/more/typecast.rb +12 -12
- data/lib/facets/more/units.rb +20 -14
- data/lib/facets/more/xoxo.rb +519 -0
- data/setup.rb +283 -271
- data/test/lib/facets/core/array/test_at_rand.rb +1 -1
- data/test/lib/facets/core/array/test_delete_unless.rb +1 -1
- data/test/lib/facets/core/array/test_delete_values.rb +1 -1
- data/test/lib/facets/core/array/test_delete_values_at.rb +1 -1
- data/test/lib/facets/core/array/test_first.rb +1 -1
- data/test/lib/facets/core/array/test_head.rb +1 -1
- data/test/lib/facets/core/array/test_last_index.rb +1 -1
- data/test/lib/facets/core/array/test_merge.rb +1 -1
- data/test/lib/facets/core/array/test_mid.rb +1 -1
- data/test/lib/facets/core/array/test_middle.rb +1 -1
- data/test/lib/facets/core/array/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/array/test_op_store.rb +1 -1
- data/test/lib/facets/core/array/test_pick.rb +1 -1
- data/test/lib/facets/core/array/test_pos.rb +1 -1
- data/test/lib/facets/core/array/test_pull.rb +1 -1
- data/test/lib/facets/core/array/test_rand_index.rb +1 -1
- data/test/lib/facets/core/array/test_rand_subset.rb +1 -1
- data/test/lib/facets/core/array/test_range.rb +1 -1
- data/test/lib/facets/core/array/test_rotate.rb +1 -1
- data/test/lib/facets/core/array/test_select.rb +1 -1
- data/test/lib/facets/core/array/test_shuffle.rb +1 -1
- data/test/lib/facets/core/array/test_slap.rb +1 -1
- data/test/lib/facets/core/array/test_thru.rb +1 -1
- data/test/lib/facets/core/array/test_to_b.rb +1 -1
- data/test/lib/facets/core/array/test_to_h.rb +1 -1
- data/test/lib/facets/core/array/test_to_hash.rb +1 -1
- data/test/lib/facets/core/binding/self/test_of_caller.rb +1 -1
- data/test/lib/facets/core/binding/test___LINE__.rb +1 -1
- data/test/lib/facets/core/binding/test_call_stack.rb +1 -1
- data/test/lib/facets/core/binding/test_called.rb +1 -1
- data/test/lib/facets/core/binding/test_caller.rb +1 -1
- data/test/lib/facets/core/binding/test_defined.rb +1 -1
- data/test/lib/facets/core/binding/test_eval.rb +1 -1
- data/test/lib/facets/core/binding/test_local_variables.rb +1 -1
- data/test/lib/facets/core/binding/test_method_name.rb +1 -1
- data/test/lib/facets/core/binding/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/binding/test_op_store.rb +1 -1
- data/test/lib/facets/core/binding/test_self.rb +1 -1
- data/test/lib/facets/core/{module/test_cattr_accessor.rb → class/test_cattr.rb} +11 -3
- data/test/lib/facets/core/class/test_descendents.rb +1 -1
- data/test/lib/facets/core/class/test_method_name.rb +1 -1
- data/test/lib/facets/core/class/test_remove_descendents.rb +1 -1
- data/test/lib/facets/core/class/test_unix_path.rb +1 -1
- data/test/lib/facets/core/comparable/test_at_least.rb +1 -1
- data/test/lib/facets/core/comparable/test_clip.rb +1 -1
- data/test/lib/facets/core/comparable/test_cmp.rb +1 -1
- data/test/lib/facets/core/continuation/self/test_create.rb +1 -1
- data/test/lib/facets/core/date/test_days_in_month.rb +1 -1
- data/test/lib/facets/core/date/test_days_of_month.rb +1 -1
- data/test/lib/facets/core/date/test_stamp.rb +1 -1
- data/test/lib/facets/core/date/test_to_date.rb +1 -1
- data/test/lib/facets/core/date/test_to_s.rb +1 -1
- data/test/lib/facets/core/date/test_to_time.rb +1 -1
- data/test/lib/facets/core/dir/self/test_ancestor.rb +1 -1
- data/test/lib/facets/core/dir/self/test_ascend.rb +1 -1
- data/test/lib/facets/core/enumerable/self/test_combinations.rb +1 -1
- data/test/lib/facets/core/enumerable/self/test_cross.rb +1 -1
- data/test/lib/facets/core/enumerable/test_collect_with_index.rb +1 -1
- data/test/lib/facets/core/enumerable/test_commonality.rb +1 -1
- data/test/lib/facets/core/enumerable/test_compact_collect.rb +1 -1
- data/test/lib/facets/core/enumerable/test_cross.rb +1 -1
- data/test/lib/facets/core/enumerable/test_each_combination.rb +1 -1
- data/test/lib/facets/core/enumerable/test_each_pair.rb +1 -1
- data/test/lib/facets/core/enumerable/test_each_slice.rb +1 -1
- data/test/lib/facets/core/enumerable/test_each_unique_pair.rb +1 -1
- data/test/lib/facets/core/enumerable/test_entropy.rb +1 -1
- data/test/lib/facets/core/enumerable/test_every.rb +1 -1
- data/test/lib/facets/core/enumerable/test_ew.rb +1 -1
- data/test/lib/facets/core/enumerable/test_filter_collect.rb +1 -1
- data/test/lib/facets/core/enumerable/test_find_collisions.rb +1 -1
- data/test/lib/facets/core/enumerable/test_frequency.rb +1 -1
- data/test/lib/facets/core/enumerable/test_graph.rb +1 -1
- data/test/lib/facets/core/enumerable/test_ideal_entropy.rb +1 -1
- data/test/lib/facets/core/enumerable/test_none.rb +1 -1
- data/test/lib/facets/core/enumerable/test_occur.rb +1 -1
- data/test/lib/facets/core/enumerable/test_one.rb +1 -1
- data/test/lib/facets/core/enumerable/test_op_pow.rb +1 -1
- data/test/lib/facets/core/enumerable/test_partition_by.rb +1 -1
- data/test/lib/facets/core/enumerable/test_permute.rb +1 -1
- data/test/lib/facets/core/enumerable/test_probability.rb +1 -1
- data/test/lib/facets/core/enumerable/test_to_h.rb +1 -1
- data/test/lib/facets/core/enumerable/test_uniq_by.rb +1 -1
- data/test/lib/facets/core/file/self/test_create.rb +14 -9
- data/test/lib/facets/core/file/self/test_open_as_string.rb +21 -11
- data/test/lib/facets/core/file/self/test_read_list.rb +11 -8
- data/test/lib/facets/core/file/self/test_sanitize.rb +1 -1
- data/test/lib/facets/core/file/self/test_split_all.rb +1 -1
- data/test/lib/facets/core/float/test_round_at.rb +1 -1
- data/test/lib/facets/core/float/test_round_to.rb +1 -1
- data/test/lib/facets/core/hash/self/test_zipnew.rb +1 -1
- data/test/lib/facets/core/hash/test_alias.rb +1 -1
- data/test/lib/facets/core/hash/test_assert_has_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_assert_has_only_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_at.rb +1 -1
- data/test/lib/facets/core/hash/test_collate.rb +1 -1
- data/test/lib/facets/core/hash/test_each.rb +1 -1
- data/test/lib/facets/core/hash/test_each_with_index.rb +1 -1
- data/test/lib/facets/core/hash/test_each_with_key.rb +1 -1
- data/test/lib/facets/core/hash/test_graph.rb +1 -1
- data/test/lib/facets/core/hash/test_has_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_has_only_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_inverse.rb +1 -1
- data/test/lib/facets/core/hash/test_keys_to_s.rb +1 -1
- data/test/lib/facets/core/hash/test_keys_to_sym.rb +1 -1
- data/test/lib/facets/core/hash/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/hash/test_op_lshift.rb +1 -1
- data/test/lib/facets/core/hash/test_rand_key.rb +1 -1
- data/test/lib/facets/core/hash/test_rand_pair.rb +1 -1
- data/test/lib/facets/core/hash/test_rand_value.rb +1 -1
- data/test/lib/facets/core/hash/test_replace_each.rb +1 -1
- data/test/lib/facets/core/hash/test_shuffle.rb +1 -1
- data/test/lib/facets/core/hash/test_slice.rb +1 -1
- data/test/lib/facets/core/hash/test_swap.rb +1 -1
- data/test/lib/facets/core/hash/test_swapkey.rb +1 -1
- data/test/lib/facets/core/hash/test_to_h.rb +1 -1
- data/test/lib/facets/core/hash/test_to_ostruct.rb +1 -1
- data/test/lib/facets/core/hash/test_to_ostruct_recurse.rb +1 -1
- data/test/lib/facets/core/hash/test_traverse.rb +1 -1
- data/test/lib/facets/core/hash/test_update_each.rb +1 -1
- data/test/lib/facets/core/hash/test_update_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_update_values.rb +1 -1
- data/test/lib/facets/core/hash/test_weave.rb +1 -1
- data/test/lib/facets/core/integer/test_factorial.rb +1 -1
- data/test/lib/facets/core/integer/test_multiple.rb +1 -1
- data/test/lib/facets/core/integer/test_ordinal.rb +1 -1
- data/test/lib/facets/core/integer/test_times_collect.rb +1 -1
- data/test/lib/facets/core/kernel/test___class__.rb +1 -1
- data/test/lib/facets/core/kernel/test_as.rb +1 -1
- data/test/lib/facets/core/kernel/test_assign_from.rb +1 -1
- data/test/lib/facets/core/kernel/test_assign_with.rb +1 -1
- data/test/lib/facets/core/kernel/test_bool.rb +1 -1
- data/test/lib/facets/core/kernel/test_bug.rb +1 -1
- data/test/lib/facets/core/kernel/test_call_stack.rb +1 -1
- data/test/lib/facets/core/kernel/test_called.rb +1 -1
- data/test/lib/facets/core/kernel/test_constant.rb +1 -1
- data/test/lib/facets/core/kernel/test_copy.rb +1 -1
- data/test/lib/facets/core/kernel/test_deep_copy.rb +1 -1
- data/test/lib/facets/core/kernel/test_demo.rb +1 -1
- data/test/lib/facets/core/kernel/test_fn.rb +1 -1
- data/test/lib/facets/core/kernel/test_generate_method_name.rb +1 -1
- data/test/lib/facets/core/kernel/test_get_by_id.rb +1 -1
- data/test/lib/facets/core/kernel/test_here.rb +1 -1
- data/test/lib/facets/core/kernel/test_in.rb +1 -1
- data/test/lib/facets/core/kernel/test_maybe.rb +1 -1
- data/test/lib/facets/core/kernel/test_metaclass.rb +1 -1
- data/test/lib/facets/core/kernel/test_method.rb +1 -1
- data/test/lib/facets/core/kernel/{test_method_name.rb → test_methodname.rb} +3 -3
- data/test/lib/facets/core/kernel/test_methods.rb +1 -1
- data/test/lib/facets/core/kernel/test_new.rb +1 -1
- data/test/lib/facets/core/kernel/test_object_class.rb +1 -1
- data/test/lib/facets/core/kernel/test_object_hexid.rb +1 -1
- data/test/lib/facets/core/kernel/test_require_all.rb +1 -1
- data/test/lib/facets/core/kernel/test_require_esc.rb +1 -1
- data/test/lib/facets/core/kernel/test_require_facet.rb +1 -1
- data/test/lib/facets/core/kernel/test_resc.rb +1 -1
- data/test/lib/facets/core/kernel/test_returning.rb +1 -1
- data/test/lib/facets/core/kernel/test_send_as.rb +1 -1
- data/test/lib/facets/core/kernel/test_set_from.rb +1 -1
- data/test/lib/facets/core/kernel/test_set_with.rb +1 -1
- data/test/lib/facets/core/kernel/test_silently.rb +1 -1
- data/test/lib/facets/core/kernel/test_singleton.rb +1 -1
- data/test/lib/facets/core/kernel/test_superior.rb +1 -1
- data/test/lib/facets/core/kernel/test_supermethod.rb +1 -1
- data/test/lib/facets/core/kernel/test_this.rb +1 -1
- data/test/lib/facets/core/kernel/test_to_b.rb +1 -1
- data/test/lib/facets/core/kernel/test_to_bool.rb +1 -1
- data/test/lib/facets/core/kernel/test_uri.rb +1 -1
- data/test/lib/facets/core/kernel/test_val.rb +1 -1
- data/test/lib/facets/core/kernel/test_with_accessor.rb +1 -1
- data/test/lib/facets/core/matchdata/test_match.rb +1 -1
- data/test/lib/facets/core/matchdata/test_matchtree.rb +1 -1
- data/test/lib/facets/core/module/test_abstract.rb +1 -1
- data/test/lib/facets/core/module/test_alias_module_function.rb +1 -1
- data/test/lib/facets/core/module/test_ancestor.rb +1 -1
- data/test/lib/facets/core/module/test_basename.rb +1 -1
- data/test/lib/facets/core/module/test_by_name.rb +1 -1
- data/test/lib/facets/core/module/test_clone_using.rb +1 -1
- data/test/lib/facets/core/module/test_dirname.rb +1 -1
- data/test/lib/facets/core/module/test_equate_on.rb +1 -1
- data/test/lib/facets/core/module/test_generate_instance_method_name.rb +1 -1
- data/test/lib/facets/core/module/test_include_as.rb +1 -1
- data/test/lib/facets/core/module/test_inherit.rb +58 -0
- data/test/lib/facets/core/module/test_initializer.rb +1 -1
- data/test/lib/facets/core/module/test_instance_methods.rb +1 -1
- data/test/lib/facets/core/module/test_integrate.rb +1 -1
- data/test/lib/facets/core/module/test_let.rb +31 -0
- data/test/lib/facets/core/module/test_mattr.rb +71 -0
- data/test/lib/facets/core/module/test_memoize.rb +1 -1
- data/test/lib/facets/core/module/test_modspace.rb +1 -1
- data/test/lib/facets/core/module/test_namespace.rb +1 -1
- data/test/lib/facets/core/module/test_nesting.rb +1 -1
- data/test/lib/facets/core/module/test_on_included.rb +36 -0
- data/test/lib/facets/core/module/test_redef.rb +1 -1
- data/test/lib/facets/core/module/test_redefine_method.rb +1 -1
- data/test/lib/facets/core/module/test_redirect.rb +1 -1
- data/test/lib/facets/core/module/test_redirect_method.rb +1 -1
- data/test/lib/facets/core/module/test_remove.rb +1 -1
- data/test/lib/facets/core/module/test_rename.rb +1 -1
- data/test/lib/facets/core/module/test_rename_method.rb +1 -1
- data/test/lib/facets/core/module/test_revisal.rb +1 -1
- data/test/lib/facets/core/module/test_shadow_method.rb +1 -1
- data/test/lib/facets/core/module/test_sort_on.rb +1 -1
- data/test/lib/facets/core/module/test_undef.rb +1 -1
- data/test/lib/facets/core/module/test_wrap.rb +1 -1
- data/test/lib/facets/core/module/test_wrap_method.rb +1 -1
- data/test/lib/facets/core/nilclass/{test_to_f.rb → test_blank.rb} +5 -5
- data/test/lib/facets/core/nilclass/test_empty.rb +1 -1
- data/test/lib/facets/core/nilclass/test_include.rb +1 -1
- data/test/lib/facets/core/nilclass/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/nilclass/test_size.rb +1 -1
- data/test/lib/facets/core/nilclass/test_to_h.rb +1 -1
- data/test/lib/facets/core/{float → numeric}/test_approx.rb +4 -3
- data/test/lib/facets/core/numeric/test_ceil_multiple.rb +1 -1
- data/test/lib/facets/core/numeric/test_succ.rb +1 -1
- data/test/lib/facets/core/numeric/test_to_b.rb +1 -1
- data/test/lib/facets/core/ostruct/test___merge__.rb +1 -1
- data/test/lib/facets/core/ostruct/test___update__.rb +1 -1
- data/test/lib/facets/core/ostruct/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/ostruct/test_op_store.rb +1 -1
- data/test/lib/facets/core/proc/test_compose.rb +1 -1
- data/test/lib/facets/core/proc/test_to_method.rb +1 -1
- data/test/lib/facets/core/range/test_to_r.rb +1 -1
- data/test/lib/facets/core/range/test_to_range.rb +1 -1
- data/test/lib/facets/core/range/test_umbrella.rb +1 -1
- data/test/lib/facets/core/range/test_within.rb +1 -1
- data/test/lib/facets/core/regexp/test_arity.rb +1 -1
- data/test/lib/facets/core/regexp/test_to_re.rb +1 -1
- data/test/lib/facets/core/regexp/test_to_regexp.rb +1 -1
- data/test/lib/facets/core/string/self/test_interpolate.rb +1 -1
- data/test/lib/facets/core/string/self/test_patterns.rb +1 -1
- data/test/lib/facets/core/string/self/test_rand_letter.rb +1 -1
- data/test/lib/facets/core/string/test_align_center.rb +1 -1
- data/test/lib/facets/core/string/test_at_rand.rb +1 -1
- data/test/lib/facets/core/string/test_basename.rb +1 -1
- data/test/lib/facets/core/string/test_blank.rb +1 -1
- data/test/lib/facets/core/string/test_bracket.rb +1 -1
- data/test/lib/facets/core/string/test_camelcase.rb +1 -1
- data/test/lib/facets/core/string/test_camelize.rb +1 -1
- data/test/lib/facets/core/string/test_capitalized.rb +1 -1
- data/test/lib/facets/core/string/test_chars.rb +1 -1
- data/test/lib/facets/core/string/test_cmp.rb +1 -1
- data/test/lib/facets/core/string/test_demodulize.rb +1 -1
- data/test/lib/facets/core/string/test_downcase.rb +1 -1
- data/test/lib/facets/core/string/test_dresner.rb +1 -1
- data/test/lib/facets/core/string/test_each_char.rb +1 -1
- data/test/lib/facets/core/string/test_each_word.rb +1 -1
- data/test/lib/facets/core/string/test_first.rb +1 -1
- data/test/lib/facets/core/string/test_fold.rb +1 -1
- data/test/lib/facets/core/string/test_frequency.rb +1 -1
- data/test/lib/facets/core/string/test_humanize.rb +1 -1
- data/test/lib/facets/core/string/test_indent.rb +1 -1
- data/test/lib/facets/core/string/test_index_all.rb +1 -1
- data/test/lib/facets/core/string/test_last.rb +1 -1
- data/test/lib/facets/core/string/test_line_wrap.rb +1 -1
- data/test/lib/facets/core/string/test_lines.rb +1 -1
- data/test/lib/facets/core/string/test_lowercase.rb +1 -1
- data/test/lib/facets/core/string/test_margin.rb +1 -1
- data/test/lib/facets/core/string/test_methodize.rb +1 -1
- data/test/lib/facets/core/string/test_modulize.rb +1 -1
- data/test/lib/facets/core/string/test_mscan.rb +1 -1
- data/test/lib/facets/core/string/test_natcmp.rb +1 -1
- data/test/lib/facets/core/string/test_nchar.rb +1 -1
- data/test/lib/facets/core/string/test_pathize.rb +1 -1
- data/test/lib/facets/core/string/test_pop.rb +1 -1
- data/test/lib/facets/core/string/test_probability.rb +1 -1
- data/test/lib/facets/core/string/test_push.rb +1 -1
- data/test/lib/facets/core/string/test_quote.rb +1 -1
- data/test/lib/facets/core/string/test_rand_byte.rb +1 -1
- data/test/lib/facets/core/string/test_rand_index.rb +1 -1
- data/test/lib/facets/core/string/test_range.rb +1 -1
- data/test/lib/facets/core/string/test_range_all.rb +1 -1
- data/test/lib/facets/core/string/test_range_of_line.rb +1 -1
- data/test/lib/facets/core/string/test_regesc.rb +1 -1
- data/test/lib/facets/core/string/test_shatter.rb +1 -1
- data/test/lib/facets/core/string/test_shift.rb +1 -1
- data/test/lib/facets/core/string/test_shuffle.rb +1 -1
- data/test/lib/facets/core/string/test_similarity.rb +1 -1
- data/test/lib/facets/core/string/test_singular.rb +1 -1
- data/test/lib/facets/core/string/test_slap.rb +1 -1
- data/test/lib/facets/core/string/test_soundex.rb +1 -1
- data/test/lib/facets/core/string/test_succ.rb +1 -1
- data/test/lib/facets/core/string/test_to_a.rb +1 -1
- data/test/lib/facets/core/string/test_to_arr.rb +1 -1
- data/test/lib/facets/core/string/test_to_b.rb +1 -1
- data/test/lib/facets/core/string/test_to_const.rb +1 -1
- data/test/lib/facets/core/string/test_to_date.rb +1 -1
- data/test/lib/facets/core/string/test_to_proc.rb +1 -1
- data/test/lib/facets/core/string/test_to_re.rb +1 -1
- data/test/lib/facets/core/string/test_to_time.rb +1 -1
- data/test/lib/facets/core/string/test_unix_crypt.rb +1 -1
- data/test/lib/facets/core/string/test_unpack.rb +1 -1
- data/test/lib/facets/core/string/test_unshift.rb +1 -1
- data/test/lib/facets/core/string/test_upcase.rb +1 -1
- data/test/lib/facets/core/string/test_whitespace.rb +1 -1
- data/test/lib/facets/core/string/test_word_filter.rb +1 -1
- data/test/lib/facets/core/string/test_word_wrap.rb +1 -1
- data/test/lib/facets/core/string/test_words.rb +1 -1
- data/test/lib/facets/core/symbol/test_camelcase.rb +1 -1
- data/test/lib/facets/core/symbol/test_camelize.rb +1 -1
- data/test/lib/facets/core/symbol/test_capitalize.rb +1 -1
- data/test/lib/facets/core/symbol/test_capitalized.rb +1 -1
- data/test/lib/facets/core/symbol/test_downcase.rb +1 -1
- data/test/lib/facets/core/symbol/test_not.rb +1 -1
- data/test/lib/facets/core/symbol/test_pad.rb +1 -1
- data/test/lib/facets/core/symbol/test_succ.rb +1 -1
- data/test/lib/facets/core/symbol/test_to_const.rb +1 -1
- data/test/lib/facets/core/symbol/test_to_proc.rb +1 -1
- data/test/lib/facets/core/symbol/test_to_str.rb +1 -1
- data/test/lib/facets/core/symbol/test_underscore.rb +1 -1
- data/test/lib/facets/core/symbol/test_upcase.rb +1 -1
- data/test/lib/facets/core/time/test_change.rb +1 -1
- data/test/lib/facets/core/time/test_elapse.rb +1 -1
- data/test/lib/facets/core/time/test_stamp.rb +1 -1
- data/test/lib/facets/core/time/test_to_date.rb +1 -1
- data/test/lib/facets/core/time/test_to_s.rb +1 -1
- data/test/lib/facets/core/time/test_to_time.rb +1 -1
- data/test/lib/facets/more/test_annotation.rb +1 -1
- data/test/lib/facets/more/test_ansicode.rb +1 -1
- data/test/lib/facets/more/test_association.rb +1 -1
- data/test/lib/facets/more/test_basicobject.rb +58 -0
- data/test/lib/facets/more/test_bbcode.rb +1 -1
- data/test/lib/facets/more/test_bitmask.rb +1 -1
- data/test/lib/facets/more/test_bytes.rb +1 -1
- data/test/lib/facets/more/test_classinherit.rb +1 -1
- data/test/lib/facets/more/test_classmethods.rb +1 -1
- data/test/lib/facets/more/test_coroutine.rb +1 -1
- data/test/lib/facets/more/test_crypt.rb +1 -1
- data/test/lib/facets/more/test_dictionary.rb +1 -1
- data/test/lib/facets/more/test_elementor.rb +48 -0
- data/test/lib/facets/more/test_enumerablepass.rb +1 -1
- data/test/lib/facets/more/test_floatstring.rb +1 -1
- data/test/lib/facets/more/test_functor.rb +1 -1
- data/test/lib/facets/more/test_inheritor.rb +1 -1
- data/test/lib/facets/more/test_interval.rb +1 -1
- data/test/lib/facets/more/test_json.rb +232 -0
- data/test/lib/facets/more/test_lisp.rb +1 -1
- data/test/lib/facets/more/test_lisp_format.rb +1 -1
- data/test/lib/facets/more/test_lrucache.rb +1 -1
- data/test/lib/facets/more/test_mathconstants.rb +1 -1
- data/test/lib/facets/more/test_methodprobe.rb +1 -1
- data/test/lib/facets/more/test_multipliers.rb +1 -1
- data/test/lib/facets/more/test_multiton.rb +1 -1
- data/test/lib/facets/more/test_nackclass.rb +1 -1
- data/test/lib/facets/more/test_nilcomparable.rb +6 -2
- data/test/lib/facets/more/test_openobject.rb +1 -1
- data/test/lib/facets/more/test_overload.rb +1 -1
- data/test/lib/facets/more/test_paramix.rb +1 -1
- data/test/lib/facets/more/test_preinitialize.rb +1 -1
- data/test/lib/facets/more/test_promoteself.rb +1 -1
- data/test/lib/facets/more/test_recorder.rb +44 -0
- data/test/lib/facets/more/test_snapshot.rb +1 -1
- data/test/lib/facets/more/test_statichash.rb +1 -1
- data/test/lib/facets/more/test_syncarray.rb +1 -1
- data/test/lib/facets/more/test_synchash.rb +1 -1
- data/test/lib/facets/more/test_tagiterator.rb +1 -1
- data/test/lib/facets/more/test_timer.rb +1 -1
- data/test/lib/facets/more/test_times.rb +1 -1
- data/test/lib/facets/more/test_tuple.rb +1 -1
- data/test/lib/facets/more/test_typecast.rb +2 -2
- data/test/lib/facets/more/test_uninheritable.rb +1 -1
- data/test/lib/facets/more/test_units.rb +16 -10
- data/test/lib/facets/more/test_xoxo.rb +288 -0
- data/test/lib/facets/more/test_yamlstruct.rb +1 -1
- metadata +92 -25
- data/lib/facet/kernel/instance.rb +0 -1
- data/lib/facet/module/cattr.rb +0 -1
- data/lib/facet/module/cattr_accessor.rb +0 -1
- data/lib/facet/module/cattr_reader.rb +0 -1
- data/lib/facet/module/cattr_writer.rb +0 -1
- data/lib/facets/core/kernel/instance.rb +0 -29
- data/test/FIXTURE/create_file +0 -1
- data/test/FIXTURE/open_as_string_file +0 -1
- data/test/FIXTURE/read_list_file +0 -6
- data/test/lib/facets/core/dir/self/test_ls_r.rb +0 -52
- data/test/lib/facets/core/fileutils/test_wc.rb +0 -68
- data/test/lib/facets/core/fileutils/test_which.rb +0 -61
- data/test/testdir.rb +0 -8
data/setup.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
#
|
3
2
|
# setup.rb
|
4
3
|
#
|
@@ -9,21 +8,50 @@
|
|
9
8
|
# the GNU LGPL, Lesser General Public License version 2.1.
|
10
9
|
#
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
#############################
|
12
|
+
# Forked from version 3.2.1 #
|
13
|
+
# #
|
14
|
+
# -trans #
|
15
|
+
#############################
|
16
|
+
|
17
|
+
# CHANGE - No longer need to support 1.4.6 or 1.6 versions of Ruby.
|
18
|
+
|
19
|
+
# unless Enumerable.method_defined?(:map) # Ruby 1.4.6
|
20
|
+
# module Enumerable
|
21
|
+
# alias map collect
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
|
25
|
+
# unless File.respond_to?(:read) # Ruby 1.6
|
26
|
+
# def File.read(fname)
|
27
|
+
# open(fname) {|f|
|
28
|
+
# return f.read
|
29
|
+
# }
|
30
|
+
# end
|
31
|
+
# end
|
32
|
+
|
33
|
+
# CHANGE - Needed to install within an abitrary root dir.
|
34
|
+
# This is hack! B/c setup.rb has become spegetti code,
|
35
|
+
# I am forced to do this hack. Setup.rb should be re-writ.
|
36
|
+
# I would use package.rb instead but
|
37
|
+
# it lacks hooks and extension compilation. But we'll keep
|
38
|
+
# an eye on that one for the future. -trans.
|
39
|
+
|
40
|
+
$setup_install_root = nil
|
41
|
+
ARGV.each{ |a|
|
42
|
+
if md = /--root=(.*)/.match( a )
|
43
|
+
$setup_install_root = md[1]
|
44
|
+
end
|
45
|
+
}
|
46
|
+
if $setup_install_root
|
47
|
+
ARGV.delete("--root=#{$setup_install_root}")
|
48
|
+
$setup_install_root = File.expand_path($setup_install_root)
|
49
|
+
puts "(root=#{$setup_install_root})"
|
16
50
|
end
|
17
51
|
|
18
|
-
|
19
|
-
def File.read(fname)
|
20
|
-
open(fname) {|f|
|
21
|
-
return f.read
|
22
|
-
}
|
23
|
-
end
|
24
|
-
end
|
52
|
+
# Windows?
|
25
53
|
|
26
|
-
unless Errno.const_defined?(:ENOTEMPTY)
|
54
|
+
unless Errno.const_defined?(:ENOTEMPTY)
|
27
55
|
module Errno
|
28
56
|
class ENOTEMPTY
|
29
57
|
# We do not raise this exception, implementation is not needed.
|
@@ -56,25 +84,16 @@ class ConfigTable
|
|
56
84
|
@config_opt = nil
|
57
85
|
@verbose = true
|
58
86
|
@no_harm = false
|
59
|
-
@libsrc_pattern = '*.rb'
|
60
87
|
end
|
61
88
|
|
62
89
|
attr_accessor :install_prefix
|
63
90
|
attr_accessor :config_opt
|
64
91
|
|
65
|
-
|
92
|
+
def verbose=(x) @verbose = x end
|
93
|
+
def verbose?() @verbose end
|
66
94
|
|
67
|
-
def
|
68
|
-
|
69
|
-
end
|
70
|
-
|
71
|
-
attr_writer :no_harm
|
72
|
-
|
73
|
-
def no_harm?
|
74
|
-
@no_harm
|
75
|
-
end
|
76
|
-
|
77
|
-
attr_accessor :libsrc_pattern
|
95
|
+
def no_harm=(x) @no_harm = x end
|
96
|
+
def no_harm?() @no_harm end
|
78
97
|
|
79
98
|
def [](key)
|
80
99
|
lookup(key).resolve(self)
|
@@ -118,9 +137,7 @@ class ConfigTable
|
|
118
137
|
end
|
119
138
|
end
|
120
139
|
|
121
|
-
def savefile
|
122
|
-
'.config'
|
123
|
-
end
|
140
|
+
def savefile() '.config' end
|
124
141
|
|
125
142
|
def load_savefile
|
126
143
|
begin
|
@@ -143,124 +160,126 @@ class ConfigTable
|
|
143
160
|
end
|
144
161
|
|
145
162
|
def load_standard_entries
|
146
|
-
standard_entries(@rbconfig).each do |ent|
|
163
|
+
#standard_entries(@rbconfig).each do |ent|
|
164
|
+
standard_entries.each do |ent|
|
147
165
|
add ent
|
148
166
|
end
|
149
167
|
end
|
150
168
|
|
151
|
-
def standard_entries(rbconfig)
|
152
|
-
|
169
|
+
def standard_entries #(rbconfig)
|
170
|
+
rbconfig = @rbconfig
|
153
171
|
|
154
|
-
rubypath =
|
172
|
+
rubypath = File.join(rbconfig['bindir'], rbconfig['ruby_install_name'] + rbconfig['EXEEXT'])
|
155
173
|
|
156
|
-
major =
|
157
|
-
minor =
|
158
|
-
teeny =
|
174
|
+
major = rbconfig['MAJOR'].to_i
|
175
|
+
minor = rbconfig['MINOR'].to_i
|
176
|
+
teeny = rbconfig['TEENY'].to_i
|
159
177
|
version = "#{major}.#{minor}"
|
160
178
|
|
161
|
-
|
162
|
-
newpath_p = ((major >= 2) or
|
163
|
-
((major == 1) and
|
164
|
-
((minor >= 5) or
|
165
|
-
((minor == 4) and (teeny >= 4)))))
|
179
|
+
# CHANGE Do not need to support these old versions any more.
|
166
180
|
|
167
|
-
|
181
|
+
# # ruby ver. >= 1.4.4?
|
182
|
+
# newpath_p = ((major >= 2) or
|
183
|
+
# ((major == 1) and
|
184
|
+
# ((minor >= 5) or
|
185
|
+
# ((minor == 4) and (teeny >= 4)))))
|
186
|
+
|
187
|
+
#if c['rubylibdir']
|
168
188
|
# V > 1.6.3
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
189
|
+
|
190
|
+
root = '/'
|
191
|
+
prefix = rbconfig['prefix']
|
192
|
+
|
193
|
+
libruby = "#{prefix}/lib/ruby"
|
194
|
+
librubyver = rbconfig['rubylibdir']
|
195
|
+
librubyverarch = rbconfig['archdir']
|
196
|
+
siteruby = rbconfig['sitedir']
|
197
|
+
siterubyver = rbconfig['sitelibdir']
|
198
|
+
siterubyverarch = rbconfig['sitearchdir']
|
199
|
+
|
200
|
+
bindir = paramize(rbconfig['bindir'])
|
201
|
+
libdir = paramize(rbconfig['libdir'])
|
202
|
+
datadir = paramize(rbconfig['datadir'])
|
203
|
+
mandir = paramize(rbconfig['mandir'])
|
204
|
+
sysconfdir = paramize(rbconfig['sysconfdir'])
|
205
|
+
localstatedir = paramize(rbconfig['localstatedir'])
|
206
|
+
|
207
|
+
# elsif newpath_p
|
208
|
+
# # 1.4.4 <= V <= 1.6.3
|
209
|
+
# libruby = "#{c['prefix']}/lib/ruby"
|
210
|
+
# librubyver = "#{c['prefix']}/lib/ruby/#{version}"
|
211
|
+
# librubyverarch = "#{c['prefix']}/lib/ruby/#{version}/#{c['arch']}"
|
212
|
+
# siteruby = c['sitedir']
|
213
|
+
# siterubyver = "$siteruby/#{version}"
|
214
|
+
# siterubyverarch = "$siterubyver/#{c['arch']}"
|
215
|
+
# else
|
216
|
+
# # V < 1.4.4
|
217
|
+
# libruby = "#{c['prefix']}/lib/ruby"
|
218
|
+
# librubyver = "#{c['prefix']}/lib/ruby/#{version}"
|
219
|
+
# librubyverarch = "#{c['prefix']}/lib/ruby/#{version}/#{c['arch']}"
|
220
|
+
# siteruby = "#{c['prefix']}/lib/ruby/#{version}/site_ruby"
|
221
|
+
# siterubyver = siteruby
|
222
|
+
# siterubyverarch = "$siterubyver/#{c['arch']}"
|
223
|
+
# end
|
224
|
+
|
192
225
|
parameterize = lambda {|path|
|
193
|
-
path.sub(/\A#{Regexp.quote(
|
226
|
+
path.sub(/\A#{Regexp.quote(rbconfig['prefix'])}/, '$prefix')
|
194
227
|
}
|
195
228
|
|
196
|
-
if arg =
|
229
|
+
if arg = rbconfig['configure_args'].split.detect {|arg| /--with-make-prog=/ =~ arg }
|
197
230
|
makeprog = arg.sub(/'/, '').split(/=/, 2)[1]
|
198
231
|
else
|
199
232
|
makeprog = 'make'
|
200
233
|
end
|
201
234
|
|
235
|
+
installdir_lambda = lambda {|val, table|
|
236
|
+
case val
|
237
|
+
when 'std'
|
238
|
+
table['rbdir'] = '$librubyver'
|
239
|
+
table['sodir'] = '$librubyverarch'
|
240
|
+
when 'site'
|
241
|
+
table['rbdir'] = '$siterubyver'
|
242
|
+
table['sodir'] = '$siterubyverarch'
|
243
|
+
when 'home'
|
244
|
+
setup_rb_error '$HOME was not set' unless ENV['HOME']
|
245
|
+
table['prefix'] = ENV['HOME']
|
246
|
+
table['rbdir'] = '$libdir/ruby'
|
247
|
+
table['sodir'] = '$libdir/ruby'
|
248
|
+
end
|
249
|
+
}
|
250
|
+
|
202
251
|
[
|
203
|
-
ExecItem.new('installdirs', 'std/site/home',
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
PathItem.new('
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
'the directory for libraries'),
|
226
|
-
PathItem.new('datadir', 'path', parameterize.call(c['datadir']),
|
227
|
-
'the directory for shared data'),
|
228
|
-
PathItem.new('mandir', 'path', parameterize.call(c['mandir']),
|
229
|
-
'the directory for man pages'),
|
230
|
-
PathItem.new('sysconfdir', 'path', parameterize.call(c['sysconfdir']),
|
231
|
-
'the directory for system configuration files'),
|
232
|
-
PathItem.new('localstatedir', 'path', parameterize.call(c['localstatedir']),
|
233
|
-
'the directory for local state data'),
|
234
|
-
PathItem.new('libruby', 'path', libruby,
|
235
|
-
'the directory for ruby libraries'),
|
236
|
-
PathItem.new('librubyver', 'path', librubyver,
|
237
|
-
'the directory for standard ruby libraries'),
|
238
|
-
PathItem.new('librubyverarch', 'path', librubyverarch,
|
239
|
-
'the directory for standard ruby extensions'),
|
240
|
-
PathItem.new('siteruby', 'path', siteruby,
|
241
|
-
'the directory for version-independent aux ruby libraries'),
|
242
|
-
PathItem.new('siterubyver', 'path', siterubyver,
|
243
|
-
'the directory for aux ruby libraries'),
|
244
|
-
PathItem.new('siterubyverarch', 'path', siterubyverarch,
|
245
|
-
'the directory for aux ruby binaries'),
|
246
|
-
PathItem.new('rbdir', 'path', '$siterubyver',
|
247
|
-
'the directory for ruby scripts'),
|
248
|
-
PathItem.new('sodir', 'path', '$siterubyverarch',
|
249
|
-
'the directory for ruby extentions'),
|
250
|
-
PathItem.new('rubypath', 'path', rubypath,
|
251
|
-
'the path to set to #! line'),
|
252
|
-
ProgramItem.new('rubyprog', 'name', rubypath,
|
253
|
-
'the ruby program using for installation'),
|
254
|
-
ProgramItem.new('makeprog', 'name', makeprog,
|
255
|
-
'the make program to compile ruby extentions'),
|
256
|
-
SelectItem.new('shebang', 'all/ruby/never', 'ruby',
|
257
|
-
'shebang line (#!) editing mode'),
|
258
|
-
BoolItem.new('without-ext', 'yes/no', 'no',
|
259
|
-
'does not compile/install ruby extentions')
|
252
|
+
ExecItem.new('installdirs', 'std/site/home', 'install under libruby, site_ruby or $HOME respectively', &installdir_lambda),
|
253
|
+
PathItem.new('root', 'path', root, 'root destination directory'),
|
254
|
+
PathItem.new('prefix', 'path', prefix, 'path prefix of target environment'),
|
255
|
+
PathItem.new('bindir', 'path', bindir, 'the directory for commands'),
|
256
|
+
PathItem.new('libdir', 'path', libdir, 'the directory for libraries'),
|
257
|
+
PathItem.new('datadir', 'path', datadir, 'the directory for shared data'),
|
258
|
+
PathItem.new('mandir', 'path', mandir, 'the directory for man pages'),
|
259
|
+
PathItem.new('sysconfdir', 'path', sysconfdir, 'the directory for system configuration files'),
|
260
|
+
PathItem.new('localstatedir', 'path', localstatedir, 'the directory for local state data'),
|
261
|
+
PathItem.new('libruby', 'path', libruby, 'the directory for ruby libraries'),
|
262
|
+
PathItem.new('librubyver', 'path', librubyver, 'the directory for standard ruby libraries'),
|
263
|
+
PathItem.new('librubyverarch', 'path', librubyverarch, 'the directory for standard ruby extensions'),
|
264
|
+
PathItem.new('siteruby', 'path', siteruby, 'the directory for version-independent aux ruby libraries'),
|
265
|
+
PathItem.new('siterubyver', 'path', siterubyver, 'the directory for aux ruby libraries'),
|
266
|
+
PathItem.new('siterubyverarch', 'path', siterubyverarch, 'the directory for aux ruby binaries'),
|
267
|
+
PathItem.new('rbdir', 'path', '$siterubyver', 'the directory for ruby scripts'),
|
268
|
+
PathItem.new('sodir', 'path', '$siterubyverarch', 'the directory for ruby extentions'),
|
269
|
+
PathItem.new('rubypath', 'path', rubypath, 'the path to set to #! line'),
|
270
|
+
ProgramItem.new('rubyprog', 'name', rubypath, 'the ruby program using for installation'),
|
271
|
+
ProgramItem.new('makeprog', 'name', makeprog, 'the make program to compile ruby extentions'),
|
272
|
+
SelectItem.new('shebang', 'all/ruby/never', 'ruby', 'shebang line (#!) editing mode'),
|
273
|
+
BoolItem.new('without-ext', 'yes/no', 'no', 'does not compile/install ruby extentions')
|
260
274
|
]
|
261
275
|
end
|
262
276
|
private :standard_entries
|
263
277
|
|
278
|
+
def paramize( path )
|
279
|
+
path.sub(/\A#{Regexp.quote(@rbconfig['prefix'])}/, '$prefix')
|
280
|
+
end
|
281
|
+
private :paramize
|
282
|
+
|
264
283
|
def load_multipackage_entries
|
265
284
|
multipackage_entries().each do |ent|
|
266
285
|
add ent
|
@@ -269,10 +288,8 @@ class ConfigTable
|
|
269
288
|
|
270
289
|
def multipackage_entries
|
271
290
|
[
|
272
|
-
PackageSelectionItem.new('with',
|
273
|
-
|
274
|
-
PackageSelectionItem.new('without', 'name,name...', '', 'NONE',
|
275
|
-
'package names that you do not want to install')
|
291
|
+
PackageSelectionItem.new('with', 'name,name...', '', 'ALL', 'package names that you want to install'),
|
292
|
+
PackageSelectionItem.new('without', 'name,name...', '', 'NONE', 'package names that you do not want to install')
|
276
293
|
]
|
277
294
|
end
|
278
295
|
private :multipackage_entries
|
@@ -337,13 +354,8 @@ class ConfigTable
|
|
337
354
|
"--#{@name}=#{@template}"
|
338
355
|
end
|
339
356
|
|
340
|
-
def value?
|
341
|
-
|
342
|
-
end
|
343
|
-
|
344
|
-
def value
|
345
|
-
@value
|
346
|
-
end
|
357
|
+
def value? ; true ; end
|
358
|
+
def value ; @value ; end
|
347
359
|
|
348
360
|
def resolve(table)
|
349
361
|
@value.gsub(%r<\$([^/]+)>) { table[$1] }
|
@@ -362,9 +374,7 @@ class ConfigTable
|
|
362
374
|
end
|
363
375
|
|
364
376
|
class BoolItem < Item
|
365
|
-
def config_type
|
366
|
-
'bool'
|
367
|
-
end
|
377
|
+
def config_type() 'bool' end
|
368
378
|
|
369
379
|
def help_opt
|
370
380
|
"--#{@name}"
|
@@ -374,20 +384,19 @@ class ConfigTable
|
|
374
384
|
|
375
385
|
def check(val)
|
376
386
|
return 'yes' unless val
|
377
|
-
|
387
|
+
case val
|
388
|
+
when /\Ay(es)?\z/i, /\At(rue)?\z/i then 'yes'
|
389
|
+
when /\An(o)?\z/i, /\Af(alse)\z/i then 'no'
|
390
|
+
else
|
378
391
|
setup_rb_error "config: --#{@name} accepts only yes/no for argument"
|
379
392
|
end
|
380
|
-
(/\Ay(es)?|\At(rue)/i =~ value) ? 'yes' : 'no'
|
381
393
|
end
|
382
394
|
end
|
383
395
|
|
384
396
|
class PathItem < Item
|
385
|
-
def config_type
|
386
|
-
'path'
|
387
|
-
end
|
397
|
+
def config_type() 'path' end
|
388
398
|
|
389
399
|
private
|
390
|
-
|
391
400
|
def check(path)
|
392
401
|
setup_rb_error "config: --#{@name} requires argument" unless path
|
393
402
|
path[0,1] == '$' ? path : File.expand_path(path)
|
@@ -395,9 +404,7 @@ class ConfigTable
|
|
395
404
|
end
|
396
405
|
|
397
406
|
class ProgramItem < Item
|
398
|
-
def config_type
|
399
|
-
'program'
|
400
|
-
end
|
407
|
+
def config_type() 'program' end
|
401
408
|
end
|
402
409
|
|
403
410
|
class SelectItem < Item
|
@@ -406,12 +413,9 @@ class ConfigTable
|
|
406
413
|
@ok = selection.split('/')
|
407
414
|
end
|
408
415
|
|
409
|
-
def config_type
|
410
|
-
'select'
|
411
|
-
end
|
416
|
+
def config_type() 'select' end
|
412
417
|
|
413
418
|
private
|
414
|
-
|
415
419
|
def check(val)
|
416
420
|
unless @ok.include?(val.strip)
|
417
421
|
setup_rb_error "config: use --#{@name}=#{@template} (#{val})"
|
@@ -473,7 +477,7 @@ class ConfigTable
|
|
473
477
|
end
|
474
478
|
|
475
479
|
class MetaConfigEnvironment
|
476
|
-
def
|
480
|
+
def initialize(config, installer)
|
477
481
|
@config = config
|
478
482
|
@installer = installer
|
479
483
|
end
|
@@ -538,7 +542,9 @@ end # class ConfigTable
|
|
538
542
|
module FileOperations
|
539
543
|
|
540
544
|
def mkdir_p(dirname, prefix = nil)
|
541
|
-
dirname = prefix
|
545
|
+
dirname = File.join(prefix, File.expand_path(dirname)) if prefix
|
546
|
+
dirname = File.join( $setup_install_root, dirname ) if $setup_install_root
|
547
|
+
|
542
548
|
$stderr.puts "mkdir -p #{dirname}" if verbose?
|
543
549
|
return if no_harm?
|
544
550
|
|
@@ -622,11 +628,15 @@ module FileOperations
|
|
622
628
|
end
|
623
629
|
|
624
630
|
def install(from, dest, mode, prefix = nil)
|
631
|
+
|
632
|
+
realdest = prefix ? File.join(prefix, File.expand_path(dest)) : dest
|
633
|
+
realdest = File.join($setup_install_root, File.expand_path(realdest)) if $setup_install_root
|
634
|
+
|
625
635
|
$stderr.puts "install #{from} #{dest}" if verbose?
|
626
636
|
return if no_harm?
|
627
637
|
|
628
|
-
realdest = prefix ? prefix + File.expand_path(dest) : dest
|
629
638
|
realdest = File.join(realdest, File.basename(from)) if File.dir?(realdest)
|
639
|
+
|
630
640
|
str = File.binread(from)
|
631
641
|
if diff?(str, realdest)
|
632
642
|
verbose_off {
|
@@ -661,7 +671,7 @@ module FileOperations
|
|
661
671
|
def ruby(*args)
|
662
672
|
command config('rubyprog'), *args
|
663
673
|
end
|
664
|
-
|
674
|
+
|
665
675
|
def make(task = nil)
|
666
676
|
command(*[config('makeprog'), task].compact)
|
667
677
|
end
|
@@ -701,33 +711,14 @@ module HookScriptAPI
|
|
701
711
|
@config[key] = val
|
702
712
|
end
|
703
713
|
|
704
|
-
#
|
705
714
|
# srcdir/objdir (works only in the package directory)
|
706
|
-
#
|
707
|
-
|
708
|
-
def curr_srcdir
|
709
|
-
"#{srcdir_root()}/#{relpath()}"
|
710
|
-
end
|
711
|
-
|
712
|
-
def curr_objdir
|
713
|
-
"#{objdir_root()}/#{relpath()}"
|
714
|
-
end
|
715
|
-
|
716
|
-
def srcfile(path)
|
717
|
-
"#{curr_srcdir()}/#{path}"
|
718
|
-
end
|
719
715
|
|
720
|
-
def
|
721
|
-
|
722
|
-
end
|
723
|
-
|
724
|
-
def srcdirectory?(path)
|
725
|
-
|
726
|
-
end
|
727
|
-
|
728
|
-
def srcfile?(path)
|
729
|
-
File.file?(srcfile(path))
|
730
|
-
end
|
716
|
+
def curr_srcdir() "#{srcdir_root()}/#{relpath()}" end
|
717
|
+
def curr_objdir() "#{objdir_root()}/#{relpath()}" end
|
718
|
+
def srcfile(path) "#{curr_srcdir()}/#{path}" end
|
719
|
+
def srcexist?(path) File.exist?(srcfile(path)) end
|
720
|
+
def srcdirectory?(path) File.dir?(srcfile(path)) end
|
721
|
+
def srcfile?(path) File.file?(srcfile(path)) end
|
731
722
|
|
732
723
|
def srcentries(path = '.')
|
733
724
|
Dir.open("#{curr_srcdir()}/#{path}") {|d|
|
@@ -752,7 +743,7 @@ end
|
|
752
743
|
|
753
744
|
class ToplevelInstaller
|
754
745
|
|
755
|
-
Version = '3.4.
|
746
|
+
Version = '3.4.1'
|
756
747
|
Copyright = 'Copyright (c) 2000-2005 Minero Aoki'
|
757
748
|
|
758
749
|
TASKS = [
|
@@ -766,8 +757,8 @@ class ToplevelInstaller
|
|
766
757
|
[ 'distclean',"does `make distclean' for each extention" ]
|
767
758
|
]
|
768
759
|
|
769
|
-
def
|
770
|
-
config = ConfigTable.new(load_rbconfig
|
760
|
+
def self.invoke
|
761
|
+
config = ConfigTable.new(load_rbconfig)
|
771
762
|
config.load_standard_entries
|
772
763
|
config.load_multipackage_entries if multipackage?
|
773
764
|
config.fixup
|
@@ -775,11 +766,11 @@ class ToplevelInstaller
|
|
775
766
|
klass.new(File.dirname($0), config).invoke
|
776
767
|
end
|
777
768
|
|
778
|
-
def
|
769
|
+
def self.multipackage?
|
779
770
|
File.dir?(File.dirname($0) + '/packages')
|
780
771
|
end
|
781
772
|
|
782
|
-
def
|
773
|
+
def self.load_rbconfig
|
783
774
|
if arg = ARGV.detect {|arg| /\A--rbconfig=/ =~ arg }
|
784
775
|
ARGV.delete(arg)
|
785
776
|
load File.expand_path(arg.split(/=/, 2)[1])
|
@@ -790,6 +781,7 @@ class ToplevelInstaller
|
|
790
781
|
::Config::CONFIG
|
791
782
|
end
|
792
783
|
|
784
|
+
|
793
785
|
def initialize(ardir_root, config)
|
794
786
|
@ardir = File.expand_path(ardir_root)
|
795
787
|
@config = config
|
@@ -828,7 +820,7 @@ class ToplevelInstaller
|
|
828
820
|
__send__ "exec_#{task}"
|
829
821
|
end
|
830
822
|
end
|
831
|
-
|
823
|
+
|
832
824
|
def run_metaconfigs
|
833
825
|
@config.load_script "#{@ardir}/metaconfig"
|
834
826
|
end
|
@@ -841,17 +833,9 @@ class ToplevelInstaller
|
|
841
833
|
# Hook Script API bases
|
842
834
|
#
|
843
835
|
|
844
|
-
def srcdir_root
|
845
|
-
|
846
|
-
end
|
847
|
-
|
848
|
-
def objdir_root
|
849
|
-
'.'
|
850
|
-
end
|
851
|
-
|
852
|
-
def relpath
|
853
|
-
'.'
|
854
|
-
end
|
836
|
+
def srcdir_root() @ardir end
|
837
|
+
def objdir_root() '.' end
|
838
|
+
def relpath() '.' end
|
855
839
|
|
856
840
|
#
|
857
841
|
# Option Parsing
|
@@ -893,6 +877,7 @@ class ToplevelInstaller
|
|
893
877
|
|
894
878
|
def parsearg_no_options
|
895
879
|
unless ARGV.empty?
|
880
|
+
task = caller(0).first.slice(%r<`parsearg_(\w+)'>, 1)
|
896
881
|
setup_rb_error "#{task}: unknown options: #{ARGV.join(' ')}"
|
897
882
|
end
|
898
883
|
end
|
@@ -980,6 +965,7 @@ class ToplevelInstaller
|
|
980
965
|
out.puts
|
981
966
|
out.puts 'Options for INSTALL:'
|
982
967
|
out.printf fmt, '--no-harm', 'only display what to do if given', 'off'
|
968
|
+
out.printf fmt, '--root=path', 'install root directory (effects all paths)', '/'
|
983
969
|
out.printf fmt, '--prefix=path', 'install path prefix', ''
|
984
970
|
out.puts
|
985
971
|
end
|
@@ -1174,21 +1160,15 @@ class Installer
|
|
1174
1160
|
"#<#{self.class} #{File.basename(@srcdir)}>"
|
1175
1161
|
end
|
1176
1162
|
|
1163
|
+
def noop(rel) ; end
|
1164
|
+
|
1177
1165
|
#
|
1178
1166
|
# Hook Script API base methods
|
1179
1167
|
#
|
1180
1168
|
|
1181
|
-
def srcdir_root
|
1182
|
-
|
1183
|
-
end
|
1184
|
-
|
1185
|
-
def objdir_root
|
1186
|
-
@objdir
|
1187
|
-
end
|
1188
|
-
|
1189
|
-
def relpath
|
1190
|
-
@currdir
|
1191
|
-
end
|
1169
|
+
def srcdir_root() @srcdir end
|
1170
|
+
def objdir_root() @objdir end
|
1171
|
+
def relpath() @currdir end
|
1192
1172
|
|
1193
1173
|
#
|
1194
1174
|
# Config Access
|
@@ -1221,29 +1201,21 @@ class Installer
|
|
1221
1201
|
exec_task_traverse 'config'
|
1222
1202
|
end
|
1223
1203
|
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
def config_dir_lib(rel)
|
1228
|
-
end
|
1229
|
-
|
1230
|
-
def config_dir_man(rel)
|
1231
|
-
end
|
1204
|
+
alias config_dir_bin noop
|
1205
|
+
alias config_dir_lib noop
|
1232
1206
|
|
1233
1207
|
def config_dir_ext(rel)
|
1234
1208
|
extconf if extdir?(curr_srcdir())
|
1235
1209
|
end
|
1236
1210
|
|
1211
|
+
alias config_dir_data noop
|
1212
|
+
alias config_dir_conf noop
|
1213
|
+
alias config_dir_man noop
|
1214
|
+
|
1237
1215
|
def extconf
|
1238
1216
|
ruby "#{curr_srcdir()}/extconf.rb", *@config.config_opt
|
1239
1217
|
end
|
1240
1218
|
|
1241
|
-
def config_dir_data(rel)
|
1242
|
-
end
|
1243
|
-
|
1244
|
-
def config_dir_conf(rel)
|
1245
|
-
end
|
1246
|
-
|
1247
1219
|
#
|
1248
1220
|
# TASK setup
|
1249
1221
|
#
|
@@ -1254,43 +1226,89 @@ class Installer
|
|
1254
1226
|
|
1255
1227
|
def setup_dir_bin(rel)
|
1256
1228
|
files_of(curr_srcdir()).each do |fname|
|
1257
|
-
|
1229
|
+
update_shebang_line "#{curr_srcdir()}/#{fname}"
|
1258
1230
|
end
|
1259
1231
|
end
|
1260
1232
|
|
1261
|
-
|
1233
|
+
alias setup_dir_lib noop
|
1234
|
+
|
1235
|
+
def setup_dir_ext(rel)
|
1236
|
+
make if extdir?(curr_srcdir())
|
1237
|
+
end
|
1238
|
+
|
1239
|
+
alias setup_dir_data noop
|
1240
|
+
alias setup_dir_conf noop
|
1241
|
+
alias setup_dir_man noop
|
1242
|
+
|
1243
|
+
def update_shebang_line(path)
|
1262
1244
|
return if no_harm?
|
1245
|
+
return if config('shebang') == 'never'
|
1246
|
+
old = Shebang.load(path)
|
1247
|
+
if old
|
1248
|
+
$stderr.puts "warning: #{path}: Shebang line includes too many args. It is not portable and your program may not work." if old.args.size > 1
|
1249
|
+
new = new_shebang(old)
|
1250
|
+
return if new.to_s == old.to_s
|
1251
|
+
else
|
1252
|
+
return unless config('shebang') == 'all'
|
1253
|
+
new = Shebang.new(config('rubypath'))
|
1254
|
+
end
|
1255
|
+
$stderr.puts "updating shebang: #{File.basename(path)}" if verbose?
|
1256
|
+
open_atomic_writer(path) {|output|
|
1257
|
+
File.open(path, 'rb') {|f|
|
1258
|
+
f.gets if old # discard
|
1259
|
+
output.puts new.to_s
|
1260
|
+
output.print f.read
|
1261
|
+
}
|
1262
|
+
}
|
1263
|
+
end
|
1264
|
+
|
1265
|
+
def new_shebang(old)
|
1266
|
+
if /\Aruby/ =~ File.basename(old.cmd)
|
1267
|
+
Shebang.new(config('rubypath'), old.args)
|
1268
|
+
elsif File.basename(old.cmd) == 'env' and old.args.first == 'ruby'
|
1269
|
+
Shebang.new(config('rubypath'), old.args[1..-1])
|
1270
|
+
else
|
1271
|
+
return old unless config('shebang') == 'all'
|
1272
|
+
Shebang.new(config('rubypath'))
|
1273
|
+
end
|
1274
|
+
end
|
1275
|
+
|
1276
|
+
def open_atomic_writer(path, &block)
|
1263
1277
|
tmpfile = File.basename(path) + '.tmp'
|
1264
1278
|
begin
|
1265
|
-
File.open(
|
1266
|
-
|
1267
|
-
return unless File.basename(first.sub(/\A\#!/, '').split[0].to_s) == 'ruby'
|
1268
|
-
$stderr.puts "adjusting shebang: #{File.basename(path)}" if verbose?
|
1269
|
-
File.open(tmpfile, 'wb') {|w|
|
1270
|
-
w.print first.sub(/\A\#!\s*\S+/, '#! ' + config('rubypath'))
|
1271
|
-
w.write r.read
|
1272
|
-
}
|
1273
|
-
}
|
1274
|
-
move_file tmpfile, File.basename(path)
|
1279
|
+
File.open(tmpfile, 'wb', &block)
|
1280
|
+
File.rename tmpfile, File.basename(path)
|
1275
1281
|
ensure
|
1276
1282
|
File.unlink tmpfile if File.exist?(tmpfile)
|
1277
1283
|
end
|
1278
1284
|
end
|
1279
1285
|
|
1280
|
-
|
1281
|
-
|
1286
|
+
class Shebang
|
1287
|
+
def Shebang.load(path)
|
1288
|
+
line = nil
|
1289
|
+
File.open(path) {|f|
|
1290
|
+
line = f.gets
|
1291
|
+
}
|
1292
|
+
return nil unless /\A#!/ =~ line
|
1293
|
+
parse(line)
|
1294
|
+
end
|
1282
1295
|
|
1283
|
-
|
1284
|
-
|
1296
|
+
def Shebang.parse(line)
|
1297
|
+
cmd, *args = *line.strip.sub(/\A\#!/, '').split(' ')
|
1298
|
+
new(cmd, args)
|
1299
|
+
end
|
1285
1300
|
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1301
|
+
def initialize(cmd, args = [])
|
1302
|
+
@cmd = cmd
|
1303
|
+
@args = args
|
1304
|
+
end
|
1289
1305
|
|
1290
|
-
|
1291
|
-
|
1306
|
+
attr_reader :cmd
|
1307
|
+
attr_reader :args
|
1292
1308
|
|
1293
|
-
|
1309
|
+
def to_s
|
1310
|
+
"#! #{@cmd}" + (@args.empty? ? '' : " #{@args.join(' ')}")
|
1311
|
+
end
|
1294
1312
|
end
|
1295
1313
|
|
1296
1314
|
#
|
@@ -1307,7 +1325,7 @@ class Installer
|
|
1307
1325
|
end
|
1308
1326
|
|
1309
1327
|
def install_dir_lib(rel)
|
1310
|
-
install_files
|
1328
|
+
install_files libfiles(), "#{config('rbdir')}/#{rel}", 0644
|
1311
1329
|
end
|
1312
1330
|
|
1313
1331
|
def install_dir_ext(rel)
|
@@ -1333,13 +1351,14 @@ class Installer
|
|
1333
1351
|
|
1334
1352
|
def install_files(list, dest, mode)
|
1335
1353
|
mkdir_p dest, @config.install_prefix
|
1354
|
+
#mkdir_p dest, offset_dir
|
1336
1355
|
list.each do |fname|
|
1337
1356
|
install fname, dest, mode, @config.install_prefix
|
1338
1357
|
end
|
1339
1358
|
end
|
1340
1359
|
|
1341
|
-
def
|
1342
|
-
|
1360
|
+
def libfiles
|
1361
|
+
glob_reject(%w(*.y *.output), targetfiles())
|
1343
1362
|
end
|
1344
1363
|
|
1345
1364
|
def rubyextentions(dir)
|
@@ -1417,7 +1436,11 @@ class Installer
|
|
1417
1436
|
return
|
1418
1437
|
end
|
1419
1438
|
$stderr.puts 'Running tests...' if verbose?
|
1420
|
-
|
1439
|
+
begin
|
1440
|
+
require 'test/unit'
|
1441
|
+
rescue LoadError
|
1442
|
+
setup_rb_error 'test/unit cannot loaded. You need Ruby 1.8 or later to invoke this task.'
|
1443
|
+
end
|
1421
1444
|
runner = Test::Unit::AutoRunner.new(true)
|
1422
1445
|
runner.to_run << TESTDIR
|
1423
1446
|
runner.run
|
@@ -1433,23 +1456,17 @@ class Installer
|
|
1433
1456
|
rm_f 'InstalledFiles'
|
1434
1457
|
end
|
1435
1458
|
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1459
|
+
alias clean_dir_bin noop
|
1460
|
+
alias clean_dir_lib noop
|
1461
|
+
alias clean_dir_data noop
|
1462
|
+
alias clean_dir_conf noop
|
1463
|
+
alias clean_dir_man noop
|
1441
1464
|
|
1442
1465
|
def clean_dir_ext(rel)
|
1443
1466
|
return unless extdir?(curr_srcdir())
|
1444
1467
|
make 'clean' if File.file?('Makefile')
|
1445
1468
|
end
|
1446
1469
|
|
1447
|
-
def clean_dir_data(rel)
|
1448
|
-
end
|
1449
|
-
|
1450
|
-
def clean_dir_conf(rel)
|
1451
|
-
end
|
1452
|
-
|
1453
1470
|
#
|
1454
1471
|
# TASK distclean
|
1455
1472
|
#
|
@@ -1460,31 +1477,26 @@ class Installer
|
|
1460
1477
|
rm_f 'InstalledFiles'
|
1461
1478
|
end
|
1462
1479
|
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
def distclean_dir_lib(rel)
|
1467
|
-
end
|
1480
|
+
alias distclean_dir_bin noop
|
1481
|
+
alias distclean_dir_lib noop
|
1468
1482
|
|
1469
1483
|
def distclean_dir_ext(rel)
|
1470
1484
|
return unless extdir?(curr_srcdir())
|
1471
1485
|
make 'distclean' if File.file?('Makefile')
|
1472
1486
|
end
|
1473
1487
|
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
def distclean_dir_conf(rel)
|
1478
|
-
end
|
1488
|
+
alias distclean_dir_data noop
|
1489
|
+
alias distclean_dir_conf noop
|
1490
|
+
alias distclean_dir_man noop
|
1479
1491
|
|
1480
1492
|
#
|
1481
|
-
#
|
1493
|
+
# Traversing
|
1482
1494
|
#
|
1483
1495
|
|
1484
1496
|
def exec_task_traverse(task)
|
1485
1497
|
run_hook "pre-#{task}"
|
1486
1498
|
FILETYPES.each do |type|
|
1487
|
-
if config('without-ext') == 'yes'
|
1499
|
+
if type == 'ext' and config('without-ext') == 'yes'
|
1488
1500
|
$stderr.puts 'skipping ext/* by user option' if verbose?
|
1489
1501
|
next
|
1490
1502
|
end
|