lib/lita/cli.rb in lita-4.2.1 vs lib/lita/cli.rb in lita-4.3.0
- old
+ new
@@ -88,30 +88,33 @@
desc "adapter NAME", "Generates a new Lita adapter"
# Generates a new Lita adapter.
# @param name [String] The name for the new adapter.
# @return [void]
def adapter(name)
- generate_templates(generate_config(name, "adapter"))
- license_message
+ config = generate_config(name, "adapter")
+ generate_templates(config)
+ post_messages(config)
end
desc "handler NAME", "Generates a new Lita handler"
# Generates a new Lita handler.
# @param name [String] The name for the new handler.
# @return [void]
def handler(name)
- generate_templates(generate_config(name, "handler"))
- license_message
+ config = generate_config(name, "handler")
+ generate_templates(config)
+ post_messages(config)
end
desc "extension NAME", "Generates a new Lita extension"
# Generates a new Lita extension.
# @param name [String] The name for the new extension.
# @return [void]
def extension(name)
- generate_templates(generate_config(name, "extension"))
- license_message
+ config = generate_config(name, "extension")
+ generate_templates(config)
+ post_messages(config)
end
desc "version", "Outputs the current version of Lita"
# Outputs the current version of Lita.
# @return [void]
@@ -120,10 +123,14 @@
end
map %w(-v --version) => :version
private
+ def badges_message
+ say I18n.t("lita.cli.badges_reminder"), :yellow
+ end
+
def generate_config(name, plugin_type)
name, gem_name = normalize_names(name)
constant_name = name.split(/_/).map(&:capitalize).join
namespace = "#{plugin_type}s"
constant_namespace = namespace.capitalize
@@ -196,12 +203,26 @@
name = name.tr("-", "_")
[name, gem_name]
end
def optional_content
+ travis = yes?(I18n.t("lita.cli.travis_question"))
+ coveralls = yes?(I18n.t("lita.cli.coveralls_question"))
+ if travis || coveralls
+ say I18n.t("lita.cli.badges_message")
+ badges = yes?(I18n.t("lita.cli.badges_question"))
+ github_user = ask(I18n.t("lita.cli.github_user_question")) if badges
+ end
{
- travis: yes?(I18n.t("lita.cli.travis_question")),
- coveralls: yes?(I18n.t("lita.cli.coveralls_question"))
+ travis: travis,
+ coveralls: coveralls,
+ badges: badges,
+ github_user: github_user
}
+ end
+
+ def post_messages(config)
+ license_message
+ badges_message if config[:badges]
end
end
end