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



58
59
60
61
62
# File 'lib/rocket_api/library/gem_repo_plain_text.rb', line 58

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



46
47
48
49
50
51
52
53
54
55
# File 'lib/rocket_api/library/gem_repo_plain_text.rb', line 46

def plain_gem_test_version_text(name, module_name)
  ["require 'minitest/autorun'",
   "require '#{name}/version'\n",
   "class TestVersion < Minitest::Test",
   "#{TAB}include #{module_name}\n",
   "#{TAB}def test_ping",
   "#{DOUBLE_TAB}assert_equal(\"0.0.1\", #{module_name}::VERSION)",
   "#{TAB}end",
   "end"].join("\n")
end

#plain_gemspec_text(name, module_name) ⇒ String

Returns text.

Parameters:

  • name (String)
  • module_name (String)

Returns:

  • (String)

    text



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

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|",
   "#{TAB}s.specification_version = 2 if s.respond_to? :specification_version=",
   "#{TAB}if s.respond_to? :required_rubygems_version=",
   "#{DOUBLE_TAB}s.required_rubygems_version = Gem::Requirement.new('>= 0')",
   "#{TAB}end",
   "#{TAB}s.rubygems_version = 'RUBY_VERSION'",
   "#{TAB}s.required_ruby_version = 'RUBY_VERSION'",
   "#{TAB}s.name = '#{name}'",
   "#{TAB}s.version = #{module_name}::VERSION",
   "#{TAB}s.executables << '#{name}'",
   "#{TAB}s.summary = 'PUT_SUMMARY'",
   "#{TAB}s.description = 'PUT_DESCRIPTION'",
   "#{TAB}s.authors = ['AUTHOR']",
   "#{TAB}s.email = 'AUTHOR_MAIL'",
   "#{TAB}s.homepage = 'https://github.com/...'",
   "#{TAB}s.files = `git ls-files`.split($RS)",
   "#{TAB}s.add_dependency \"rubocop\"",
   "#{TAB}s.add_dependency \"rubocop-rake\"",
   "end"].join("\n")
end

#plain_rubocop_yml_text(name) ⇒ String

Returns text.

Parameters:

  • name (String)

Returns:

  • (String)

    text



66
67
68
69
70
71
72
73
74
# File 'lib/rocket_api/library/gem_repo_plain_text.rb', line 66

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

#plain_version_text(module_name) ⇒ String

Returns text.

Parameters:

  • module_name (String)

Returns:

  • (String)

    text



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

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