rbundle 0.2.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 50ae02192e42aaddc31011c5c3c1560b5f0e6be1
4
+ data.tar.gz: 0224b5f9787013073d76c527880e6c96a5dedc5f
5
+ SHA512:
6
+ metadata.gz: ec13470101bce9319315e8a24ab7fa1d4aff3d8e2d044aba47a92d6a825f23b5a3064bee1f0514ba4f2657d2bc36943ccbff00f18519c986f1e48eea43c8d08d
7
+ data.tar.gz: 8007a3ee7338e1c3ec5b615e9befddc0e10e8d00e8b9c8716b132be0ab40469bb3225b9bddd1accec568afc9e46ec5e05b15c62d2f0d571d2b70b8aab26db3fc
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ .idea/
2
+ *.gem
3
+ *.rbc
4
+ .bundle
5
+ .config
6
+ .yardoc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rmake.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Simon
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # Rmake
2
+
3
+ A bundler for R capable of installing packages from cran
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'rbundle'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install rbundle
18
+
19
+ ## Usage
20
+ ### Defining Dependencies
21
+
22
+ Create a file named dependencies.txt like below(YAML format)
23
+ ```yaml
24
+ ---
25
+ - package: 'data.table'
26
+ version: '1.9.6'
27
+
28
+ - package: 'ISOweek'
29
+ version: '0.6-2'
30
+ ```
31
+
32
+ From the folder containing the Rmake file run rbundle
33
+
34
+ ```bash
35
+ $ rbundle
36
+ ```
37
+
38
+ You are done, you should now see all packages(which are not present or having older versions) being downloaded and installed on your machine.
39
+
40
+ ## Known Issues / Behaviour
41
+ The base R installation cannot be automated. If unmatching R version is found, Rmake would stall requiring you to match the R version manually and then continue with package installation.
42
+
43
+ ## Contributing
44
+
45
+ 1. Fork it
46
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
47
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
48
+ 4. Push to the branch (`git push origin my-new-feature`)
49
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/rbundle ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rbundle'
3
+
4
+ action = ARGV.empty? ? 'install': ARGV[0]
5
+ RBundler.bundle
@@ -0,0 +1,3 @@
1
+ module Rbundle
2
+ VERSION = '0.2.1'
3
+ end
data/lib/rbundle.rb ADDED
@@ -0,0 +1,42 @@
1
+ require "rbundle/version"
2
+ require "yaml"
3
+
4
+ class RBundler
5
+ def self.bundle
6
+ install_installer
7
+ self.read_requirements.each {|d| install(d)}
8
+ end
9
+
10
+ def self.read_requirements
11
+ dependencies_definitions = "#{Dir.pwd}/dependencies.txt"
12
+ puts "Reading Dependencies to install from #{Dir.pwd}/dependencies.txt"
13
+ YAML.load(File.open(dependencies_definitions))
14
+ end
15
+
16
+ def self.command_inspector(exit_code)
17
+ if(exit_code != 0)
18
+ puts("Installation failed")
19
+ exit(exit_code)
20
+ end
21
+ end
22
+
23
+ def self.install_installer
24
+ puts "Installing devtools"
25
+ command = %{
26
+ R --vanilla --slave -e "if (! ('devtools' %in% installed.packages()[,'Package'])) install.packages(pkgs='devtools', repos=c('https://cloud.r-project.org'))"
27
+ }
28
+ puts "Executing #{command}"
29
+ `#{command}`
30
+ command_inspector($?.exitstatus)
31
+ end
32
+
33
+ def self.install(dependency)
34
+ puts "Installing #{dependency['package']}"
35
+ command = %{
36
+ R --slave --vanilla -e "options(warn=2); library(devtools); if ((!'#{dependency['package']}' %in% installed.packages()[,'Package']) || packageVersion('#{dependency['package']}') < '#{dependency['version']}') install_version('#{dependency['package']}', version='#{dependency['version']}', repos=c('https://cloud.r-project.org'))"
37
+ }
38
+ puts "Executing #{command}"
39
+ `#{command}`
40
+ command_inspector($?.exitstatus)
41
+ end
42
+ end
data/rbundle.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rbundle/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'rbundle'
8
+ spec.version = Rbundle::VERSION
9
+ spec.authors = ['Simon']
10
+ spec.email = ['simon@delium.co']
11
+ spec.description = %q{A bundler for R}
12
+ spec.summary = %q{Installs R package dependencies with versions}
13
+ spec.homepage = ''
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.3'
22
+ spec.add_development_dependency 'rake'
23
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rbundle
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
+ platform: ruby
6
+ authors:
7
+ - Simon
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-03-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: A bundler for R
42
+ email:
43
+ - simon@delium.co
44
+ executables:
45
+ - rbundle
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - .gitignore
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - bin/rbundle
55
+ - lib/rbundle.rb
56
+ - lib/rbundle/version.rb
57
+ - rbundle.gemspec
58
+ homepage: ''
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.0.14.1
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: Installs R package dependencies with versions
82
+ test_files: []