Class: Jax::Plugin::Credentials

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/jax/base/plugin_credentials.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Credentials

Returns a new instance of Credentials.



11
12
13
14
# File 'lib/generators/jax/base/plugin_credentials.rb', line 11

def initialize(options = {})
  @shell = options[:shell] || Thor::Shell::Basic.new
  @home = home_path(options)
end

Instance Attribute Details

#homeObject (readonly)

Returns the value of attribute home.



5
6
7
# File 'lib/generators/jax/base/plugin_credentials.rb', line 5

def home
  @home
end

#shellObject (readonly)

Returns the value of attribute shell.



5
6
7
# File 'lib/generators/jax/base/plugin_credentials.rb', line 5

def shell
  @shell
end

Instance Method Details

#api_keyObject



7
8
9
# File 'lib/generators/jax/base/plugin_credentials.rb', line 7

def api_key
  @api_key ||= find_api_key
end

#authorsObject



28
29
30
# File 'lib/generators/jax/base/plugin_credentials.rb', line 28

def authors
  @authors ||= RestClient::Resource.new(File.join(Jax.config.plugin_repository_url, "authors"), :accept => :xml)
end

#config_fileObject



16
17
18
# File 'lib/generators/jax/base/plugin_credentials.rb', line 16

def config_file
  File.join(home, ".jax")
end

#home_path(options = {}) ⇒ Object



20
21
22
# File 'lib/generators/jax/base/plugin_credentials.rb', line 20

def home_path(options = {})
  File.expand_path(options[:home] || Thor::Util.user_home)
end

#pluginsObject



24
25
26
# File 'lib/generators/jax/base/plugin_credentials.rb', line 24

def plugins
  @plugins ||= RestClient::Resource.new(File.join(Jax.config.plugin_repository_url, "plugins"), :accept => :xml)
end

#profileObject



32
33
34
# File 'lib/generators/jax/base/plugin_credentials.rb', line 32

def profile
  @profile ||= RestClient::Resource.new(File.join(Jax.config.plugin_repository_url, "profile"), :accept => :xml)
end