cmdstan 0.2.2 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f1f35290531f540948f74615fbf92d7e51d86d2f382427ebe41945a570ac94e
4
- data.tar.gz: 14d5ddb746c8e45a2914b4cc354af79b7efd64bf71066f6dda1bb65d0b55165b
3
+ metadata.gz: dde99b1db68e538dc01d7e6ce907cfe4ad1af6f2cf6f1a1db5cf557189663230
4
+ data.tar.gz: e7ddb58b9b28caa296b65c3b15e12d9dde92f3973324094beed8a7052d49adda
5
5
  SHA512:
6
- metadata.gz: 36be447dfbb0fb609730df687581daa35eb793ad1ec66d1ec8a87ef3b2dbddcb80925f78911eeaa3d65c6f2327de4cfe77da40f628f9d7ba7bed220f69a115a2
7
- data.tar.gz: 55b1ec0beff220127d4d9474ccdc59b04ef9d9a37522dbbc09a5f19a0bc052e4995722b7bef023dc513a78410b5bf4ca412ba39cc18de529bea832c51708772d
6
+ metadata.gz: 459c6135f000ea13fe183c9a582a58af9ff55d4921b664efc9de5b9d14e914d3548cb650c3fb438d83f4ba8745172124244b60a97d43d0362b1f1dfb7691c2ad
7
+ data.tar.gz: b69664ddc8bd83e74d14cf763fb5a809d305db5f83b3070885c74d3ac1565ef2db4aa47824e3e0329cb29eea01217b7d6181673ad62f4909c58d3759b06618b0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 0.3.1 (2024-02-07)
2
+
3
+ - Updated CmdStan to 2.34.1
4
+
5
+ ## 0.3.0 (2023-10-11)
6
+
7
+ - Updated CmdStan to 2.33.1
8
+ - Dropped support for Ruby < 3
9
+
1
10
  ## 0.2.2 (2023-04-20)
2
11
 
3
12
  - Updated CmdStan to 2.32.0
@@ -1,11 +1,14 @@
1
1
  module CmdStan
2
2
  module Install
3
+ include Utils
4
+
3
5
  def cmdstan_version
4
- "2.32.0"
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 = "e387890fd02c167c38db34c34a09ff2193c354b203d11ca1d34da0ec4b2b0606"
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 = "29fee108d2ae3dca5be7c0a65a70517922e4be671e129d177c84f77a11263d4a"
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.2.2"
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.2.2
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-04-20 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: []
@@ -38,14 +52,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
38
52
  requirements:
39
53
  - - ">="
40
54
  - !ruby/object:Gem::Version
41
- version: '2.7'
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.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