theroku 0.1.0 → 0.1.2

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: 435c845b018606253e959777c2ab9ccdf6d317a4
4
- data.tar.gz: 2afc3ed1b8525a6ac4b97dd3251e60eb02cc239a
3
+ metadata.gz: aa0ba2e25eb44511425f2764f6ea4606ba884106
4
+ data.tar.gz: b413b867571f2d078607dea79d8af9df6a32256f
5
5
  SHA512:
6
- metadata.gz: 8a449224017e6d0e21af7ac12beadc3e9a1c23328cb4dd8210592f704dfff80261c733bf6a9e88855d74751eb8d4da3a08901254bd980b819ea77f2d2a094001
7
- data.tar.gz: 4664a283baea15cc496b416b8cacedf822ed1ccba1dcb772385b398358bef26c450ee997cef06e4b11c54114f78a78a4ee23726f0cece81d430dbc70e2c74358
6
+ metadata.gz: 1bac7d06c47b7d6fd9c23f7fac9970112ca31a24296d86fac6766df7639e7b8906b0beca0cd888c0cce07305fac04aff45e8b39612917be3ea2a7b8801dc381d
7
+ data.tar.gz: 52ced739caf3e5245e11f5d13a9adc5fbc18cd31e8895e2de3fd54e53357d6c32b2347ee0c526c2ffb8eea6733574d688f7ded9725a9f806311eacc1fb8aff31
data/.theroku CHANGED
@@ -1 +1 @@
1
- 123
1
+ fJyK8p_JqTeq5FXH8P75KA
data/Gemfile CHANGED
@@ -5,4 +5,5 @@ gemspec
5
5
 
6
6
  gem 'byebug'
7
7
  gem 'commander', '~> 4.3.4'
8
- gem 'httparty', '~> 0.13.3'
8
+ gem 'httparty', '~> 0.13.3'
9
+ gem 'launchy', '~> 2.4.3'
@@ -31,7 +31,8 @@ command :update do |c|
31
31
  c.option '--url1 STRING', String, 'Changes the url1'
32
32
  c.option '--url2 STRING', String, 'Changes the url2'
33
33
  c.action do |args, options|
34
- UpdateCommand.new.execute(options.app_name, options.url1, options.url2)
34
+ p args
35
+ UpdateCommand.new.execute(options.app_name, options.url1, options.url2, args[0])
35
36
  end
36
37
  end
37
38
 
@@ -40,5 +41,15 @@ command :destroy do |c|
40
41
  c.description = 'theroku destroy <app_name>'
41
42
  c.action do |args, options|
42
43
  DestroyCommand.new.execute(*args)
44
+ end
45
+
46
+ command :open do |c|
47
+ c.syntax = 'theroku open'
48
+ c.description = 'theroku open'
49
+ c.action do |args, options|
50
+ CreateCommand.new.execute(*args)
43
51
  end
44
52
  end
53
+
54
+
55
+ end
@@ -1,5 +1,5 @@
1
1
  module Theroku
2
- @base_url = 'http://192.168.0.18:3000/api/'
2
+ @base_url = 'http://therokubalance.com/api/'
3
3
  class << self
4
4
  attr_accessor :base_url
5
5
  end
@@ -10,7 +10,8 @@ class CreateCommand
10
10
  headers: { 'Authorization' => "Token token=#{token}", 'Content-Type' => 'application/json', 'Accept' => 'application/json'}
11
11
  )
12
12
  if response.code == 200
13
- puts "Success!"
13
+ puts "You succesfully created an application."
14
+ puts "You can now go to #{subdomain}.therokuapp.com or use theroku open!"
14
15
  else
15
16
  puts "Sorry, something went wrong..."
16
17
  end
@@ -0,0 +1,5 @@
1
+ class OpenCommand
2
+ def execute
3
+ #theroku open
4
+ end
5
+ end
@@ -0,0 +1,27 @@
1
+ class UpdateCommand
2
+ require 'httparty'
3
+ def execute(*args)
4
+ if File.exists?('.theroku')
5
+ puts "Updating #{args[0]}..."
6
+ file = File.open(".theroku", "rb")
7
+ token = file.read
8
+ body = {}
9
+ body[:url1] = args[1] if args[1]
10
+ body[:url2] = args[2] if args[2]
11
+ body[:subdomain] = args[0] if args[0]
12
+
13
+ response = HTTParty.patch("#{Theroku::base_url}apps/#{args[3]}",
14
+ body: body.to_json,
15
+ headers: { 'Authorization' => "Token token=#{token}", 'Content-Type' => 'application/json', 'Accept' => 'application/json'}
16
+ )
17
+ if response.code == 200
18
+ puts "#{args[3]}, succesfully updated!"
19
+ else
20
+ puts "There were the following errors:"
21
+ puts response["errors"].capitalize
22
+ end
23
+ else
24
+ puts "You have to login before making any changes you can do that with $ theroku login"
25
+ end
26
+ end
27
+ end
Binary file
@@ -5,7 +5,7 @@ require 'theroku/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "theroku"
8
- spec.version = "0.1.0"
8
+ spec.version = "0.1.2"
9
9
  spec.authors = ["alejoescobar", "simon0191", "jasmo2"]
10
10
  spec.email = ["alejoescobac@gmail.com"]
11
11
  spec.summary = "Awesome Heroku load balancer."
@@ -19,7 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
  spec.bindir = 'bin'
21
21
  spec.add_development_dependency('rdoc', '4.2.0')
22
- spec.add_runtime_dependency('docopt', '0.5.0')
22
+ spec.add_runtime_dependency('httparty', '0.13.3')
23
+ spec.add_runtime_dependency('commander', '4.3.4')
23
24
 
24
25
  spec.add_development_dependency "bundler", "~> 1.7"
25
26
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: theroku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - alejoescobar
@@ -27,19 +27,33 @@ dependencies:
27
27
  - !ruby/object:Gem::Version
28
28
  version: 4.2.0
29
29
  - !ruby/object:Gem::Dependency
30
- name: docopt
30
+ name: httparty
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.5.0
35
+ version: 0.13.3
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 0.5.0
42
+ version: 0.13.3
43
+ - !ruby/object:Gem::Dependency
44
+ name: commander
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - '='
48
+ - !ruby/object:Gem::Version
49
+ version: 4.3.4
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - '='
55
+ - !ruby/object:Gem::Version
56
+ version: 4.3.4
43
57
  - !ruby/object:Gem::Dependency
44
58
  name: bundler
45
59
  requirement: !ruby/object:Gem::Requirement
@@ -87,8 +101,11 @@ files:
87
101
  - lib/theroku/create_command.rb
88
102
  - lib/theroku/destroy_command.rb
89
103
  - lib/theroku/login_command.rb
104
+ - lib/theroku/open_command.rb
105
+ - lib/theroku/update_command.rb
90
106
  - lib/theroku/version.rb
91
107
  - theroku-0.0.1.gem
108
+ - theroku-0.1.0.gem
92
109
  - theroku.gemspec
93
110
  homepage: https://github.com/alejoescobar/theroku
94
111
  licenses: