Module: RocketApi::Library::GemRepoPlainText

Included in:
RocketCommands
Defined in:
lib/rocket_api/library/gem_repo_plain_text.rb

Instance Method Summary collapse

Instance Method Details

#gemfile_textString

Returns text.

Returns:

  • (String)

    text



61
62
63
64
65
# File 'lib/rocket_api/library/gem_repo_plain_text.rb', line 61

def gemfile_text
  ["source 'https://rubygems.org/'",
   "ruby 'RUBY_VERSION'",
   "gemspec"].join("\n")
end

#gitignore_textObject



4
5
6
# File 'lib/rocket_api/library/gem_repo_plain_text.rb', line 4

def gitignore_text
  ".idea/\nGemfile.lock\n*.gem".freeze
end

#plain_gem_test_version_text(name, module_name) ⇒ String

Returns text.

Parameters:

  • name (String)
  • module_name (String)

Returns:

  • (String)

    text



49
50
51
52
53
54
55
56
57
58
# File 'lib/rocket_api/library/gem_repo_plain_text.rb', line 49

def plain_gem_test_version_text(name, module_name)
  ["require 'minitest/autorun'",
   "require '#{name}/version'\n",
   "class TestVersion < Minitest::Test",
   "\tinclude #{module_name}\n",
   "\tdef test_ping",
   "\t\tassert_equal(\"0.0.1\", #{module_name}::VERSION)",
   "\tend",
   "end"].join("\n")
end

#plain_gemspec_text(name, module_name) ⇒ String

Returns text.

Parameters:

  • name (String)
  • module_name (String)

Returns:

  • (String)

    text



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/rocket_api/library/gem_repo_plain_text.rb', line 19

def plain_gemspec_text(name, module_name)
  ["lib = File.expand_path(\"lib\", __dir__)",
   "$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\n",
   "require 'English'",
   "require '#{name}/version'\n",
   "Gem::Specification.new do |s|",
   "\ts.specification_version = 2 if s.respond_to? :specification_version=",
   "\tif s.respond_to? :required_rubygems_version=",
   "\t\ts.required_rubygems_version = Gem::Requirement.new('>= 0')",
   "\tend",
   "\ts.rubygems_version = 'RUBY_VERSION'",
   "\ts.required_ruby_version = 'RUBY_VERSION'",
   "\ts.name = '#{name}'",
   "\ts.version = #{module_name}::VERSION",
   "\ts.executables << '#{name}'",
   "\ts.summary = 'PUT_SUMMARY'",
   "\ts.description = 'PUT_DESCRIPTION'",
   "\ts.authors = ['AUTHOR']",
   "\ts.email = 'AUTHOR_MAIL'",
   "\ts.homepage = 'https://github.com/...'",
   "\ts.files = `git ls-files`.split($RS)",
   "\ts.add_dependency \"rubocop\"",
   "\ts.add_dependency \"rubocop-rake\"",
   "end"].join("\n")
end

#plain_rubocop_yml_text(name) ⇒ String

Returns text.

Parameters:

  • name (String)

Returns:

  • (String)

    text



70
71
72
73
74
75
76
77
78
# File 'lib/rocket_api/library/gem_repo_plain_text.rb', line 70

def plain_rubocop_yml_text(name)
  ["AllCops:",
   "\tExclude:",
   "\t\t- Gemfile",
   "\t\t- test/*",
   "\t\t- Rakefile",
   "\t\t- #{name}.gemspec",
   "\t\t- bin/*"].join("\n")
end

#plain_version_text(module_name) ⇒ String

Returns text.

Parameters:

  • module_name (String)

Returns:

  • (String)

    text



11
12
13
# File 'lib/rocket_api/library/gem_repo_plain_text.rb', line 11

def plain_version_text(module_name)
  "module #{module_name}\n\tVERSION = \"0.0.1\".freeze\nend"
end