priam 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
data/bin/priam CHANGED
@@ -13,10 +13,12 @@ when "delete"
13
13
  exit_code = Priam::Command::Delete.run(ARGV) || 0
14
14
  when "get"
15
15
  exit_code = Priam::Command::Get.run(ARGV) || 0
16
- when "put"
17
- exit_code = Priam::Command::Put.run(ARGV) || 0
16
+ when "help"
17
+ exit_code = Priam::Command::Help.run(ARGV) || 0
18
18
  when "insert"
19
19
  exit_code = Priam::Command::Insert.run(ARGV) || 0
20
+ when "put"
21
+ exit_code = Priam::Command::Put.run(ARGV) || 0
20
22
  else
21
23
  STDERR.puts "Invalid command: '#{command}'"
22
24
  exit_code = 1
@@ -7,7 +7,7 @@ module Priam::Command
7
7
  keyspace = params[:keyspace]
8
8
  column_family = params[:column_family]
9
9
  super_column = params[:super_column]
10
- name = params[:name]
10
+ name = params[:value_column]
11
11
 
12
12
  client = Cassandra.new(keyspace, "#{host}:#{port}")
13
13
 
@@ -0,0 +1,25 @@
1
+ module Priam::Command
2
+ module Help
3
+ def self.run(argv, input_stream=$stdin, output_stream=$stdout)
4
+ output_stream.puts <<-EOF
5
+ usage: priam COMMAND [-h HOST] [-p PORT]
6
+ [--keyspace KEYSPACE] [--column-family COLUMN_FAMILY]
7
+ [--super-column SUPER_COLUMN] [--value-column COLUMN_NAME]
8
+ [--retry COUNT] [--weight MSEC]
9
+ [--raise-exception] [--unit-size COUNT] [--verbose]
10
+ -h HOST cassandra server address. default is localhost.
11
+ -p PORT port number. default is 9160.
12
+ --keyspace KEYSPACE keyspace.
13
+ --column-family COLUMN_FAMILY column-family.
14
+ --super-column SUPER_COLUMN super-column.
15
+ --value-column COLUMN_NAME column name for each column.
16
+ --retry COUNT max retry count for put/get.
17
+ --weight MSEC weight time for retry.
18
+ --raise-exception raise exception.
19
+ --unit-size COUNT unit size for log.
20
+ --verbose turn on verbose output, with all the available data.
21
+ EOF
22
+ return 0
23
+ end
24
+ end
25
+ end
data/lib/priam/command.rb CHANGED
@@ -4,6 +4,7 @@ end
4
4
  require "priam/command/cql"
5
5
  require "priam/command/delete"
6
6
  require "priam/command/get"
7
+ require "priam/command/help"
7
8
  require "priam/command/insert"
8
9
  require "priam/command/put"
9
10
 
@@ -71,10 +71,10 @@ module Priam::Core
71
71
  :keyspace=>keyspace,
72
72
  :column_family=>column_family,
73
73
  :super_column=>super_column,
74
- :name=>name,
74
+ :name=>name || value_column,
75
75
  :raise_exception_flag=>raise_exception_flag,
76
76
  :unit_size=>unit_size,
77
- :value_column=>value_column,
77
+ :value_column=>value_column || name,
78
78
  :weight_second=>weight_second,
79
79
  :retry_max_count=>retry_max_count,
80
80
  :count_log_path=>count_log_path,
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.0.3"
8
+ s.version = "0.0.4"
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 = "2012-12-12"
12
+ s.date = "2012-12-16"
13
13
  s.description = "Command-base client for Cassandra."
14
14
  s.email = "haracane@gmail.com"
15
15
  s.executables = ["priam"]
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
33
33
  "lib/priam/command/cql/create.rb",
34
34
  "lib/priam/command/delete.rb",
35
35
  "lib/priam/command/get.rb",
36
+ "lib/priam/command/help.rb",
36
37
  "lib/priam/command/insert.rb",
37
38
  "lib/priam/command/put.rb",
38
39
  "lib/priam/core.rb",
@@ -51,7 +52,7 @@ Gem::Specification.new do |s|
51
52
  s.homepage = "http://github.com/haracane/priam"
52
53
  s.licenses = ["MIT"]
53
54
  s.require_paths = ["lib"]
54
- s.rubygems_version = "1.8.21"
55
+ s.rubygems_version = "1.8.17"
55
56
  s.summary = "Command-base client for Cassandra."
56
57
 
57
58
  if s.respond_to? :specification_version then
@@ -34,6 +34,13 @@ describe "bin/priam" do
34
34
  end
35
35
  end
36
36
 
37
+ context "when command = help" do
38
+ it "should output help" do
39
+ result = `#{Priam::RUBY_CMD} -I #{Priam::LIB_DIR} #{Priam::BIN_DIR}/priam help`
40
+ result.length.should > 0
41
+ end
42
+ end
43
+
37
44
  context "when command = insert" do
38
45
  it "should insert values" do
39
46
  input = [
data/spec/spec_helper.rb CHANGED
@@ -45,7 +45,7 @@ create column family PriamCF
45
45
  tmpfile.puts cql
46
46
  tmpfile.close
47
47
  hostname = `hostname`.chomp
48
- `echo "#{cql}" /usr/lib/cassandra/bin/cassandra-cli -h #{hostname} -p 9160 -f #{tmpfile.path}`
48
+ `/usr/lib/cassandra/bin/cassandra-cli -h #{hostname} -p 9160 -f #{tmpfile.path}`
49
49
  tmpfile.unlink
50
50
  end
51
51
 
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: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kenji Hara
@@ -15,9 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-12-12 00:00:00 Z
18
+ date: 2012-12-16 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
+ name: thrift
22
+ prerelease: false
21
23
  type: :runtime
22
24
  requirement: &id001 !ruby/object:Gem::Requirement
23
25
  none: false
@@ -31,9 +33,9 @@ dependencies:
31
33
  - 0
32
34
  version: 0.7.0
33
35
  version_requirements: *id001
34
- name: thrift
35
- prerelease: false
36
36
  - !ruby/object:Gem::Dependency
37
+ name: thrift_client
38
+ prerelease: false
37
39
  type: :runtime
38
40
  requirement: &id002 !ruby/object:Gem::Requirement
39
41
  none: false
@@ -47,9 +49,9 @@ dependencies:
47
49
  - 1
48
50
  version: 0.7.1
49
51
  version_requirements: *id002
50
- name: thrift_client
51
- prerelease: false
52
52
  - !ruby/object:Gem::Dependency
53
+ name: simple_uuid
54
+ prerelease: false
53
55
  type: :runtime
54
56
  requirement: &id003 !ruby/object:Gem::Requirement
55
57
  none: false
@@ -63,9 +65,9 @@ dependencies:
63
65
  - 0
64
66
  version: 0.2.0
65
67
  version_requirements: *id003
66
- name: simple_uuid
67
- prerelease: false
68
68
  - !ruby/object:Gem::Dependency
69
+ name: cassandra
70
+ prerelease: false
69
71
  type: :runtime
70
72
  requirement: &id004 !ruby/object:Gem::Requirement
71
73
  none: false
@@ -79,9 +81,9 @@ dependencies:
79
81
  - 1
80
82
  version: 0.12.1
81
83
  version_requirements: *id004
82
- name: cassandra
83
- prerelease: false
84
84
  - !ruby/object:Gem::Dependency
85
+ name: rspec
86
+ prerelease: false
85
87
  type: :development
86
88
  requirement: &id005 !ruby/object:Gem::Requirement
87
89
  none: false
@@ -95,9 +97,9 @@ dependencies:
95
97
  - 0
96
98
  version: 2.8.0
97
99
  version_requirements: *id005
98
- name: rspec
99
- prerelease: false
100
100
  - !ruby/object:Gem::Dependency
101
+ name: rdoc
102
+ prerelease: false
101
103
  type: :development
102
104
  requirement: &id006 !ruby/object:Gem::Requirement
103
105
  none: false
@@ -110,9 +112,9 @@ dependencies:
110
112
  - 12
111
113
  version: "3.12"
112
114
  version_requirements: *id006
113
- name: rdoc
114
- prerelease: false
115
115
  - !ruby/object:Gem::Dependency
116
+ name: bundler
117
+ prerelease: false
116
118
  type: :development
117
119
  requirement: &id007 !ruby/object:Gem::Requirement
118
120
  none: false
@@ -126,9 +128,9 @@ dependencies:
126
128
  - 0
127
129
  version: 1.0.0
128
130
  version_requirements: *id007
129
- name: bundler
130
- prerelease: false
131
131
  - !ruby/object:Gem::Dependency
132
+ name: jeweler
133
+ prerelease: false
132
134
  type: :development
133
135
  requirement: &id008 !ruby/object:Gem::Requirement
134
136
  none: false
@@ -142,9 +144,9 @@ dependencies:
142
144
  - 4
143
145
  version: 1.8.4
144
146
  version_requirements: *id008
145
- name: jeweler
146
- prerelease: false
147
147
  - !ruby/object:Gem::Dependency
148
+ name: rcov
149
+ prerelease: false
148
150
  type: :development
149
151
  requirement: &id009 !ruby/object:Gem::Requirement
150
152
  none: false
@@ -156,8 +158,6 @@ dependencies:
156
158
  - 0
157
159
  version: "0"
158
160
  version_requirements: *id009
159
- name: rcov
160
- prerelease: false
161
161
  description: Command-base client for Cassandra.
162
162
  email: haracane@gmail.com
163
163
  executables:
@@ -183,6 +183,7 @@ files:
183
183
  - lib/priam/command/cql/create.rb
184
184
  - lib/priam/command/delete.rb
185
185
  - lib/priam/command/get.rb
186
+ - lib/priam/command/help.rb
186
187
  - lib/priam/command/insert.rb
187
188
  - lib/priam/command/put.rb
188
189
  - lib/priam/core.rb
@@ -226,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
227
  requirements: []
227
228
 
228
229
  rubyforge_project:
229
- rubygems_version: 1.8.21
230
+ rubygems_version: 1.8.17
230
231
  signing_key:
231
232
  specification_version: 3
232
233
  summary: Command-base client for Cassandra.