vls 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1ba8a8da9aef839b7e2fab7a318d45f38a07ce1
4
- data.tar.gz: d0ff1d7cc5271118b71b3e13292f3200cb4afdf7
3
+ metadata.gz: ddf99496065f624a2b98d4bdf73233b619e3e42d
4
+ data.tar.gz: 8eecdac22d3507bfffd0364aa20ee96a17f9bbe2
5
5
  SHA512:
6
- metadata.gz: bc0964310a2146bbd0d031bb4417e8d6b16d2c6f2b71a4b5fd1e19877a01c28f7afb27c7d2e4e0280f65e15209bc264ff678b84d6618aee1fc27dc1897754702
7
- data.tar.gz: b941d86543bb3616620c563d82821014e96a1d81dceefd7dd771e037ee0b3f29538c7b26709ae2eaf880e8f5fb1acdbe05a56e91d7b2b579b036c1bf45e9a821
6
+ metadata.gz: 78608e23c2555a9f291c39a212868d8ff1eba1993064c5ccd8776b518826aea6aceff463d488c56fcbc66cce4e9e3b1143d8ac0e361daad174d805f7f4ec3b54
7
+ data.tar.gz: 503caa9869416aa4a34497ec745f026c2cd22e1379e05cece281689b1b76bfa298ae59158ce335a2b394ab8a8f1753a494e049a90f845f628bc1622dbb0a8530
data/README.md CHANGED
@@ -71,6 +71,105 @@ Note that the vls method does not accept a list of modules to be required. It
71
71
  is assumed that when embedded within an application, the needed facilities
72
72
  would have already been loaded.
73
73
 
74
+ ## The Rails Console
75
+
76
+ If the vls gem has been added to a rails project, its functionality is also
77
+ easily accessed via the rails console:
78
+
79
+ $ rails console
80
+
81
+ followed by
82
+
83
+ ```ruby
84
+ VersionLS.ls
85
+ ```
86
+
87
+ will create a formatted listing of the modules with version info of the module
88
+ load out of the web site. For example:
89
+
90
+ $ rails console
91
+ Loading development environment (Rails 4.2.6)
92
+ irb(main):001:0> VersionLS.ls
93
+ ActionDispatch::Journey::Router, 2.0.0
94
+ ActionMailer, 4.2.6
95
+ ActionPack, 4.2.6
96
+ ActionView, 4.2.6
97
+ ActiveJob, 4.2.6
98
+ ActiveModel, 4.2.6
99
+ ActiveRecord, 4.2.6
100
+ ActiveSupport, 4.2.6
101
+ ActiveSupport::Logger, 1.2.7
102
+ Arel, 6.0.3
103
+ Bundler, 1.11.2
104
+ Coffee::Rails, 4.1.1
105
+ Concurrent, 1.0.1
106
+ Erubis, 2.7.0
107
+ ExecJS, 2.6.0
108
+ Gem, 2.2.2
109
+ I18n, 0.7.0
110
+ IRB::ReadlineInputMethod, 5.2
111
+ JSON, 1.8.3
112
+ Jquery::Rails, 4.1.1
113
+ Logger, 1.2.7
114
+ Loofah, 2.0.3
115
+ MIME::Type, 2.99.1
116
+ MIME::Types, 2.99.1
117
+ MIME::Types::WarnLogger, 1.2.7
118
+ Mail, 2.6.3
119
+ MultiJson, 1.11.2
120
+ Nokogiri, 1.6.7.2
121
+ OpenSSL, 1.1.0
122
+ PG, 0.18.4
123
+ Psych, 2.0.5
124
+ Rack, 1.3
125
+ Rack::Test, 0.6.3
126
+ Rails, 4.2.6
127
+ Rails::Html::FullSanitizer, 1.0.3
128
+ Rails::Html::LinkSanitizer, 1.0.3
129
+ Rails::Html::Sanitizer, 1.0.3
130
+ Rails::Html::WhiteListSanitizer, 1.0.3
131
+ Readline, 5.2
132
+ Sass, 3.4.21 (Selective Steve)
133
+ Sass::Rails, 5.0.4
134
+ Sprockets, 3.5.2
135
+ Sprockets::Cache, 3.0
136
+ Sprockets::ClosureCompressor, 1
137
+ Sprockets::CoffeeScriptProcessor, 1
138
+ Sprockets::DirectiveProcessor, 1
139
+ Sprockets::EcoProcessor, 1
140
+ Sprockets::EjsProcessor, 1
141
+ Sprockets::Rails, 3.0.4
142
+ Sprockets::SassCompressor, 1
143
+ Sprockets::UglifierCompressor, 1
144
+ Sprockets::YUICompressor, 1
145
+ TZInfo::Data, 1.2016.2
146
+ ThreadSafe, 0.3.5
147
+ Tilt, 2.0.2
148
+ Turbolinks, 2.5.3
149
+ URI, 0.9.11
150
+ URI::FTP, 0.9.11
151
+ URI::GID, 0.9.11
152
+ URI::Generic, 0.9.11
153
+ URI::HTTP, 0.9.11
154
+ URI::HTTPS, 0.9.11
155
+ URI::LDAP, 0.9.11
156
+ URI::LDAPS, 0.9.11
157
+ URI::MailTo, 0.9.11
158
+ Uglifier, 2.7.2
159
+ Zlib, 0.6.0
160
+ => nil
161
+ irb(main):002:0>
162
+
163
+ ## Usage in Rails Views
164
+
165
+ It is also possible to incorporate vls data into a view using the vls method
166
+ in a controller and passing the resultant array of data to a view for
167
+ rendering in a web page. This may be useful for a diagnostic or informational
168
+ page in the web site.
169
+
170
+ A detailed examination of this task is beyond the scope of this document and
171
+ readers are advised to consult Ruby on Rails tutorials for more information.
172
+
74
173
  ## Contributing
75
174
 
76
175
  #### Plan A
data/bin/vls CHANGED
@@ -1,39 +1,56 @@
1
1
  #!/usr/bin/env ruby
2
- #
3
- # The vls command line utility script.
4
- #
2
+ #The vls command line utility script.
5
3
 
6
- require 'vls'
4
+ require_relative '../lib/vls'
7
5
 
8
- puts "vls (VersionLS): #{VersionLS::VERSION}"
9
- puts
6
+ def vls_show_header
7
+ puts "vls (VersionLS): #{VersionLS::VERSION}"
8
+ puts
9
+ end
10
10
 
11
- if ARGV.empty?
12
- puts "Usage template:"
13
- puts "$ vls <names>"
14
- puts " <names> are gems/files to be required before modules are listed."
11
+ def vls_show_help
12
+ vls_show_header
13
+ puts VersionLS::DESCRIPTION
15
14
  puts
16
- puts "Note:"
15
+ puts "Usage template:"
16
+ puts "$ vls <options> <names>"
17
+ puts "\n<options>"
18
+ puts " --help, -h, -? = Display this text and exit."
19
+ puts " --raw, -r = Display results with no header text."
20
+ puts "\n<names> are gems/files to be required before modules are listed."
21
+ puts "\nNote:"
17
22
  puts " To specify a file instead of a gem, a '.rb' extension is required."
18
- else
19
- no_good = false
20
-
21
- ARGV.each do |pkg|
22
- begin
23
- if pkg.downcase.end_with?('.rb')
24
- require Dir.getwd + '/' + pkg
25
- else
26
- require pkg
27
- end
28
- rescue LoadError, StandardError => error
29
- puts "Error loading #{pkg}, #{error.message}"
30
- no_good = true
31
- end
23
+ exit
24
+ end
25
+
26
+ load_list, no_header = [], false
27
+
28
+ ARGV.each do |arg|
29
+ case arg
30
+ when "--help", "-h", "-?"
31
+ vls_show_help
32
+ when "--raw", "-r"
33
+ no_header = true
34
+ else
35
+ load_list << arg
32
36
  end
37
+ end
33
38
 
34
- exit if no_good
39
+ vls_show_help if load_list.empty?
40
+ vls_show_header unless no_header
41
+ errors_found = false
35
42
 
36
- VersionLS.vls.each do |mod|
37
- puts "#{mod[0]}, #{mod[1]}"
43
+ load_list.each do |pkg|
44
+ begin
45
+ if pkg.downcase.end_with?('.rb')
46
+ require Dir.getwd + '/' + pkg
47
+ else
48
+ require pkg
49
+ end
50
+ rescue LoadError, StandardError => error
51
+ puts "Error loading #{pkg}, #{error.message}"
52
+ errors_found = true
38
53
  end
39
54
  end
55
+
56
+ VersionLS.ls unless errors_found
data/lib/vls.rb CHANGED
@@ -1,43 +1,16 @@
1
1
  # coding: utf-8
2
2
 
3
+ require_relative "vls/monkey_patch"
3
4
  require_relative "vls/version"
4
5
 
5
- #An addition to the Object class for vls support.
6
- class Object
7
- #Get the vls version string from this module.
8
- def to_vls_version_string
9
- "version #{self.class} ???"
10
- end
11
- end
12
-
13
- #An addition to the String class for vls support.
14
- class String
15
- #Get this string as a vls version string.
16
- def to_vls_version_string
17
- self
18
- end
19
- end
20
-
21
- #An addition to the Module class for vls support.
22
- class Module
23
- #Get the vls version string from this module.
24
- def to_vls_version_string
25
- self::STRING
26
- rescue
27
- "version #{self} ???"
28
- end
29
- end
30
-
31
- #An addition to the Array class for vls support.
32
- class Array
33
- #Get the vls version string from this array.
34
- def to_vls_version_string
35
- (1..5) === self.length ? self.join('.') : super
36
- end
37
- end
38
-
39
6
  # The Version LiSt utility module.
40
7
  module VersionLS
8
+ #Perform a Versioned LiSt to the console.
9
+ def self.ls
10
+ vls.each{|mod| puts "#{mod[0]}, #{mod[1]}"}
11
+ nil
12
+ end
13
+
41
14
  #Execute the core of the vls command and return an array of
42
15
  #[module, version] arrays.
43
16
  def self.vls
@@ -54,11 +27,13 @@ module VersionLS
54
27
 
55
28
  #Get a list of modules that have VERSION info.
56
29
  def self.modules
57
- mods = ObjectSpace.each_object(Module).select do |mod|
58
- mod.const_defined?("VERSION")
59
- end.sort do
60
- |first, second| first.name <=> second.name
61
- end
30
+ mods = ObjectSpace.each_object(Module).
31
+ select do |mod|
32
+ mod.const_defined?("VERSION")
33
+ end.
34
+ sort do |first, second|
35
+ first.name <=> second.name
36
+ end
62
37
 
63
38
  mods - [VersionLS]
64
39
  end
@@ -0,0 +1,35 @@
1
+ # coding: utf-8
2
+
3
+ #An addition to the Object class for vls support.
4
+ class Object
5
+ #Get the vls version string from this module.
6
+ def to_vls_version_string
7
+ "version #{self.class} ???"
8
+ end
9
+ end
10
+
11
+ #An addition to the String class for vls support.
12
+ class String
13
+ #Get this string as a vls version string.
14
+ def to_vls_version_string
15
+ self
16
+ end
17
+ end
18
+
19
+ #An addition to the Module class for vls support.
20
+ class Module
21
+ #Get the vls version string from this module.
22
+ def to_vls_version_string
23
+ self::STRING
24
+ rescue
25
+ "version #{self} ???"
26
+ end
27
+ end
28
+
29
+ #An addition to the Array class for vls support.
30
+ class Array
31
+ #Get the vls version string from this array.
32
+ def to_vls_version_string
33
+ (1..5) === self.length ? self.join('.') : super
34
+ end
35
+ end
data/lib/vls/version.rb CHANGED
@@ -1,3 +1,6 @@
1
1
  module VersionLS
2
- STRING = VERSION = "0.3.3"
2
+ STRING = VERSION = "0.3.4"
3
+
4
+ DESCRIPTION = "A command line utility that lists the versions of " +
5
+ "modules used by the specified gems/ruby files."
3
6
  end
data/vls.gemspec CHANGED
@@ -9,8 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Peter Camilleri"]
10
10
  spec.email = ["peter.c.camilleri@gmail.com"]
11
11
 
12
- spec.description = "A command line utility that lists the versions of " +
13
- "modules used by the specified gems/ruby files."
12
+ spec.description = VersionLS::DESCRIPTION
14
13
  spec.summary = "A version listing utility"
15
14
  spec.homepage = "http://teuthida-technologies.com/"
16
15
  spec.license = "MIT"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Camilleri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-26 00:00:00.000000000 Z
11
+ date: 2016-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -53,6 +53,7 @@ files:
53
53
  - README.md
54
54
  - bin/vls
55
55
  - lib/vls.rb
56
+ - lib/vls/monkey_patch.rb
56
57
  - lib/vls/version.rb
57
58
  - rakefile.rb
58
59
  - reek.txt