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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +36 -4
- data/lib/sakurraform/cli/bs.rb +24 -6
- data/lib/sakurraform/helper.rb +10 -0
- data/lib/sakurraform/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0d62a5f42569d645e9a36843de64c9726bdb32c
|
4
|
+
data.tar.gz: 50d217d54787cb4725a2575c76b55d76192780df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03c4d7a5f12cfff6d49f556066a922a4748200add42eb4c1134dbd722462937650145aba19c9123fba00c95cf2ef477f30cdd904390f8cea1a9c39c449234c5e
|
7
|
+
data.tar.gz: 53ecc192f025add789925ada292b32aae5aaafb44ebd12aae20e703097b7707e1844a5ec3e88665a7c2aebf90a80d7a8155dd96c1edc1cccb35e27c8df8af124
|
data/CHANGELOG.md
CHANGED
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
|
|
data/lib/sakurraform/cli/bs.rb
CHANGED
@@ -15,12 +15,7 @@ module SakurraForm
|
|
15
15
|
|
16
16
|
desc 'ls', 'list object entries'
|
17
17
|
def ls
|
18
|
-
s3 =
|
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
|
data/lib/sakurraform/helper.rb
CHANGED
@@ -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
|
data/lib/sakurraform/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2014-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|