tenma 0.9.0 → 0.9.1

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: 5534058ddf106c8eee32ae05e4ad741d4b859443
4
- data.tar.gz: 0c59a6c5668b3d646af0e2e65f17b9c526200410
3
+ metadata.gz: c5b17dc2244737cd89ae7a2e743fe9c02fbf48c0
4
+ data.tar.gz: f18d35a347f7129f51fd292d7f9e7c0f541ddf1e
5
5
  SHA512:
6
- metadata.gz: 659fa12c1f0d0286b3f0fced66d8bb88a2a05a9f8f778df8f55adb8d97732ada35328946c98cb41ae2c3c6fdc3e3958c1151cde36cff83c2672c92bc1ca36361
7
- data.tar.gz: 2ae6c1eb444d7e9ced28ed58b8810424db4d69a973985ce985e8a9d552f6d9bdfeb9a084d95fa441a08bbdc4b8a0982487800ddfba84d730a8106463d35c4184
6
+ metadata.gz: f89d786f93a650ce7e9ee8c937a8a8e8dc30bd07fcaae4c197600cdf8acdecd3c572c072833ff6650273ab128d8aad6249c8d0fe324657ae350a751243b16b95
7
+ data.tar.gz: 66b11cb1553d02f983dc94d7bd2fa932eb601d5f05a96d548184e6fbc0cc0aef580a58296a4525b2221e42828b07e6a6542f391e34c73a0d7c25aa1b41e1eaa9
data/README.md CHANGED
@@ -97,7 +97,11 @@ Options:
97
97
 
98
98
  ### :relaxed::relaxed: Manipulate "Android-remote-build" instance. :relaxed::relaxed:
99
99
 
100
- #### 1. :paperclip: Set `TENMA_ICHIBA_INSTANCE_PROJECT` environment.
100
+ #### 1. :cloud: Install and init `gcloud` command.
101
+
102
+ [About gcloud](https://cloud.google.com/sdk/gcloud)
103
+
104
+ #### 2. :paperclip: Set `TENMA_ICHIBA_INSTANCE_PROJECT` environment.
101
105
 
102
106
  Set `TENMA_ICHIBA_INSTANCE_PROJECT` at .zshrc or .bashrc.
103
107
 
@@ -105,7 +109,7 @@ Set `TENMA_ICHIBA_INSTANCE_PROJECT` at .zshrc or .bashrc.
105
109
  export TENMA_ICHIBA_INSTANCE_PROJECT=your-gcp-project
106
110
  ```
107
111
 
108
- #### 2. :memo: Create `tenma/ichiba.yml`
112
+ #### 3. :memo: Create `tenma/ichiba.yml`
109
113
 
110
114
  ```yaml
111
115
  android_sdk:
@@ -119,7 +123,7 @@ android_sdk:
119
123
  - extra-google-google_play_services
120
124
  ```
121
125
 
122
- #### 3. :runner: Run command
126
+ #### 4. :runner: Run command
123
127
 
124
128
  Run following command, if you want to create and provision remote-build instance.
125
129
  ```
@@ -131,7 +135,7 @@ Run following command, if you want to delete remote-build instance.
131
135
  bundle exec tenma ichiba --delete-instance
132
136
  ```
133
137
 
134
- #### 4. :helicopter: Finish!
138
+ #### 5. :helicopter: Finish!
135
139
 
136
140
  Execute the `tenma help ichiba` command, If you want more information.
137
141
 
@@ -5,6 +5,9 @@ module Tenma
5
5
  class Instance
6
6
 
7
7
  attr_reader :context, :name, :type, :zone, :project, :disk_size
8
+
9
+ include Tenma::Runnable
10
+
8
11
  def initialize(context)
9
12
  @context = context
10
13
  @name = @context.options.raw.instance_name
@@ -16,7 +19,7 @@ module Tenma
16
19
 
17
20
  def create
18
21
  puts "Create instance..."
19
- puts `gcloud compute instances create #{name} --image-family ubuntu-1710 --image-project ubuntu-os-cloud --preemptible --machine-type #{type} --zone #{zone} --project #{project} --boot-disk-size #{disk_size}GB`
22
+ puts run "gcloud compute instances create #{name} --image-family ubuntu-1710 --image-project ubuntu-os-cloud --preemptible --machine-type #{type} --zone #{zone} --project #{project} --boot-disk-size #{disk_size}GB"
20
23
  end
21
24
 
22
25
  def provision
@@ -29,8 +32,8 @@ module Tenma
29
32
  end
30
33
 
31
34
  # In order to execute Itamae, it is necessary to set up ssh config.
32
- puts `gcloud compute config-ssh --remove --ssh-key-file #{file} --project #{project}`
33
- puts `gcloud compute config-ssh --ssh-key-file #{file} --project #{project}`
35
+ puts run "gcloud compute config-ssh --remove --ssh-key-file #{file} --project #{project}"
36
+ puts run "gcloud compute config-ssh --ssh-key-file #{file} --project #{project}"
34
37
 
35
38
  puts "Provision instance..."
36
39
  role_file = File.expand_path('../itamae/roles/remote.rb', __FILE__)
@@ -47,14 +50,14 @@ module Tenma
47
50
 
48
51
  def delete
49
52
  puts "Delete instance..."
50
- puts `gcloud compute instances delete #{name} --delete-disks all --quiet --zone #{zone} --project #{project}`
53
+ puts run "gcloud compute instances delete #{name} --delete-disks all --quiet --zone #{zone} --project #{project}"
51
54
  end
52
55
 
53
56
  def restart
54
57
  puts "Reset instance..."
55
- puts `gcloud compute instances reset #{name} --zone #{zone} --project #{project}`
58
+ puts run "gcloud compute instances reset #{name} --zone #{zone} --project #{project}"
56
59
  puts "Start instance..."
57
- puts `gcloud compute instances start #{name} --zone #{zone} --project #{project}`
60
+ puts run "gcloud compute instances start #{name} --zone #{zone} --project #{project}"
58
61
  end
59
62
  end
60
63
  end
@@ -0,0 +1,15 @@
1
+ module Tenma
2
+ module Runnable
3
+ def run(command)
4
+ output = `#{command}`
5
+ if !$?.success?
6
+ raise CommandException, "Failed! #{command}"
7
+ end
8
+
9
+ return output
10
+ end
11
+
12
+ class CommandException < Exception
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Tenma
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tenma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - hisaichi5518
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-27 00:00:00.000000000 Z
11
+ date: 2018-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -162,6 +162,7 @@ files:
162
162
  - lib/tenma/prepare/release_branch.rb
163
163
  - lib/tenma/prepare/release_issue.rb
164
164
  - lib/tenma/prepare/release_pullreqs.rb
165
+ - lib/tenma/runnable.rb
165
166
  - lib/tenma/version.rb
166
167
  - tenma.gemspec
167
168
  homepage: https://github.com/hisaichi5518/tenma