codegears 0.0.8.pre → 0.0.9.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/codegears.gemspec +1 -2
- data/lib/cg/api.rb +11 -0
- data/lib/cg/app.rb +13 -0
- data/lib/cg/command/app.rb +8 -10
- data/lib/cg/version.rb +1 -1
- data/lib/cg.rb +4 -0
- data/lib/generators/cg/install/install_generator.rb +30 -0
- data/lib/generators/cg/install/templates/config.rb.template +5 -0
- metadata +5 -1
data/codegears.gemspec
CHANGED
data/lib/cg/api.rb
ADDED
data/lib/cg/app.rb
ADDED
data/lib/cg/command/app.rb
CHANGED
@@ -1,14 +1,10 @@
|
|
1
|
-
require "
|
1
|
+
require "cg/api"
|
2
2
|
require "colorize"
|
3
3
|
|
4
4
|
module Command
|
5
5
|
class App
|
6
|
-
|
7
|
-
|
8
|
-
URL = "http://localhost:3000/apps"
|
9
|
-
|
10
|
-
def self.create!(email = "")
|
11
|
-
response = self.post(URL, :body => { :application => { :email => email } })
|
6
|
+
def self.create(email = "")
|
7
|
+
response = CG::API.create_request(email)
|
12
8
|
if response["success"] == false
|
13
9
|
response["errors"].each do |k,v|
|
14
10
|
puts "#{k.capitalize} #{v.first}\n".red
|
@@ -16,9 +12,11 @@ module Command
|
|
16
12
|
else
|
17
13
|
puts "Application successfully created.\n".green
|
18
14
|
puts "Add the following lines to the file config/initializers/codegears.rb:\n".green
|
19
|
-
puts "
|
20
|
-
puts "
|
21
|
-
puts "
|
15
|
+
puts "CG::App.configure do |instance|".green
|
16
|
+
puts " instance.id = \"#{response['id']}\"".green
|
17
|
+
puts " instance.secret_id = \"#{response['secret_id']}\"".green
|
18
|
+
puts " instance.secret_token = \"#{response['secret_token']}\"\n".green
|
19
|
+
puts "end\n"
|
22
20
|
puts "And restart application to start using the CodeGears platform.\n".green
|
23
21
|
end
|
24
22
|
end
|
data/lib/cg/version.rb
CHANGED
data/lib/cg.rb
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
require "cg/api"
|
2
|
+
|
3
|
+
module Cg
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < Rails::Generators::Base
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
desc "This generator installs CodeGears configuration in config/initializers/codegears.rb"
|
8
|
+
|
9
|
+
argument :email, :type => :string, :default => ""
|
10
|
+
|
11
|
+
def create_config_file
|
12
|
+
init_settings
|
13
|
+
template "config.rb.template", "config/initializers/codegears.rb"
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def init_settings
|
19
|
+
unless email.blank?
|
20
|
+
response = CG::API.create_request(email)
|
21
|
+
unless response["success"] == false
|
22
|
+
@id = response["id"]
|
23
|
+
@secret_id = response["secret_id"]
|
24
|
+
@secret_token = response["secret_token"]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
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.
|
4
|
+
version: 0.0.9.pre
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -91,11 +91,15 @@ files:
|
|
91
91
|
- bin/cg
|
92
92
|
- codegears.gemspec
|
93
93
|
- lib/cg.rb
|
94
|
+
- lib/cg/api.rb
|
95
|
+
- lib/cg/app.rb
|
94
96
|
- lib/cg/cli.rb
|
95
97
|
- lib/cg/command.rb
|
96
98
|
- lib/cg/command/app.rb
|
97
99
|
- lib/cg/pusher.rb
|
98
100
|
- lib/cg/version.rb
|
101
|
+
- lib/generators/cg/install/install_generator.rb
|
102
|
+
- lib/generators/cg/install/templates/config.rb.template
|
99
103
|
homepage: https://github.com/Semjonow/codegears
|
100
104
|
licenses:
|
101
105
|
- MIT
|