Class: Gutsy::Generator::GemState

Inherits:
Object
  • Object
show all
Defined in:
lib/gutsy/generator/gem_state.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_config) ⇒ GemState

Returns a new instance of GemState.



6
7
8
9
10
11
# File 'lib/gutsy/generator/gem_state.rb', line 6

def initialize(app_config)
  @app_name = app_config[:name]
  @base_url = app_config[:base_url]
  @description = app_config[:description]
  @app_config = app_config
end

Instance Attribute Details

#app_nameObject (readonly)

Returns the value of attribute app_name.



4
5
6
# File 'lib/gutsy/generator/gem_state.rb', line 4

def app_name
  @app_name
end

#base_urlObject (readonly)

Returns the value of attribute base_url.



4
5
6
# File 'lib/gutsy/generator/gem_state.rb', line 4

def base_url
  @base_url
end

#descriptionObject (readonly)

Returns the value of attribute description.



4
5
6
# File 'lib/gutsy/generator/gem_state.rb', line 4

def description
  @description
end

Instance Method Details

#api_versionsObject



13
14
15
16
17
# File 'lib/gutsy/generator/gem_state.rb', line 13

def api_versions
  @api_versions ||= app_config[:versions].map do |api_version_config|
    Gutsy::Generator::ApiVersionState.new(api_version_config, self)
  end
end

#authorObject



47
48
49
# File 'lib/gutsy/generator/gem_state.rb', line 47

def author
  @author ||= OpenStruct.new(author_config)
end


43
44
45
# File 'lib/gutsy/generator/gem_state.rb', line 43

def copyright_owner
  @copyright_owner ||= author.name
end


39
40
41
# File 'lib/gutsy/generator/gem_state.rb', line 39

def copyright_year
  @copyright_year ||= Time.now.year
end

#gem_nameObject



19
20
21
# File 'lib/gutsy/generator/gem_state.rb', line 19

def gem_name
  @gem_name_snake ||= "#{app_name.underscore}_client"
end

#gem_name_pascalObject



27
28
29
# File 'lib/gutsy/generator/gem_state.rb', line 27

def gem_name_pascal
  @gem_name_pascal ||= gem_name.camelize(:upper)
end

#gem_name_snakeObject



23
24
25
# File 'lib/gutsy/generator/gem_state.rb', line 23

def gem_name_snake
  gem_name
end

#gem_versionObject



31
32
33
# File 'lib/gutsy/generator/gem_state.rb', line 31

def gem_version
  @gem_version ||= app_config[:gem_version] || '0.1.0'
end

#repo_nameObject



35
36
37
# File 'lib/gutsy/generator/gem_state.rb', line 35

def repo_name
  app_config[:repo_name] || gem_name_snake
end

#twineObject



51
52
53
# File 'lib/gutsy/generator/gem_state.rb', line 51

def twine
  binding
end