jsontodb 2.0.0 → 2.1.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: a85df10c0761ac2587b7fd32c186ea145e474a97
4
- data.tar.gz: 53df02340f70f52609c36562215584239ce38543
3
+ metadata.gz: fd549529c298d30d2576356007ff30ce0458b27f
4
+ data.tar.gz: bd950cd4f5e84244b8c4199377da7a1afa6fff66
5
5
  SHA512:
6
- metadata.gz: 2de1b5fc9fa5b1b126a2c6c0c418275e1bede4ff60ae4a8c14dc45dba1f4249df04cd4e9b2889ad94da7e2b2b22817736566079ef8912c8a2ff0eeba9c0c56ba
7
- data.tar.gz: 5e074e81c5e7c8895bd84bb41365c773f7e8718c43836459f099ad6e12ade4c888c98a75bc91a36aca99aec888e95a74b29bee21ff963f1003d647591b53f27b
6
+ metadata.gz: 393f53bcbb668e4900ceebfe2edce46ecf02b12f8536192201d1907a9c1ef250676aa3317e8ef0acd9060e5d6570bfba05daa76d6fe68f400681522152f6af44
7
+ data.tar.gz: 1dbbe059e559573e038707fad60fd5a2c52781307fb6b8eb1d59a197dcec0af66bf71210651e194fca99401980210fc8d2fa272bd2201c5d3e1de478a4b8e74f
data/README.md CHANGED
@@ -16,57 +16,7 @@ gem 'jsontodb'
16
16
  ```
17
17
 
18
18
  ## Usage
19
- **JSONtoDB** provides a command-line interface, which can be invoked using:
20
- ```sh
21
- $ jsontodb
22
- ```
23
- This command will open an interactive shell for **JSONtoDB** after prompting for authentication credentials (see [Authentication](#authentication)).
24
-
25
- You can also pass your authentication credentials to the command then open an interactive shell:
26
- ```sh
27
- $ jsontodb [username] [password]
28
- ```
29
-
30
- Running a full **JSONtoDB** command is possible directly from the command-line as well:
31
- ```sh
32
- $ jsontodb [username] [password] [command]
33
- ```
34
-
35
- Functionality is planned for placing credentials in a file to avoid passwords being visible, as they are when passed to the `jsontodb` command (though
36
- they are hidden in the interactive shell).
37
-
38
- ## Commands
39
- Four commands are provided by default, and they represent their respective HTTP method:
40
-
41
- ### Get
42
- Get represents the GET HTTP method, and its only parameter is the URL to GET:
43
- ```sh
44
- $ [parent command] get [url]
45
- ```
46
-
47
- ### Delete
48
- Delete represents the DELETE HTTP method, and its only parameter is the URL to DELETE:
49
- ```sh
50
- $ [parent command] delete [url]
51
- ```
52
-
53
- ### Put
54
- Put represents the PUT HTTP method. Its first parameter is the URL to PUT to, and its second parameter is the source of the data (a file path, see [Source Files](#source-files)):
55
- ```sh
56
- $ [parent command] put [url] [source file]
57
- ```
58
-
59
- ### Post
60
- Post represents the POST HTTP method. Its first parameter is the URL to POST to, and its second parameter is the source of the data (a file path, see [Source Files](#source-files)):
61
- ```sh
62
- $ [parent command] post [url] [source file]
63
- ```
64
-
65
- ## Source Files
66
- The only source data type (or content type) that **JSONtoDB** currently supports is [JSON](http://www.json.org/), hence the name **JSONtoDB**.
67
-
68
- ## Authentication
69
- **JSONtoDB** offers [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) functionality only at this time. If you are using the interactive shell mode, it will prompt for credentials. Otherwise, you can pass them in as the first two parameters to the `jsontodb` command.
19
+ *Coming soon!*
70
20
 
71
21
  ## Copyright
72
22
  Copyright (c) 2016 Christopher Lutz. See [LICENSE.txt](LICENSE.txt) for details.
@@ -6,7 +6,7 @@ module JSONtoDB
6
6
  module CLI
7
7
  module_function
8
8
 
9
- attr_reader :user, :pass
9
+ attr_accessor :user, :pass
10
10
 
11
11
  def authentication_credentials(user = nil, pass = nil)
12
12
  if user.nil? || pass.nil?
@@ -25,6 +25,14 @@ module JSONtoDB
25
25
  end
26
26
  end
27
27
 
28
+ def user
29
+ @user
30
+ end
31
+
32
+ def pass
33
+ @pass
34
+ end
35
+
28
36
  def continuous_cli
29
37
  print 'jsontodb> '
30
38
  input = STDIN.gets.chomp
@@ -22,7 +22,8 @@ module JSONtoDB
22
22
  end
23
23
  end
24
24
  else
25
- Dir[files].each do |f|
25
+ entries = Dir[files].entries.sort_by { |x| -x[/\d+/].to_i }
26
+ entries.each do |f|
26
27
  run_command([command, url, f], @user, @pass)
27
28
  end
28
29
  end
@@ -30,8 +30,8 @@ module JSONtoDB
30
30
  def data_request(klass, url, src, user, pass)
31
31
  if File.directory?(src)
32
32
 
33
- Dir["#{src}/*.json"].each do |_file|
34
- file_request(klass, url, src, user, pass)
33
+ Dir["#{src}/*.json"].each do |file|
34
+ file_request(klass, url, file, user, pass)
35
35
  end
36
36
 
37
37
  elsif File.file?(src)
@@ -1,3 +1,3 @@
1
1
  module JSONtoDB
2
- VERSION = '2.0.0'.freeze
2
+ VERSION = '2.1.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsontodb
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Lutz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-15 00:00:00.000000000 Z
11
+ date: 2016-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cogwheels
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.1'
19
+ version: '0.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.1'
26
+ version: '0.2'
27
27
  description:
28
28
  email:
29
29
  - lutzblox@gmail.com