Class: RVGP::Gem

Inherits:
Object
  • Object
show all
Defined in:
lib/rvgp/gem.rb

Overview

This class contains information relating to our Gem configuration, and is used to produce a gemspec.

Constant Summary collapse

VERSION =
'0.3.2'

Class Method Summary collapse

Class Method Details

.filesArray<String>

This is a git-less alternative to : ‘git ls-files`.split “n”

Returns:

  • (Array<String>)

    the paths of all rvgp development files in this gem.

Raises:

  • (StandardError)


56
57
58
59
60
61
62
63
64
# File 'lib/rvgp/gem.rb', line 56

def files
  output, exit_code = Open3.capture2(format("find %s -type f -printf '%%P\n'", root))
  raise StandardError, 'find command failed' unless exit_code.success?

  output.split("\n").reject do |file|
    ignores = ['.git/*'] + File.read(format('%s/.gitignore', GEM_DIR)).split("\n")
    ignores.any? { |glob| File.fnmatch glob, file }
  end
end

.root(sub_path = nil) ⇒ String

The directory path to the rvgp gem, as calculated from the location of this gem.rb file.

Parameters:

  • sub_path (String) (defaults to: nil)

    If provided, append this path to the output

Returns:

  • (String)

    The full path to the gem root, plus any subpathing, if appropriate



75
76
77
# File 'lib/rvgp/gem.rb', line 75

def root(sub_path = nil)
  sub_path ? [GEM_DIR, sub_path].join('/') : GEM_DIR
end

.ruby_filesArray<String>

Return all ruby (code) files in this project.

Returns:

  • (Array<String>)

    the paths of all ruby files in this gem.



68
69
70
# File 'lib/rvgp/gem.rb', line 68

def ruby_files
  files.select { |f| /\A(?:bin.*|Rakefile|.*\.rb)\Z/.match f }
end

.specificationGem::Specification

Returns the gem specification

Returns:

  • (Gem::Specification)


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
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/rvgp/gem.rb', line 17

def specification
  ::Gem::Specification.new do |s|
    s.name        = 'rvgp'
    s.version     = VERSION
    s.required_ruby_version = '>= 3.0.0'
    s.licenses    = ['LGPL-2.0']
    s.authors     = ['Chris DeRose']
    s.email       = 'chris@chrisderose.com'
    s.    = {
      'source_code_uri' => 'https://github.com/brighton36/rvgp',
      'documentation_uri' => ['https://www.rubydoc.info/gems/rvgp', VERSION].join('/')
    }

    s.doc_dir 'doc'

    s.summary = 'A workflow tool to: reconcile bank-downloaded csv\'s into ' \
                'categorized pta journals. Run finance validations on those ' \
                'journals. And generate csvs and plots on the output.'
    s.homepage = 'https://github.com/brighton36/rvgp'

    s.files = files

    s.executables = ['rvgp']

    s.add_development_dependency 'minitest', '~> 5.16.0'
    s.add_development_dependency 'yard', '~> 0.9.34'
    s.add_development_dependency 'redcarpet', '~> 3.6.0'

    s.add_dependency 'open3', '~> 0.1.1'
    s.add_dependency 'shellwords', '~> 0.1.0'
    s.add_dependency 'google-apis-sheets_v4', '~> 0.28.0'
    s.add_dependency 'faker', '~> 3.2.0'
    s.add_dependency 'finance', '~> 2.0.0'
    s.add_dependency 'tty-table', '~> 0.12.0'
  end
end