sciruby 0.2.1 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37ce1d623a33cf7dc0c398b8320869da55bc12c4
4
- data.tar.gz: b03df5bc7e818d9f1d4d5aaf5af7dbf5bea6ada0
3
+ metadata.gz: 75215706909588ef2802c12bdf6d118cb479bb77
4
+ data.tar.gz: c3d841e10f387587b3381430c32447c5cb00b554
5
5
  SHA512:
6
- metadata.gz: 09bedbb54cae59b4a6eeed4a74e12ff4a2112ed81af3e074103b6c678a7e877e3c8e6b3e93a4327ab2a3a7ac8f6f3d1ae9b2bf9ec9fea3eac6967f44cc886b61
7
- data.tar.gz: 15624febecc8ba89cb3561109a878f9ffac687f7acca94affe60808b3ce8a3d307af456d4364aa53f0fbb8c24adbfce416edb014f6421bdc4ed534407df9b44b
6
+ metadata.gz: 76d7cf295cffcdbf903dbab0eed19d9aa2a191d47bfa480229c3b1dac635a8b0b6818fd92405c86d2293c6342426123266241e1d67ecd20c3da10285c52d17ca
7
+ data.tar.gz: f83e95db9dd84128c767d8fe5cb8954acfff6d2ff5bd220c300a157869c2c408394bd875c5fa6f59630ceadf13e8c010e4ab103d99ee5108c0cbe8ece5eff7cc
data/CHANGES CHANGED
@@ -1,3 +1,8 @@
1
+ 0.2.2 (2015-06-09)
2
+
3
+ * Add SciRuby::Gems and SciRuby.gems
4
+ * SciRuby libraries can be autoloaded
5
+
1
6
  0.2.1 (2015-06-08)
2
7
 
3
8
  * Initial release as a meta gem
data/Gemfile CHANGED
@@ -1,34 +1,8 @@
1
- # This file specifies all gems which are installed by the `sciruby-full` gem or recommended by the `sciruby` gem.
1
+ $: << File.join(File.dirname(__FILE__), 'lib')
2
+ require 'sciruby'
2
3
 
3
4
  source 'https://rubygems.org'
4
5
 
5
- gem 'nmatrix'
6
- gem 'gsl-nmatrix'
7
-
8
- gem 'rubyvis'
9
- gem 'nyaplot'
10
- gem 'plotrb'
11
- gem 'gnuplot'
12
-
13
- gem 'iruby'
14
- gem 'pry'
15
- gem 'awesome_print'
16
-
17
- gem 'daru'
18
-
19
- gem 'integration'
20
- gem 'minimization'
21
- gem 'distribution'
22
-
23
- gem 'statsample'
24
- gem 'statsample-glm'
25
- gem 'statsample-bivariate-extension'
26
- #gem 'statsample-timeseries' # currently not working because of activesupport dependency
27
- gem 'extendmatrix'
28
-
29
- gem 'publisci'
30
-
31
- gem 'ai4r'
32
-
33
- # from the bioruby project
34
- gem 'bio'
6
+ SciRuby.gems.all.each do |name, options|
7
+ gem name, *options[:version], require: options[:require].first
8
+ end
data/README.rdoc CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  Tools for Scientific Computing in Ruby
4
4
 
5
- * {Installation}[https://github.com/SciRuby/sciruby/wiki/Installation]
6
5
  * {Website}[http://sciruby.com]
7
6
  * {Google+}[https://plus.google.com/109304769076178160953/posts]
8
7
  * {NMatrix}[http://github.com/SciRuby/nmatrix]
@@ -13,6 +12,13 @@ Ruby has for some time had no equivalent to the beautifully constructed numpy, s
13
12
 
14
13
  We are not the first with this idea, but we are trying to bring it to life.
15
14
 
15
+ == Installation
16
+
17
+ gem install sciruby
18
+ gem install sciruby-full
19
+
20
+ See also the {guide in the wiki}[https://github.com/SciRuby/sciruby/wiki/Installation].
21
+
16
22
  == License
17
23
 
18
24
  Copyright (c) 2010 onward, The Ruby Science Foundation.
data/gems.yml ADDED
@@ -0,0 +1,63 @@
1
+ # Specify all gems which are installed by the `sciruby-full` gem or recommended by the `sciruby` gem.
2
+
3
+ nmatrix:
4
+ description: 'Numerical matrix library'
5
+ module: [NMatrix, NVector]
6
+ gsl-nmatrix:
7
+ description: 'Bindings for the GNU scientific library'
8
+ require: gsl
9
+ module: GSL
10
+
11
+ rubyvis:
12
+ description: 'Plotting library'
13
+ nyaplot:
14
+ description: 'Plotting library'
15
+ plotrb:
16
+ description: 'Plotting library'
17
+ gnuplot:
18
+ description: 'Plotting library'
19
+
20
+ iruby:
21
+ module: IRuby
22
+ description: 'Ruby kernel for Jupyter'
23
+ pry:
24
+ module: Pry
25
+ description: 'Ruby repl'
26
+ awesome_print:
27
+ module: ~
28
+ description: 'Pretty object printing'
29
+
30
+ daru:
31
+ description: 'Dataframe library'
32
+
33
+ integration:
34
+ description: 'Numerical integration'
35
+ minimization:
36
+ description: 'Numerical minimization'
37
+ distribution:
38
+ description: 'Statistical distributions'
39
+
40
+ statsample:
41
+ descriptions: 'Statistics'
42
+ statsample-glm:
43
+ descriptions: 'Statistics'
44
+ module: ~
45
+ statsample-bivariate-extension:
46
+ descriptions: 'Statistics'
47
+ module: ~
48
+ #statsample-timeseries: # currently not working because of activesupport dependency
49
+ # descriptions: 'Statistics'
50
+ # module: ~
51
+ extendmatrix:
52
+ description: 'Helper methods for Matrix'
53
+ module: ~
54
+
55
+ publisci:
56
+ description: 'Publishing toolkit'
57
+ module: PubliSci
58
+
59
+ ai4r:
60
+ description: 'Artificial intelligence'
61
+
62
+ bio:
63
+ description: 'Bioinformatics suite'
data/lib/sciruby.rb CHANGED
@@ -1,2 +1,4 @@
1
+ require 'yaml'
1
2
  require 'sciruby/version'
2
3
  require 'sciruby/gems'
4
+ require 'sciruby/autoload'
@@ -0,0 +1,13 @@
1
+ class Module
2
+ alias :const_missing_without_sciruby :const_missing
3
+
4
+ def const_missing(name)
5
+ paths = SciRuby.gems.autoload_modules.delete(name)
6
+ if paths
7
+ paths.each {|path| require path }
8
+ const_get(name)
9
+ else
10
+ const_missing_without_sciruby(name)
11
+ end
12
+ end
13
+ end
data/lib/sciruby/gems.rb CHANGED
@@ -1,27 +1,55 @@
1
1
  module SciRuby
2
- extend self
2
+ # @api public
3
+ class Gems
4
+ # Return map of all known SciRuby gems
5
+ attr_reader :all
3
6
 
4
- def all_gems
5
- @all_gems ||= File.read(File.expand_path(File.join(__FILE__, '..', '..', '..', 'Gemfile'))).scan(/^(?!#.*)gem\s+'(.*?)'/).map(&:first)
6
- end
7
+ # Modules which can be autoloaded
8
+ attr_reader :autoload_modules
9
+
10
+ # Return map of all installed SciRuby gems
11
+ def installed
12
+ @installed ||=
13
+ begin
14
+ require 'rubygems'
15
+ Hash[all.map {|name, options| installed_gem(name, options) }.compact]
16
+ end
17
+ end
18
+
19
+ # Return list of all known SciRuby modules
20
+ def all_modules
21
+ @all_modules ||= all.map { |name, options| options[:module] }.flatten
22
+ end
23
+
24
+ # Return list of all installed SciRuby modules
25
+ def installed_modules
26
+ @installed_modules ||= installed.map { |name, options| options[:module] }.flatten
27
+ end
7
28
 
8
- def installed_gems
9
- @installed_gems ||=
10
- begin
11
- require 'rubygems'
12
- Hash[all_gems.map {|name| (v = gem_version(name)) && [name, v] }.compact]
29
+ # Initialize gem list
30
+ def initialize(file)
31
+ @all, @autoload_modules = {}, {}
32
+ YAML.load_file(file).each do |name, options|
33
+ options = Hash[options.map {|k,v| [k.to_sym, v] }]
34
+ options[:require] = [*(options[:require] || name)]
35
+ options[:module] = name.capitalize unless options.include?(:module)
36
+ options[:module] = [*options[:module]].map(&:to_sym)
37
+ options[:module].each {|mod| @autoload_modules[mod] = options[:require] }
38
+ @all[name] = options
13
39
  end
14
- end
40
+ end
15
41
 
16
- def require!
17
- installed_gems.each {|gem,_| require gem }
18
- end
42
+ private
19
43
 
20
- private
44
+ def installed_gem(name, options)
45
+ [name, options.merge(gem_version: Gem::Specification.find_by_name(name).version.to_s)]
46
+ rescue Exception
47
+ nil
48
+ end
49
+ end
21
50
 
22
- def gem_version(name)
23
- Gem::Specification.find_by_name(name).version.to_s
24
- rescue Exception
25
- nil
51
+ @gems = Gems.new(File.expand_path(File.join(__FILE__, '..', '..', '..', 'gems.yml')))
52
+ class << self
53
+ attr_reader :gems
26
54
  end
27
55
  end
@@ -1,3 +1,6 @@
1
+ # @api public
1
2
  module SciRuby
2
- VERSION = '0.2.1'
3
+ # SciRuby version string
4
+ # @api public
5
+ VERSION = '0.2.2'
3
6
  end
data/sciruby.gemspec CHANGED
@@ -24,12 +24,12 @@ Gem::Specification.new do |s|
24
24
  s.files.reject! {|f| f =~ /\Alib/ }
25
25
 
26
26
  s.add_runtime_dependency 'sciruby', "= #{SciRuby::VERSION}"
27
- SciRuby.all_gems.each {|gem| s.add_runtime_dependency gem }
27
+ SciRuby.gems.all.each {|name, options| s.add_runtime_dependency name, *options[:version] }
28
28
  else
29
29
  s.files.delete 'sciruby-full.gemspec'
30
30
 
31
31
  m = "Please consider installing 'sciruby-full' or the following gems:\n"
32
- SciRuby.all_gems.each {|gem| m << " * #{gem}\n" }
32
+ SciRuby.gems.all.each {|name, options| m << " * #{name}\n" }
33
33
  s.post_install_message = m << "\n"
34
34
  end
35
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sciruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - SciRuby Development Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-08 00:00:00.000000000 Z
11
+ date: 2015-06-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Scientific gems for Ruby
14
14
  email:
@@ -23,7 +23,9 @@ files:
23
23
  - Gemfile
24
24
  - LICENSE.txt
25
25
  - README.rdoc
26
+ - gems.yml
26
27
  - lib/sciruby.rb
28
+ - lib/sciruby/autoload.rb
27
29
  - lib/sciruby/gems.rb
28
30
  - lib/sciruby/version.rb
29
31
  - sciruby.gemspec