cmdstan 0.2.2 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/cmdstan/install.rb +32 -26
- data/lib/cmdstan/version.rb +1 -1
- data/lib/cmdstan.rb +1 -1
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dde99b1db68e538dc01d7e6ce907cfe4ad1af6f2cf6f1a1db5cf557189663230
|
4
|
+
data.tar.gz: e7ddb58b9b28caa296b65c3b15e12d9dde92f3973324094beed8a7052d49adda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 459c6135f000ea13fe183c9a582a58af9ff55d4921b664efc9de5b9d14e914d3548cb650c3fb438d83f4ba8745172124244b60a97d43d0362b1f1dfb7691c2ad
|
7
|
+
data.tar.gz: b69664ddc8bd83e74d14cf763fb5a809d305db5f83b3070885c74d3ac1565ef2db4aa47824e3e0329cb29eea01217b7d6181673ad62f4909c58d3759b06618b0
|
data/CHANGELOG.md
CHANGED
data/lib/cmdstan/install.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
module CmdStan
|
2
2
|
module Install
|
3
|
+
include Utils
|
4
|
+
|
3
5
|
def cmdstan_version
|
4
|
-
"2.
|
6
|
+
"2.34.1"
|
5
7
|
end
|
6
8
|
|
7
9
|
def cmdstan_installed?
|
8
|
-
|
10
|
+
# last file to be built
|
11
|
+
File.exist?(File.join(CmdStan.path, "bin", "diagnose#{extension}"))
|
9
12
|
end
|
10
13
|
|
11
14
|
def install_cmdstan
|
@@ -14,10 +17,10 @@ module CmdStan
|
|
14
17
|
|
15
18
|
# no stanc3 binary for Mac ARM
|
16
19
|
if RbConfig::CONFIG["host_os"] !~ /darwin/i && RbConfig::CONFIG["host_cpu"] =~ /arm|aarch64/i
|
17
|
-
checksum = "
|
20
|
+
checksum = "04eabc41b6221176a661818852e7187407e4590ee462e608df149ff37eede859"
|
18
21
|
url = "https://github.com/stan-dev/cmdstan/releases/download/v#{version}/cmdstan-#{version}-linux-arm64.tar.gz"
|
19
22
|
else
|
20
|
-
checksum = "
|
23
|
+
checksum = "9a6efc817a473768cf21f1e4bb1303be7ade2e26fc971856a7f9cf0bc3355f2b"
|
21
24
|
url = "https://github.com/stan-dev/cmdstan/releases/download/v#{version}/cmdstan-#{version}.tar.gz"
|
22
25
|
end
|
23
26
|
|
@@ -27,34 +30,37 @@ module CmdStan
|
|
27
30
|
# only needed if default path
|
28
31
|
FileUtils.mkdir_p(File.expand_path("../../tmp", __dir__)) unless ENV["CMDSTAN"]
|
29
32
|
|
30
|
-
if
|
33
|
+
if cmdstan_installed?
|
31
34
|
puts "Already installed"
|
32
35
|
return true
|
33
36
|
end
|
34
37
|
|
35
|
-
Dir.
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
Dir.chdir(path) do
|
49
|
-
# disable precompiled header to save space
|
50
|
-
output, status = Open3.capture2e(make_command, "build", "PRECOMPILED_HEADERS=false")
|
51
|
-
if status.exitstatus != 0
|
52
|
-
puts output
|
53
|
-
raise Error, "Build failed"
|
54
|
-
end
|
38
|
+
unless Dir.exist?(dir)
|
39
|
+
Dir.mktmpdir do |tmpdir|
|
40
|
+
puts "Downloading..."
|
41
|
+
download_path = File.join(tmpdir, "cmdstan-#{version}.tar.gz")
|
42
|
+
download_file(url, download_path, checksum)
|
43
|
+
|
44
|
+
puts "Unpacking..."
|
45
|
+
path = File.join(tmpdir, "cmdstan-#{version}")
|
46
|
+
FileUtils.mkdir_p(path)
|
47
|
+
tar_args = Gem.win_platform? ? ["--force-local"] : []
|
48
|
+
system "tar", "xzf", download_path, "-C", path, "--strip-components=1", *tar_args
|
49
|
+
|
50
|
+
FileUtils.mv(path, dir)
|
55
51
|
end
|
52
|
+
end
|
56
53
|
|
57
|
-
|
54
|
+
# cannot be moved after being built
|
55
|
+
puts "Building..."
|
56
|
+
make_command = Gem.win_platform? ? "mingw32-make" : "make"
|
57
|
+
Dir.chdir(dir) do
|
58
|
+
# disable precompiled header to save space
|
59
|
+
output, status = Open3.capture2e(make_command, "build", "PRECOMPILED_HEADERS=false")
|
60
|
+
if status.exitstatus != 0
|
61
|
+
puts output
|
62
|
+
raise Error, "Build failed"
|
63
|
+
end
|
58
64
|
end
|
59
65
|
|
60
66
|
puts "Installed"
|
data/lib/cmdstan/version.rb
CHANGED
data/lib/cmdstan.rb
CHANGED
@@ -8,8 +8,8 @@ require "open3"
|
|
8
8
|
require "tempfile"
|
9
9
|
|
10
10
|
# modules
|
11
|
-
require_relative "cmdstan/install"
|
12
11
|
require_relative "cmdstan/utils"
|
12
|
+
require_relative "cmdstan/install"
|
13
13
|
require_relative "cmdstan/mcmc"
|
14
14
|
require_relative "cmdstan/mle"
|
15
15
|
require_relative "cmdstan/model"
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmdstan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
11
|
+
date: 2024-02-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: csv
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
description:
|
14
28
|
email: andrew@ankane.org
|
15
29
|
executables: []
|
@@ -38,14 +52,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
38
52
|
requirements:
|
39
53
|
- - ">="
|
40
54
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
55
|
+
version: '3'
|
42
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
57
|
requirements:
|
44
58
|
- - ">="
|
45
59
|
- !ruby/object:Gem::Version
|
46
60
|
version: '0'
|
47
61
|
requirements: []
|
48
|
-
rubygems_version: 3.
|
62
|
+
rubygems_version: 3.5.3
|
49
63
|
signing_key:
|
50
64
|
specification_version: 4
|
51
65
|
summary: Bayesian inference for Ruby, powered by CmdStan
|