Skip to content

Commit

Permalink
Snapshot 3
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Oct 25, 2024
1 parent 037df47 commit 3fed699
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
7 changes: 7 additions & 0 deletions lib/tebako/codegen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
# POSSIBILITY OF SUCH DAMAGE.

require "pathname"
require "fileutils"
require_relative "cli_helpers"

# Tebako - an executable packager
Expand Down Expand Up @@ -82,6 +83,9 @@ def tebako_fs_cpp(fs_entry_point)

def generate_tebako_fs_cpp(deps, fs_entry_point)
fname = File.join(deps, "src", "tebako-fs.cpp")
dir = File.dirname(fname)
FileUtils.mkdir_p(dir)

Check warning on line 87 in lib/tebako/codegen.rb

View check run for this annotation

Codecov / codecov/patch

lib/tebako/codegen.rb#L85-L87

Added lines #L85 - L87 were not covered by tests

File.open(fname, "w") do |file|
file.write(COMMON_HEADER)
file.write(tebako_fs_cpp(fs_entry_point))

Check warning on line 91 in lib/tebako/codegen.rb

View check run for this annotation

Codecov / codecov/patch

lib/tebako/codegen.rb#L89-L91

Added lines #L89 - L91 were not covered by tests
Expand All @@ -100,6 +104,9 @@ def tebako_version_h(v_parts)

def generate_tebako_version_h(deps, v_parts)
fname = File.join(deps, "include", "tebako", "tebako-version.h")
dir = File.dirname(fname)
FileUtils.mkdir_p(dir)

File.open(fname, "w") do |file|
file.write(COMMON_HEADER)
file.write(tebako_version_h(v_parts))
Expand Down
15 changes: 8 additions & 7 deletions spec/cli_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@
end

describe "#do_press" do
let(:deps) { "/path/to/deps" }
let(:output_folder) { "/path/to/output" }
let(:source) { "/path/to/source" }
let(:root) { "/path/to/root" }
let(:output) { "/path/to/output" }
let(:deps) { "/tmp/path/to/deps" }
let(:output_folder) { "/tmp/path/to/output" }
let(:source) { "/tmp/path/to/source" }
let(:root) { "/tmp/path/to/root" }
let(:output) { "/tmp/path/to/output" }
let(:entry_pont) { "entrypoint" }
let(:m_files) { "Unix Makefiles" }
let(:ruby_ver) { "3.2.5" }
Expand All @@ -173,13 +173,14 @@
allow(self).to receive(:options).and_return({ "entry-point" => entry_pont })
allow(self).to receive(:m_files).and_return(m_files)
allow(self).to receive(:extend_ruby_version).and_return([ruby_ver, ruby_hash])
end
before do

stub_const("RUBY_PLATFORM", "x86_64-linux")
end

it "executes the press command successfully" do
allow(self).to receive(:system).and_return(true)
allow(Tebako::Codegen).to receive(:generate_tebako_version_h).and_return(true)

expect(do_press).to be_truthy
end

Expand Down

0 comments on commit 3fed699

Please sign in to comment.