cmdstan 0.3.0 → 0.3.1

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
  SHA256:
3
- metadata.gz: d999f16d473beed02a81e38bcc0b8cae80a3eee618d1dd480a11f765ed9096c0
4
- data.tar.gz: 25d5de3672e5302e117f60f75a83f9b4e70b76ff1b0ec7b5fa12bb0a7e50ab9b
3
+ metadata.gz: dde99b1db68e538dc01d7e6ce907cfe4ad1af6f2cf6f1a1db5cf557189663230
4
+ data.tar.gz: e7ddb58b9b28caa296b65c3b15e12d9dde92f3973324094beed8a7052d49adda
5
5
  SHA512:
6
- metadata.gz: 7347434cfad349c8568d6c68c541178214556a3d134bec085744f366aeb7c796b4f20438bdae976a3fbfcaebd72840e3b5c80c9caa301d010ee60b64873bbcac
7
- data.tar.gz: fae8773a405a4ace61d6db1fc1e1f6d81319710c46cc9eaffb1494ec66d95be68688d90ba2f0ac3e59b664982342071c9afa97df6b2f491bc93847a87553cf1d
6
+ metadata.gz: 459c6135f000ea13fe183c9a582a58af9ff55d4921b664efc9de5b9d14e914d3548cb650c3fb438d83f4ba8745172124244b60a97d43d0362b1f1dfb7691c2ad
7
+ data.tar.gz: b69664ddc8bd83e74d14cf763fb5a809d305db5f83b3070885c74d3ac1565ef2db4aa47824e3e0329cb29eea01217b7d6181673ad62f4909c58d3759b06618b0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.3.1 (2024-02-07)
2
+
3
+ - Updated CmdStan to 2.34.1
4
+
1
5
  ## 0.3.0 (2023-10-11)
2
6
 
3
7
  - Updated CmdStan to 2.33.1
@@ -1,11 +1,14 @@
1
1
  module CmdStan
2
2
  module Install
3
+ include Utils
4
+
3
5
  def cmdstan_version
4
- "2.33.1"
6
+ "2.34.1"
5
7
  end
6
8
 
7
9
  def cmdstan_installed?
8
- Dir.exist?(CmdStan.path)
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 = "c683cd171f89a2c4eab49f6617e8584d5962a839b1203f6cb46d882d25b93f67"
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 = "b848bb61178bd71980355b80994030537726d5e5862c4ddc926f23a22a001e4a"
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 Dir.exist?(dir)
33
+ if cmdstan_installed?
31
34
  puts "Already installed"
32
35
  return true
33
36
  end
34
37
 
35
- Dir.mktmpdir do |tmpdir|
36
- puts "Downloading..."
37
- download_path = File.join(tmpdir, "cmdstan-#{version}.tar.gz")
38
- download_file(url, download_path, checksum)
39
-
40
- puts "Unpacking..."
41
- path = File.join(tmpdir, "cmdstan-#{version}")
42
- FileUtils.mkdir_p(path)
43
- tar_args = Gem.win_platform? ? ["--force-local"] : []
44
- system "tar", "xzf", download_path, "-C", path, "--strip-components=1", *tar_args
45
-
46
- puts "Building..."
47
- make_command = Gem.win_platform? ? "mingw32-make" : "make"
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
- FileUtils.mv(path, dir)
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"
@@ -1,3 +1,3 @@
1
1
  module CmdStan
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
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.3.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: 2023-10-11 00:00:00.000000000 Z
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: []
@@ -45,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
45
59
  - !ruby/object:Gem::Version
46
60
  version: '0'
47
61
  requirements: []
48
- rubygems_version: 3.4.10
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