codegears 0.0.3.pre → 0.0.4.pre

Sign up to get free protection for your applications and to get access to all the features.
data/codegears.gemspec CHANGED
@@ -20,4 +20,5 @@ Gem::Specification.new do |gem|
20
20
  gem.add_dependency "rails"
21
21
  gem.add_dependency "jquery-rails"
22
22
  gem.add_dependency "httparty"
23
+ gem.add_dependency "colorize"
23
24
  end
@@ -1,7 +1,26 @@
1
+ require "httparty"
2
+ require "colorize"
3
+
1
4
  module Command
2
5
  class App
3
- def self.create!
4
- puts "ok"
6
+ include HTTParty
7
+
8
+ URL = "http://localhost:3000/apps"
9
+
10
+ def self.create!(email = "")
11
+ response = self.post(URL, :body => { :application => { :email => email } })
12
+ if response["success"] == false
13
+ response["errors"].each do |k,v|
14
+ puts "#{k.capitalize} #{v.first}\n".red
15
+ end
16
+ else
17
+ puts "Application successfully created.\n".green
18
+ puts "Add the following lines to the file config/initializers/codegears.rb:\n".green
19
+ puts " CG::App.id(\"#{response['id']}\")".green
20
+ puts " CG::App.secret_id(\"#{response['secret_id']}\")".green
21
+ puts " CG::App.secret_token(\"#{response['secret_token']}\")\n".green
22
+ puts "And restart application to start using the CodeGears platform.\n".green
23
+ end
5
24
  end
6
25
  end
7
26
  end
data/lib/cg/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CG
2
- VERSION = "0.0.3.pre"
2
+ VERSION = "0.0.4.pre"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codegears
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3.pre
4
+ version: 0.0.4.pre
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -59,6 +59,22 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: colorize
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
62
78
  description: Client library and CLI to manage apps on CodeGears
63
79
  email:
64
80
  - js@codegears.co