sakurraform 0.0.3 → 0.0.4

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: 287588b6d213e913abe0b212f575ddf26b9435b2
4
- data.tar.gz: cd6567661ec2d1dff262d3dd5978c4bee72f9378
3
+ metadata.gz: f0d62a5f42569d645e9a36843de64c9726bdb32c
4
+ data.tar.gz: 50d217d54787cb4725a2575c76b55d76192780df
5
5
  SHA512:
6
- metadata.gz: 5047750cea430417a14573a2d548939ef2215cf4a38ecf575d256193667c549ca047f17c8d82ef5f8cbef9f0d01a5caffa1477b4a529cbfdba31524c9f22455e
7
- data.tar.gz: aaaaa1f882f4b8c028834085198facafcb7e3dc6034226eaa744b55f666a4b1712594146de200b16077a43bdbaa57d2c089067f3eb2360e9be86fdab8837bcd3
6
+ metadata.gz: 03c4d7a5f12cfff6d49f556066a922a4748200add42eb4c1134dbd722462937650145aba19c9123fba00c95cf2ef477f30cdd904390f8cea1a9c39c449234c5e
7
+ data.tar.gz: 53ecc192f025add789925ada292b32aae5aaafb44ebd12aae20e703097b7707e1844a5ec3e88665a7c2aebf90a80d7a8155dd96c1edc1cccb35e27c8df8af124
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG of sakurraform
2
2
 
3
+ ## v0.0.4
4
+
5
+ - cat object from bs
6
+ - delete object from bs
7
+
3
8
  ## v0.0.3
4
9
 
5
10
  - Change network_offset default. 3 or upper.
data/README.md CHANGED
@@ -14,7 +14,11 @@ Manage Infrastructure from Code with Sakura no Cloud and Base Storage.
14
14
 
15
15
  Add this line to your application's Gemfile:
16
16
 
17
+ > Notice: sakurraform depends fog v1.23.0 or newer.
18
+ > This version doesn't release yet.
19
+
17
20
  ```ruby
21
+ gem 'fog', git: 'https://github.com/fog/fog.git', ref: 'master'
18
22
  gem 'sakurraform'
19
23
  ```
20
24
 
@@ -22,10 +26,6 @@ And then execute:
22
26
 
23
27
  $ bundle
24
28
 
25
- Or install it yourself as:
26
-
27
- $ gem install sakurraform
28
-
29
29
  ## Usage
30
30
 
31
31
  ```
@@ -57,6 +57,14 @@ Sakura Base Storage token(optional) ? mytoken
57
57
 
58
58
  ### sakurraform plan SUBCOMMAND
59
59
 
60
+ ```
61
+ $ ./bin/sakurraform plan
62
+ Commands:
63
+ sakurraform plan apply # Apply plan
64
+ sakurraform plan generate # Generate template
65
+ sakurraform plan help [COMMAND] # Describe subcommands or one specific subcommand
66
+ ```
67
+
60
68
  #### sakurraform plan generate
61
69
 
62
70
  Create plan template.
@@ -136,6 +144,17 @@ open map page by bwowser...
136
144
 
137
145
  ### sakurraform bs SUBCOMMAND
138
146
 
147
+
148
+ ```
149
+ $ ./bin/sakurraform bs
150
+ Commands:
151
+ sakurraform bs cat PATH # cat object entry
152
+ sakurraform bs create # Create bucket(..just open browser)
153
+ sakurraform bs delete PATH # delete object entry
154
+ sakurraform bs help [COMMAND] # Describe subcommands or one specific subcommand
155
+ sakurraform bs ls # list object entries
156
+ ```
157
+
139
158
  #### sakurraform bs create
140
159
 
141
160
  Create bucket(..just open browser)
@@ -155,6 +174,19 @@ $ ./bin/sakurraform bs ls
155
174
  +----------+----------------+---------------------+---------------------------+-------------------------------------------------------+
156
175
  ```
157
176
 
177
+ #### sakurraform bs cat
178
+
179
+ ```
180
+ $ ./bin/sakurraform bs cat 20140930_debug.out_0
181
+ {"hoge":"mogemoge","piyo":"piyo"}
182
+ ```
183
+
184
+ #### sakurraform bs delete
185
+
186
+ ```
187
+ $ ./bin/sakurraform bs delete 20140930_debug.out_0
188
+ deleting 20140930_debug.out_0
189
+ ```
158
190
 
159
191
  ## Contributing
160
192
 
@@ -15,12 +15,7 @@ module SakurraForm
15
15
 
16
16
  desc 'ls', 'list object entries'
17
17
  def ls
18
- s3 = AWS::S3.new(
19
- :access_key_id => Fog.credentials[:sakura_base_storage_bucket],
20
- :secret_access_key => Fog.credentials[:sakura_base_storage_token] ,
21
- :s3_endpoint => 'b.storage.sakura.ad.jp',
22
- :use_ssl => false
23
- )
18
+ s3 = init_s3
24
19
 
25
20
  bucket = s3.buckets[Fog.credentials[:sakura_base_storage_bucket]]
26
21
  table = bucket.objects.entries.map do |ent|
@@ -34,5 +29,28 @@ module SakurraForm
34
29
  end
35
30
  Formatador.display_table(table, [:key, :content_length, :content_type, :last_modified, :public_url])
36
31
  end
32
+
33
+ desc 'cat PATH', 'cat object entry'
34
+ def cat(path)
35
+ s3 = init_s3
36
+
37
+ bucket = s3.buckets[Fog.credentials[:sakura_base_storage_bucket]]
38
+ obj = bucket.objects.find {|a| a.key == path }
39
+ say(obj.read) if obj
40
+ end
41
+
42
+ desc 'delete PATH', 'delete object entry'
43
+ def delete(path)
44
+ s3 = init_s3
45
+
46
+ bucket = s3.buckets[Fog.credentials[:sakura_base_storage_bucket]]
47
+ obj = bucket.objects.find {|a| a.key == path }
48
+ if obj
49
+ say("deleting #{obj.key}")
50
+ obj.delete
51
+ else
52
+ say("Object #{path} Not found.")
53
+ end
54
+ end
37
55
  end
38
56
  end
@@ -78,5 +78,15 @@ module SakurraForm
78
78
  end
79
79
  table_data
80
80
  end
81
+
82
+ def init_s3
83
+ AWS::S3.new(
84
+ :access_key_id => Fog.credentials[:sakura_base_storage_bucket],
85
+ :secret_access_key => Fog.credentials[:sakura_base_storage_token] ,
86
+ :s3_endpoint => 'b.storage.sakura.ad.jp',
87
+ :use_ssl => false
88
+ )
89
+ end
90
+
81
91
  end
82
92
  end
@@ -1,3 +1,3 @@
1
1
  module SakurraForm
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sakurraform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - sawanoboly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-29 00:00:00.000000000 Z
11
+ date: 2014-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor