From 06e43ca1372a66092133f910cc01c01ddd7a67f8 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Wed, 5 Oct 2022 09:27:26 +0200 Subject: [PATCH] set version number in lib/rpl.rb and nowhere else --- bin/rpl | 2 +- lib/rpl.rb | 2 ++ lib/rpl/interpreter.rb | 2 -- lib/rpl/words/general.rb | 6 ++---- rpl.gemspec | 4 +++- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/rpl b/bin/rpl index fca0cc0..11e37ee 100755 --- a/bin/rpl +++ b/bin/rpl @@ -54,7 +54,7 @@ options = { run_REPL: ARGV.empty?, files: [], programs: [] } -Version = '0.10.1' +Version = Rpl::VERSION OptionParser.new do |opts| opts.on('-s', "--state filename", "persist state in filename (default: #{options[:persistence_filename]}) (will be created if needed)") do |filename| diff --git a/lib/rpl.rb b/lib/rpl.rb index 387c6e8..126ed29 100644 --- a/lib/rpl.rb +++ b/lib/rpl.rb @@ -5,6 +5,8 @@ require 'rpl/types' require 'rpl/words' class Rpl < Interpreter + VERSION = '0.10.2' + include Types attr_accessor :live_persistence diff --git a/lib/rpl/interpreter.rb b/lib/rpl/interpreter.rb index 1b143e8..8a3c313 100644 --- a/lib/rpl/interpreter.rb +++ b/lib/rpl/interpreter.rb @@ -37,8 +37,6 @@ class Interpreter attr_accessor :precision def initialize( stack: [], dictionary: Dictionary.new ) - @version = 0.101 - @dictionary = dictionary @stack = stack diff --git a/lib/rpl/words/general.rb b/lib/rpl/words/general.rb index d6c67fb..e9045d3 100644 --- a/lib/rpl/words/general.rb +++ b/lib/rpl/words/general.rb @@ -35,15 +35,13 @@ module RplLang category, '( -- n ) Pop the interpreter\'s version number', proc do - @stack << Types.new_object( RplString, "\"#{@version}\"" ) + @stack << Types.new_object( RplString, "\"#{Rpl::VERSION}\"" ) end ) @dictionary.add_word( ['uname'], category, '( -- s ) Pop the interpreter\'s complete indentification string', - proc do - @stack << Types.new_object( RplString, "\"Rpl Interpreter version #{@version}\"" ) - end ) + Types.new_object( RplProgram, '« "Rpl Interpreter version " version + »' ) ) end end end diff --git a/rpl.gemspec b/rpl.gemspec index c164f7e..38c4510 100644 --- a/rpl.gemspec +++ b/rpl.gemspec @@ -1,8 +1,10 @@ # frozen_string_literal: true +require_relative './lib/rpl' + Gem::Specification.new do |s| s.name = 'rpl' - s.version = '0.10.1' + s.version = Rpl::VERSION s.summary = 'Functional Stack Language' s.description = "A language inspired by HP's RPL and https://github.com/louisrubet/rpn/" s.authors = ['Gwenhael Le Moine']