Class: Cibuildgem::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/cibuildgem/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/cibuildgem/cli.rb', line 15

def exit_on_failure?
  true
end

Instance Method Details

#ci_templateObject



98
99
100
101
102
103
104
105
106
107
# File 'lib/cibuildgem/cli.rb', line 98

def ci_template
  ruby_requirements = compilation_task.gemspec.required_ruby_version
  # os = ["macos-latest", "macos-15-intel", "ubuntu-latest", "windows-latest"]
  @os = ["macos-latest", "ubuntu-22.04"] # Just this for now because the CI takes too long otherwise.
  @latest_supported_ruby_version = RubySeries.latest_version_for_requirements(ruby_requirements)
  @runtime_version_for_compilation = RubySeries.runtime_version_for_compilation(ruby_requirements)
  @ruby_versions_for_testing = RubySeries.versions_to_test_against(ruby_requirements)

  directory("github", ".github", context: instance_eval("binding"))
end

#cleanObject



74
75
76
# File 'lib/cibuildgem/cli.rb', line 74

def clean
  run_rake_tasks!("cibuildgem:setup", :clean)
end

#clobberObject



85
86
87
# File 'lib/cibuildgem/cli.rb', line 85

def clobber
  run_rake_tasks!("cibuildgem:setup", :clobber)
end

#compileObject



31
32
33
# File 'lib/cibuildgem/cli.rb', line 31

def compile
  run_rake_tasks!("cibuildgem:setup", :compile)
end

#copy_from_staging_to_libObject



63
64
65
# File 'lib/cibuildgem/cli.rb', line 63

def copy_from_staging_to_lib
  run_rake_tasks!("cibuildgem:setup", "copy:stage:lib")
end

#packageObject



48
49
50
51
52
# File 'lib/cibuildgem/cli.rb', line 48

def package
  ENV["RUBY_CC_VERSION"] ||= compilation_task.ruby_cc_version

  run_rake_tasks!("cibuildgem:setup", :cross, :native, :gem)
end


136
137
138
# File 'lib/cibuildgem/cli.rb', line 136

def print_normalized_platform
  print(compilation_task.normalized_platform)
end


131
132
133
# File 'lib/cibuildgem/cli.rb', line 131

def print_ruby_cc_version
  print(ENV["RUBY_CC_VERSION"] || compilation_task.ruby_cc_version)
end

#releaseObject



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/cibuildgem/cli.rb', line 111

def release
  Dir.glob(options[:glob]).each do |file|
    pathname = Pathname(file)
    next if pathname.directory? || pathname.extname != ".gem"

    out, status = Open3.capture2e("gem push #{file}")
    next if status.success?

    if out =~ /Repushing of gem versions is not allowed/
      puts "Gem #{file} already exists on RubyGems.org, skipping..."

      next
    end

    raise out
  end
end

#testObject



58
59
60
# File 'lib/cibuildgem/cli.rb', line 58

def test
  run_rake_tasks!("cibuildgem:setup", :test)
end