faraday-cli 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05529b7985588b2a66295f2a98ef00c1d73715e0
4
- data.tar.gz: 830ed39a7103a5b1c15c706a4e35213946f99f33
3
+ metadata.gz: ff8b3ada58c0a686d4123214c8c27ec40ea78ce8
4
+ data.tar.gz: 02e13f6610c13c941e239b7c8f627d7ddcff91f1
5
5
  SHA512:
6
- metadata.gz: 0f36c52ae2b8d68eda145fab01e46d5bef2395e403daafe8cc9c520b9a0c56366ab42bba0ea5d67f538d4a671d80b8bf7c6889930dbb92ff8b848c826a271c7b
7
- data.tar.gz: e8197d7a109a9865e1766d7520d800af4322efda5baffffb325e999ed65c5005355b9a22ffae64d43900c95248e52fcdc14ba987ce95a7df0dfd5959a0bab546
6
+ metadata.gz: d75198e583c7488fde5ef306be1d5b36a10d403212d0549faf2840b5eac61c2fbc11d546df20197b8be9de6012d66aea2b698ee055e3d8166be4dd2679e6ed2f
7
+ data.tar.gz: eeb91ac2b0b6b8f4c306b60b1fa4913977df7b9a745e8dd22a623d28131b023ed0f76b9a7cca1d08d66be11acc7e0a8ebb28c4b563380cc354cdba6149599edb
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.5.0
data/bin/faraday-cli CHANGED
@@ -71,7 +71,7 @@ OptionParser.new do |o|
71
71
  o.on('-s', '--silent', "Silent mode (don't output anything)") { CLI_OPTIONS[:flags] << :silent }
72
72
 
73
73
  CLI_OPTIONS[:config_file_paths]= []
74
- o.on('-c', '--config FILE_PATH', 'File path to the .faraday.rb if you want use other than default') do |file_path|
74
+ o.on('-K', '--config FILE_PATH', 'File path to the .faraday.rb if you want use other than default') do |file_path|
75
75
  CLI_OPTIONS[:config_file_paths] << File.absolute_path(file_path)
76
76
  end
77
77
 
@@ -79,6 +79,12 @@ OptionParser.new do |o|
79
79
  CLI_OPTIONS[:flags] << :show_middlewares
80
80
  end
81
81
 
82
+ o.on('-W','--without_middlewares','Make request without consuming middleware file(s)') do
83
+ CLI_OPTIONS[:flags] << :without_middlewares
84
+ end
85
+
86
+ # Z
87
+
82
88
  o.parse!
83
89
 
84
90
  end
@@ -87,7 +93,10 @@ ALLOWED_HTTP_METHODS = %w(get head post put patch delete options)
87
93
  raise('invalid http method given') unless ALLOWED_HTTP_METHODS.include?(CLI_OPTIONS[:http_method])
88
94
 
89
95
  connection = Faraday.new do |builder|
90
- Faraday::CLI::MiddlewareFetcher.extend!(builder, *CLI_OPTIONS[:config_file_paths])
96
+
97
+ unless CLI_OPTIONS[:flags].include?(:without_middlewares)
98
+ Faraday::CLI::MiddlewareFetcher.extend!(builder, *CLI_OPTIONS[:config_file_paths])
99
+ end
91
100
 
92
101
  builder.request(:multipart) if CLI_OPTIONS[:flags].include?(:multipart)
93
102
  builder.response :logger if !CLI_OPTIONS[:flags].include?(:silent) && CLI_OPTIONS[:flags].include?(:verbose)
@@ -101,9 +110,9 @@ if CLI_OPTIONS[:flags].include?(:show_middlewares)
101
110
  exit
102
111
  end
103
112
 
104
-
105
113
  response = connection.public_send(CLI_OPTIONS[:http_method].downcase) do |request|
106
114
 
115
+ raise('Missing URL for request!') if ARGV[0].nil?
107
116
  request.url(ARGV[0])
108
117
 
109
118
  CLI_OPTIONS[:http_headers].each do |key, value|
@@ -19,6 +19,10 @@ module Faraday::CLI::MiddlewareFetcher
19
19
 
20
20
  when !config_file_paths.empty?
21
21
  config_file_paths.reduce([]) do |file_paths, given_path|
22
+ if File.directory?(given_path)
23
+ given_path = File.join(given_path,'*.rb')
24
+ end
25
+
22
26
  file_paths.push(*Dir.glob(given_path)); file_paths
23
27
  end
24
28
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Luzsi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-21 00:00:00.000000000 Z
11
+ date: 2015-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler