class Semvergen::Launcher

Public Instance Methods

bump!(options={}) click to toggle source
# File lib/semvergen/launcher.rb, line 5
def bump!(options={})
  Semvergen::Bump.new(interface, version_file, node_version_file, change_log_file, shell, gem_name, gem_server, notifier).run!(options)
end
release!(options={}) click to toggle source
# File lib/semvergen/launcher.rb, line 9
def release!(options={})
  Semvergen::Release.new(interface, version_file, node_version_file, change_log_file, shell, gem_name, gem_server, notifier).run!(options)
end

Private Instance Methods

change_log_file() click to toggle source
# File lib/semvergen/launcher.rb, line 35
def change_log_file
  ChangeLogFile.new
end
config() click to toggle source
# File lib/semvergen/launcher.rb, line 85
def config
  @config ||= if File.exist?(config_path)
    YAML.load_file(config_path) || {}
  else
    {}
  end
end
config_path() click to toggle source
# File lib/semvergen/launcher.rb, line 93
def config_path
  File.join(".semvergen")
end
gem_name() click to toggle source
# File lib/semvergen/launcher.rb, line 55
def gem_name
  File.basename(gem_spec).gsub(".gemspec", "")
end
gem_server() click to toggle source
# File lib/semvergen/launcher.rb, line 71
def gem_server
  if File.exists?(gem_server_file)
    File.read(gem_server_file)
  elsif (gem_server = config["gemserver"])
    gem_server
  else
    interface.fail_exit "To publish, place the url (with optional username and pass) in a .gem_server file"
  end
end
gem_server_file() click to toggle source
# File lib/semvergen/launcher.rb, line 81
def gem_server_file
  File.join(".gem_server")
end
gem_spec() click to toggle source
# File lib/semvergen/launcher.rb, line 63
def gem_spec
  gemspecs = Dir["*.gemspec"]
  interface.fail_exit("No gemspec found in current dir") if gemspecs.count == 0
  interface.fail_exit("More than one gemspec found in current dir") if gemspecs.count > 1

  gemspecs[0]
end
interface() click to toggle source
# File lib/semvergen/launcher.rb, line 59
def interface
  @interface ||= Interface.new
end
nested_version_path() click to toggle source
# File lib/semvergen/launcher.rb, line 47
def nested_version_path
  File.join("lib", gem_name.gsub("-", "/"), "version.rb")
end
node_version_file() click to toggle source
# File lib/semvergen/launcher.rb, line 25
def node_version_file
  if config["node_module"]
    if File.exist? node_version_path
      Extensions::NodeModule::VersionFile.new(File.open(node_version_path, "r+"))
    else
      interface.fail_exit "A npm style version file should be found at #{node_version_path}"
    end
  end
end
node_version_path() click to toggle source
# File lib/semvergen/launcher.rb, line 51
def node_version_path
  File.join("package.json")
end
notifier() click to toggle source
# File lib/semvergen/launcher.rb, line 97
def notifier
  if config["slack"]
    require 'semvergen/slack_notifier'
    SlackNotifier.new config["slack"]
  else
    require 'semvergen/null_notifier'
    NullNotifier.new
  end
end
shell() click to toggle source
# File lib/semvergen/launcher.rb, line 39
def shell
  Shell.new
end
version_file() click to toggle source
# File lib/semvergen/launcher.rb, line 15
def version_file
  if File.exist? version_path
    VersionFile.new(File.open(version_path, "r+"))
  elsif File.exist? nested_version_path
    VersionFile.new(File.open(nested_version_path, "r+"))
  else
    interface.fail_exit "A bundler style version file should be found at #{version_path}"
  end
end
version_path() click to toggle source
# File lib/semvergen/launcher.rb, line 43
def version_path
  File.join("lib", gem_name, "version.rb")
end