Class: RSGem::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/rsgem/context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options:) ⇒ Context

Returns a new instance of Context.



7
8
9
10
11
# File 'lib/rsgem/context.rb', line 7

def initialize(options:)
  @options = options

  raise Errors::MissingGemName unless options[:gem_name]
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/rsgem/context.rb', line 5

def options
  @options
end

Instance Method Details

#bundler_optionsObject



13
14
15
# File 'lib/rsgem/context.rb', line 13

def bundler_options
  @bundler_options ||= options[:bundler_options]
end

#ci_providerObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rsgem/context.rb', line 17

def ci_provider
  @ci_provider ||= begin
    if (name = options[:ci_provider])
      RSGem::Constants::CI_PROVIDERS.detect do |provider|
        provider.name == name
      end
    else
      RSGem::Constants::DEFAULT_CI_PROVIDER
    end
  end
end

#folder_pathObject



45
46
47
# File 'lib/rsgem/context.rb', line 45

def folder_path
  `pwd`.sub("\n", '/') + gem_name
end

#gem_nameObject



33
34
35
# File 'lib/rsgem/context.rb', line 33

def gem_name
  @gem_name ||= options[:gem_name]
end

#gemfile_pathObject



29
30
31
# File 'lib/rsgem/context.rb', line 29

def gemfile_path
  "#{folder_path}/Gemfile"
end

#gemspec_pathObject



37
38
39
# File 'lib/rsgem/context.rb', line 37

def gemspec_path
  "#{folder_path}/#{gem_name}.gemspec"
end

#gitignore_pathObject



49
50
51
# File 'lib/rsgem/context.rb', line 49

def gitignore_path
  "#{folder_path}/.gitignore"
end

#license_pathObject



41
42
43
# File 'lib/rsgem/context.rb', line 41

def license_path
  "#{folder_path}/LICENSE.txt"
end

#rakefile_pathObject



53
54
55
# File 'lib/rsgem/context.rb', line 53

def rakefile_path
  "#{folder_path}/Rakefile"
end

#spec_helper_pathObject



57
58
59
# File 'lib/rsgem/context.rb', line 57

def spec_helper_path
  "#{folder_path}/spec/spec_helper.rb"
end