ddbcli 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 920be6266d63a91338388bb5c64ee492192bf4ea
4
- data.tar.gz: 294e678d52312af238381e8166e4fbe5dbdea1a3
3
+ metadata.gz: 9dc0c0d2ef3366f4919ba4d115c7658a581fdd1c
4
+ data.tar.gz: 13fd94d5136a425742048ad4df518029d3dfb47e
5
5
  SHA512:
6
- metadata.gz: 6a5a3d587336ca8ade3dd5dd41b5edd103bbb3d04784b113f003ef2a4fcf244fcbed1e3c29893cb6975fd42a697a70895ef88617394d4fd42829f1bbdfbd7ab0
7
- data.tar.gz: 9eb0c49ec7d16c1f7ed09564dae0b229cffad4984d0f2bee0575595b52d438967fe7a4b6d1ad309fcbe8d40510b7d3f6d202e196e332af441eae2e7d3f24b5b3
6
+ metadata.gz: 8e9bb7266ef5ef2d271cd6574f882d4d40bf033e4bf30fb511326504963cc9e594a3f42f066c1badbf3352d8da0a41f9d592f93fd36700b4a51ecb41d25f664a
7
+ data.tar.gz: 182ff427980863a1b493b30cc1576091129424b06ee6363080d1ccdde760f2bab85f7af4d10fa9ec82ff06fda1b95e45a7b2aee1786561170ec376d5e6cd76ed
data/README.md CHANGED
@@ -6,17 +6,17 @@ ddbcli is an interactive command-line client of Amazon DynamoDB.
6
6
 
7
7
  ## Installation
8
8
 
9
- Add this line to your application's Gemfile:
10
-
11
- gem 'ddbcli'
12
-
13
- And then execute:
9
+ $ gem install ddbcli
14
10
 
15
- $ bundle
11
+ If you are not using RubyGems, you can use the script files that depend on only Ruby.
16
12
 
17
- Or install it yourself as:
13
+ [ddbcli-0.3.2](https://bitbucket.org/winebarrel/ddbcli/downloads/ddbcli-0.3.2)
18
14
 
19
- $ gem install ddbcli
15
+ ```sh
16
+ wget https://bitbucket.org/winebarrel/ddbcli/downloads/ddbcli-0.3.2
17
+ sudo cp ddbcli-0.3.2 /usr/local/bin/ddbcli
18
+ sudo chmod 755 /usr/local/bin/ddbcli
19
+ ```
20
20
 
21
21
  ## Usage
22
22
 
@@ -41,7 +41,7 @@ ddbcli # show prompt
41
41
 
42
42
  ![ddbcli demo](https://bitbucket.org/winebarrel/ddbcli/downloads/ddbcli-demo.gif)
43
43
 
44
- ## Use GSI
44
+ ## Use Global Secondary Indexes
45
45
 
46
46
  * [https://gist.github.com/winebarrel/7938971](https://gist.github.com/winebarrel/7938971)
47
47
 
@@ -1,6 +1,7 @@
1
1
  require 'json'
2
2
  require 'openssl'
3
3
  require 'net/http'
4
+ require 'net/https'
4
5
  require 'time'
5
6
  require 'stringio'
6
7
  require 'zlib'
@@ -18,7 +18,8 @@ module DynamoDB
18
18
  if ENDPOINTS.key?(endpoint_or_region)
19
19
  [endpoint_or_region, ENDPOINTS[endpoint_or_region]]
20
20
  elsif ENDPOINTS.value?(endpoint_or_region)
21
- [ENDPOINTS.key(endpoint_or_region), endpoint_or_region]
21
+ ep_key = ENDPOINTS.respond_to?(:key) ? ENDPOINTS.key(endpoint_or_region) : ENDPOINTS.index(endpoint_or_region)
22
+ [ep_key, endpoint_or_region]
22
23
  else
23
24
  raise DynamoDB::Error, 'Unknown endpoint or region'
24
25
  end
@@ -1,5 +1,5 @@
1
1
  module DynamoDB
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
4
4
 
5
5
  Version = DynamoDB::VERSION
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fileutils'
4
+ require 'pathname'
5
+ require 'stringio'
6
+
7
+ ROOT_DIR = Pathname.new(__FILE__).join('..').expand_path
8
+ LIB_DIR = ROOT_DIR.join('lib')
9
+
10
+ require LIB_DIR.join('ddbcli/version')
11
+
12
+ DEST_FILE = "pkg/ddbcli-#{DynamoDB::VERSION}"
13
+
14
+ JSON_VERSION = '1.8.1'
15
+ JSON_ARCHIVE = ROOT_DIR.join("v#{JSON_VERSION}.tar.gz")
16
+ JSON_ROOT_DIR = ROOT_DIR.join("json-#{JSON_VERSION}")
17
+ JSON_LIB_DIR = JSON_ROOT_DIR.join('lib')
18
+
19
+ def use_json
20
+ system("wget -q https://github.com/flori/json/archive/#{JSON_ARCHIVE.basename}")
21
+ system("tar xf #{JSON_ARCHIVE}")
22
+
23
+ begin
24
+ yield
25
+ ensure
26
+ FileUtils.rm_rf([JSON_ROOT_DIR, JSON_ARCHIVE])
27
+ end
28
+ end
29
+
30
+ def recursive_print(file, prefix, lib_path, fout, buf = [])
31
+ return if buf.include?(file)
32
+
33
+ buf << file
34
+ path = lib_path.join(file)
35
+
36
+ path.read.split("\n").each do |line|
37
+ if line =~ %r|\A\s*require\s+['"](#{prefix}/.+)['"]\s*\Z|
38
+ recursive_print($1 + '.rb', prefix, lib_path, fout, buf)
39
+ else
40
+ fout.puts line
41
+ end
42
+ end
43
+ end
44
+
45
+ def read_bin_file
46
+ ROOT_DIR.join('bin/ddbcli').read.split("\n").select {|line|
47
+ [
48
+ /\A\s*#!/,
49
+ /\A\s*\$LOAD_PATH/,
50
+ /\A\s*require\s+['"]ddbcli\b/,
51
+ ].all? {|r| line !~ r }
52
+ }.join("\n")
53
+ end
54
+
55
+ json_buf = StringIO.new
56
+
57
+ use_json do
58
+ recursive_print('json/pure.rb', 'json', JSON_LIB_DIR, json_buf)
59
+ end
60
+
61
+ ddbcli_buf = StringIO.new
62
+ recursive_print('ddbcli.rb', 'ddbcli', LIB_DIR, ddbcli_buf)
63
+
64
+ ROOT_DIR.join(DEST_FILE).open('wb', 0755) do |f|
65
+ f.puts '#!/usr/bin/env ruby'
66
+ f.puts json_buf.string
67
+ f.puts ddbcli_buf.string.gsub(%r|require\s+['"]json['"]|m, '')
68
+ f.puts read_bin_file
69
+ end
70
+
71
+ puts "pack to #{DEST_FILE}."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ddbcli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
@@ -96,6 +96,7 @@ files:
96
96
  - lib/ddbcli/ddb-parser.y
97
97
  - lib/ddbcli/ddb-rubyext.rb
98
98
  - lib/ddbcli/version.rb
99
+ - pack_to_one_script.rb
99
100
  - spec/ddbcli_spec.rb
100
101
  - spec/delete_spec.rb
101
102
  - spec/insert_spec.rb