priam 0.1.1 → 0.1.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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.2
@@ -8,6 +8,7 @@ module Priam::Command
8
8
  column_family = params[:column_family]
9
9
  super_column = params[:super_column]
10
10
  name = params[:value_column]
11
+ with_key_flag = params[:with_key_flag]
11
12
 
12
13
  client = Cassandra.new(keyspace, "#{host}:#{port}")
13
14
 
@@ -26,6 +27,10 @@ module Priam::Command
26
27
  end
27
28
 
28
29
  record = Priam.get_column(client, column_family, super_column, key, params)
30
+
31
+ if with_key_flag
32
+ output_stream.print "#{key}\t"
33
+ end
29
34
 
30
35
  if name then
31
36
  output_stream.puts "#{record[name]}"
@@ -16,6 +16,7 @@ module Priam::Core
16
16
 
17
17
  json_flag = false
18
18
  verbose_flag = false
19
+ with_key_flag = false
19
20
 
20
21
  next_argv = []
21
22
 
@@ -56,6 +57,8 @@ module Priam::Core
56
57
  json_flag = true
57
58
  when '--verbose'
58
59
  verbose_flag = true
60
+ when '--with-key'
61
+ with_key_flag = true
59
62
  else
60
63
  next_argv.push val
61
64
  end
@@ -85,7 +88,8 @@ module Priam::Core
85
88
  :output_keys_flag=>output_keys_flag,
86
89
  :replication_factor=>replication_factor,
87
90
  :json_flag=>json_flag,
88
- :verbose_flag=>verbose_flag
91
+ :verbose_flag=>verbose_flag,
92
+ :with_key_flag=>with_key_flag
89
93
  }
90
94
  end
91
95
  end
data/priam.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "priam"
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kenji Hara"]
12
- s.date = "2013-01-01"
12
+ s.date = "2013-02-25"
13
13
  s.description = "Command-base client for Cassandra."
14
14
  s.email = "haracane@gmail.com"
15
15
  s.executables = ["priam"]
@@ -92,11 +92,22 @@ describe "bin/priam" do
92
92
 
93
93
  context "when command = get" do
94
94
  context "without value-column option" do
95
- context "when key&value exists" do
96
- it "should output json" do
97
- result = `echo key1 | #{Priam::RUBY_CMD} -I #{Priam::LIB_DIR} #{Priam::BIN_DIR}/priam get --keyspace PriamTest --column-family PriamCF -h #{@hostname} -p 9160 --verbose #{@stderr_dst}`
98
- result.chomp!
99
- result.should == '{"d":"val1"}'
95
+ context "with with-key option" do
96
+ context "when key&value exists" do
97
+ it "should output json" do
98
+ result = `echo key1 | #{Priam::RUBY_CMD} -I #{Priam::LIB_DIR} #{Priam::BIN_DIR}/priam get --keyspace PriamTest --column-family PriamCF -h #{@hostname} -p 9160 --verbose #{@stderr_dst}`
99
+ result.chomp!
100
+ result.should == '{"d":"val1"}'
101
+ end
102
+ end
103
+ end
104
+ context "without with-key option" do
105
+ context "when key&value exists" do
106
+ it "should output json" do
107
+ result = `echo key1 | #{Priam::RUBY_CMD} -I #{Priam::LIB_DIR} #{Priam::BIN_DIR}/priam get --keyspace PriamTest --column-family PriamCF -h #{@hostname} -p 9160 --with-key --verbose #{@stderr_dst}`
108
+ result.chomp!
109
+ result.should == ["key1", '{"d":"val1"}'].join("\t")
110
+ end
100
111
  end
101
112
  end
102
113
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: priam
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kenji Hara
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-01-01 00:00:00 Z
18
+ date: 2013-02-25 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  prerelease: false