rubyment 0.4.25424079 → 0.5.25438548
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.
- checksums.yaml +4 -4
- data/bin/rubyment +3 -0
- data/lib/rubyment.rb +77 -11
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 257604e9603dae7bd4f7eab4e2e8babe1c7758cf
|
4
|
+
data.tar.gz: 280edae2534cfe3179a76a939efded644c8ccf21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8af6d851fcacf965891eb1ae67bfb99826d9d05b960409f32c631aac7a5c6ac1b47b23668832a457b2d631d61387cb5475762c874cd7c5e9f69d525dcba2cedc
|
7
|
+
data.tar.gz: 569b5ae9b1ba362b98c88cd05c627a2eaec9e3b520706cbfd28f28dfa04da9282a858aff2cf348b2c6c540925447b2658cfb23e10a4a53b85862730511289ae4
|
data/bin/rubyment
ADDED
data/lib/rubyment.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# Collection of Ruby functions
|
4
|
-
#
|
5
|
-
# normally outputs to
|
4
|
+
# * output
|
5
|
+
# normally outputs to STDERR, with
|
6
6
|
# no mercy
|
7
7
|
# STDOUT, just qualified output:
|
8
8
|
# only if the function is expected
|
@@ -60,7 +60,7 @@ class Rubyment
|
|
60
60
|
:stdout => STDOUT,
|
61
61
|
:stdin => STDIN,
|
62
62
|
:time => Time.now,
|
63
|
-
:major_version => "0.
|
63
|
+
:major_version => "0.5",
|
64
64
|
:basic_version => (Time.now.to_i / 60), # new one every minute
|
65
65
|
:filepath => __FILE__,
|
66
66
|
:running_dir => Dir.pwd,
|
@@ -771,10 +771,10 @@ class Rubyment
|
|
771
771
|
# an alternative interface to dec -- reads password if
|
772
772
|
# nil or empty.
|
773
773
|
#
|
774
|
-
# @param [Array] args
|
775
|
-
# +
|
776
|
-
#
|
777
|
-
# +password
|
774
|
+
# @param [Array] args Defaults to +ARGV+. Elements:
|
775
|
+
# * +data+ [String, nil] data to be encrypted, If empty or nil, read (without
|
776
|
+
# echo) from @memory[:stdin], which defaults to STDIN
|
777
|
+
# * +password+ [String, nil] password to be used to encryption.
|
778
778
|
# If empty or nil, read (without echo) from @memory[:stdin], which defaults to STDIN
|
779
779
|
#
|
780
780
|
# @return [TrueClass, FalseClass] depending on whether test succeeds.
|
@@ -897,7 +897,11 @@ class Rubyment
|
|
897
897
|
gem_license,
|
898
898
|
gem_validate_class,
|
899
899
|
gem_validate_class_args,
|
900
|
-
gem_validate_class_method
|
900
|
+
gem_validate_class_method,
|
901
|
+
gem_is_current_file,
|
902
|
+
gem_bin_generate,
|
903
|
+
gem_bin_contents,
|
904
|
+
gem_bin_executables = args
|
901
905
|
|
902
906
|
contents =<<-ENDHEREDOC
|
903
907
|
Gem::Specification.new do |s|
|
@@ -911,6 +915,7 @@ Gem::Specification.new do |s|
|
|
911
915
|
s.files = #{gem_files.inspect}
|
912
916
|
s.homepage = '#{gem_homepage}'
|
913
917
|
s.license = '#{gem_license}'
|
918
|
+
s.executables += #{gem_bin_executables}
|
914
919
|
end
|
915
920
|
ENDHEREDOC
|
916
921
|
contents
|
@@ -991,6 +996,14 @@ end
|
|
991
996
|
gem_is_current_file = true # this enables the possibility of building
|
992
997
|
# a gem for the calling file itself, but be aware that lib/gem_file.rb
|
993
998
|
# is supposed to be overriden later.
|
999
|
+
gem_bin_generate = "bin/#{gem_name}" # generate a bin file
|
1000
|
+
gem_bin_contents =<<-ENDHEREDOC
|
1001
|
+
#!/usr/bin/env ruby
|
1002
|
+
require '#{gem_name}'
|
1003
|
+
#{gem_validate_class}.new({:invoke => ARGV})
|
1004
|
+
ENDHEREDOC
|
1005
|
+
gem_executables = [ gem_bin_generate && "#{gem_name}" ]
|
1006
|
+
|
994
1007
|
[
|
995
1008
|
gem_name,
|
996
1009
|
gem_version,
|
@@ -1009,6 +1022,9 @@ end
|
|
1009
1022
|
gem_validate_class_args,
|
1010
1023
|
gem_validate_class_method,
|
1011
1024
|
gem_is_current_file,
|
1025
|
+
gem_bin_generate,
|
1026
|
+
gem_bin_contents,
|
1027
|
+
gem_executables,
|
1012
1028
|
]
|
1013
1029
|
end
|
1014
1030
|
|
@@ -1032,7 +1048,12 @@ end
|
|
1032
1048
|
# returns:
|
1033
1049
|
# console output of gem build (String)
|
1034
1050
|
def gem_build args=ARGV
|
1035
|
-
gem_spec_path,
|
1051
|
+
gem_spec_path,
|
1052
|
+
gem_spec_contents,
|
1053
|
+
gem_is_current_file,
|
1054
|
+
gem_name,
|
1055
|
+
gem_bin_generate,
|
1056
|
+
gem_bin_contents = args
|
1036
1057
|
require 'fileutils'
|
1037
1058
|
|
1038
1059
|
# this supposes that the current file is listed by the
|
@@ -1044,6 +1065,16 @@ end
|
|
1044
1065
|
save_file __FILE__, "lib/#{gem_name}.rb"
|
1045
1066
|
)
|
1046
1067
|
|
1068
|
+
# this supposes that the current file is listed by the
|
1069
|
+
# s.files
|
1070
|
+
# field of the specification. it is not currently checked.
|
1071
|
+
gem_bin_generate && (
|
1072
|
+
FileUtils.mkdir_p File.dirname gem_bin_generate
|
1073
|
+
file_backup gem_bin_generate, (File.dirname gem_bin_generate)
|
1074
|
+
File.write gem_bin_generate, gem_bin_contents
|
1075
|
+
(File.chmod 0755, gem_bin_generate)
|
1076
|
+
)
|
1077
|
+
|
1047
1078
|
FileUtils.mkdir_p File.dirname gem_spec_path
|
1048
1079
|
File.write gem_spec_path, gem_spec_contents || (File.read gem_spec_path)
|
1049
1080
|
`gem build #{gem_spec_path}`
|
@@ -1097,7 +1128,7 @@ end
|
|
1097
1128
|
system_user_is_super = @memory[:system_user_is_super]
|
1098
1129
|
gem_spec, user_install = args
|
1099
1130
|
user_install ||= (!system_user_is_super) && "--user-install" || ""
|
1100
|
-
`gem uninstall #{user_install} #{gem_spec}`
|
1131
|
+
`gem uninstall -x #{user_install} #{gem_spec}`
|
1101
1132
|
end
|
1102
1133
|
|
1103
1134
|
# gem_list
|
@@ -1144,6 +1175,37 @@ end
|
|
1144
1175
|
end
|
1145
1176
|
|
1146
1177
|
|
1178
|
+
# extract only the arguments referring to the
|
1179
|
+
# bin file generation from args
|
1180
|
+
def gem_bin_args args=ARGV
|
1181
|
+
gem_name,
|
1182
|
+
gem_version,
|
1183
|
+
gem_dir,
|
1184
|
+
gem_ext,
|
1185
|
+
gem_hifen,
|
1186
|
+
gem_date,
|
1187
|
+
gem_summary,
|
1188
|
+
gem_description,
|
1189
|
+
gem_authors,
|
1190
|
+
gem_email,
|
1191
|
+
gem_files,
|
1192
|
+
gem_homepage,
|
1193
|
+
gem_license,
|
1194
|
+
gem_validate_class,
|
1195
|
+
gem_validate_class_args,
|
1196
|
+
gem_validate_class_method,
|
1197
|
+
gem_is_current_file,
|
1198
|
+
gem_bin_generate,
|
1199
|
+
gem_bin_contents,
|
1200
|
+
gem_bin_executables = args
|
1201
|
+
[
|
1202
|
+
gem_bin_generate,
|
1203
|
+
gem_bin_contents,
|
1204
|
+
gem_bin_executables,
|
1205
|
+
]
|
1206
|
+
end
|
1207
|
+
|
1208
|
+
|
1147
1209
|
# extract only the arguments referring to files
|
1148
1210
|
# from args
|
1149
1211
|
def gem_files_args args=ARGV
|
@@ -1226,11 +1288,15 @@ end
|
|
1226
1288
|
gem_defaults = rubyment_gem_defaults args
|
1227
1289
|
gem_name, gem_version = gem_defaults
|
1228
1290
|
gem_files, gem_is_current_file = gem_files_args gem_defaults
|
1291
|
+
gem_bin_generate, gem_bin_contents = gem_bin_args gem_defaults
|
1292
|
+
|
1229
1293
|
puts gem_build [
|
1230
1294
|
"#{gem_name}.spec",
|
1231
1295
|
gem_spec(gem_defaults),
|
1232
1296
|
gem_is_current_file,
|
1233
|
-
gem_name
|
1297
|
+
gem_name,
|
1298
|
+
gem_bin_generate,
|
1299
|
+
gem_bin_contents,
|
1234
1300
|
]
|
1235
1301
|
already_installed = (
|
1236
1302
|
validate_require gem_validate_args gem_defaults
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.25438548
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribamar Santarosa
|
@@ -12,10 +12,12 @@ date: 2018-04-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
13
13
|
description: a gem for keeping Rubyment, a set of ruby helpers
|
14
14
|
email: ribamar@gmail.com
|
15
|
-
executables:
|
15
|
+
executables:
|
16
|
+
- rubyment
|
16
17
|
extensions: []
|
17
18
|
extra_rdoc_files: []
|
18
19
|
files:
|
20
|
+
- bin/rubyment
|
19
21
|
- lib/rubyment.rb
|
20
22
|
homepage: http://rubygems.org/gems/rubyment
|
21
23
|
licenses:
|