Module: FIR
- Includes:
- Util
- Defined in:
- lib/fir.rb,
lib/fir/cli.rb,
lib/fir/util.rb,
lib/fir/version.rb,
lib/fir/util/info.rb,
lib/fir/util/build.rb,
lib/fir/util/login.rb,
lib/fir/util/publish.rb
Defined Under Namespace
Modules: Build, Info, Login, Publish, Util
Classes: CLI
Constant Summary
collapse
- CONFIG_PATH =
"#{ENV['HOME']}/.fir-cli"
- API_YML_PATH =
"#{File.dirname(__FILE__)}/fir/api.yml"
- APP_FILE_TYPE =
%w(.ipa .apk).freeze
- VERSION =
"1.1.1"
Class Attribute Summary collapse
Class Method Summary
collapse
Methods included from Util
included
Class Attribute Details
Returns the value of attribute api.
33
34
35
|
# File 'lib/fir.rb', line 33
def api
@api
end
|
Returns the value of attribute config.
33
34
35
|
# File 'lib/fir.rb', line 33
def config
@config
end
|
Returns the value of attribute logger.
33
34
35
|
# File 'lib/fir.rb', line 33
def logger
@logger
end
|
Class Method Details
.current_token ⇒ Object
51
52
53
|
# File 'lib/fir.rb', line 51
def current_token
@token ||= config[:token] if config
end
|
99
100
101
|
# File 'lib/fir.rb', line 99
def
{ content_type: :json, source: 'fir-cli', cli_version: FIR::VERSION }
end
|
.get(url, params = {}) ⇒ Object
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/fir.rb', line 55
def get url, params = {}
begin
res = RestClient.get(url, .merge(params: params))
rescue => e
logger.error "#{e.class}\n#{e.message}"
exit 1
end
JSON.parse(res.body.force_encoding("UTF-8"), symbolize_names: true)
end
|
.patch(url, query) ⇒ Object
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/fir.rb', line 77
def patch url, query
begin
res = RestClient.patch(url, query, )
rescue => e
logger.error "#{e.class}\n#{e.message}"
exit 1
end
JSON.parse(res.body.force_encoding("UTF-8"), symbolize_names: true)
end
|
.post(url, query) ⇒ Object
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/fir.rb', line 66
def post url, query
begin
res = RestClient.post(url, query, )
rescue => e
logger.error "#{e.class}\n#{e.message}"
exit 1
end
JSON.parse(res.body.force_encoding("UTF-8"), symbolize_names: true)
end
|
.put(url, query) ⇒ Object
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/fir.rb', line 88
def put url, query
begin
res = RestClient.put(url, query, )
rescue => e
logger.error "#{e.class}\n#{e.message}"
exit 1
end
JSON.parse(res.body.force_encoding("UTF-8"), symbolize_names: true)
end
|
.reload_config ⇒ Object
43
44
45
|
# File 'lib/fir.rb', line 43
def reload_config
@config = YAML.load_file(CONFIG_PATH).symbolize_keys
end
|
.write_config(hash) ⇒ Object
47
48
49
|
# File 'lib/fir.rb', line 47
def write_config hash
File.open(CONFIG_PATH, 'w+') { |f| f << YAML.dump(hash) }
end
|