diff --git a/toys/tombstone-library/.data/version-template.erb b/toys/tombstone-library/.data/version-template.erb deleted file mode 100644 index 4e13620..0000000 --- a/toys/tombstone-library/.data/version-template.erb +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright <%= cur_year %> Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -<%= version_lines %> diff --git a/toys/tombstone-library/.toys.rb b/toys/tombstone-library/.toys.rb index 28d8f72..dc3fff5 100644 --- a/toys/tombstone-library/.toys.rb +++ b/toys/tombstone-library/.toys.rb @@ -21,9 +21,6 @@ required_arg :gem_name do desc "Name of the gem to tombstone" end -optional_arg :gem_version do - desc "Gem version to use for the tombstone" -end flag :info_url, "--info-url=URL" do default "" desc "URL to use for more information" @@ -68,22 +65,9 @@ def setup end set :gem_dir, gem_name if gem_dir.to_s.empty? set :info_url, DEFAULT_INFO_URL if info_url.to_s.empty? - ensure_gem_version require "erb" end -def ensure_gem_version - unless gem_version - require "json" - content = capture ["curl", "https://rubygems.org/api/v1/gems/#{gem_name}.json"], err: :null - last_version = JSON.parse(content)["version"] - logger.info "Last released version for #{gem_name} was #{last_version}" - last_version = last_version.split(".").first.to_i - set :gem_version, "#{last_version + 1}.0.0" - end - logger.info "Tombstone will be #{gem_name} version #{gem_version}" -end - def delete_files Dir.each_child gem_dir do |child| rm_rf "#{gem_dir}/#{child}" @@ -98,8 +82,6 @@ def generate_files generate_one "#{gem_name}.gemspec", "gemspec-template.erb" generate_one ".yardopts", "yardopts-template.erb" generate_one "Rakefile", "rakefile-template.erb" - mkdir_p "lib/#{namespace_dir}" - generate_one "lib/#{namespace_dir}/version.rb", "version-template.erb" end end @@ -124,18 +106,3 @@ def namespace def namespace_dir @namespace_dir ||= gem_name.tr "-", "/" end - -def version_lines - lines = [] - indent = 0 - namespace_modules.each do |mod| - lines << "#{' ' * indent}module #{mod}" - indent += 2 - end - lines << "#{' ' * indent}VERSION = \"#{gem_version}\"" - while indent.positive? - indent -= 2 - lines << "#{' ' * indent}end" - end - lines.join "\n" -end