codegears 0.0.2 → 0.0.3.pre

Sign up to get free protection for your applications and to get access to all the features.
data/codegears.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  $:.unshift File.expand_path("../lib/", __FILE__)
3
3
 
4
- require "cg"
4
+ require "cg/version"
5
5
 
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "codegears"
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
10
10
  gem.email = ["js@codegears.co"]
11
11
  gem.description = %q{Client library and CLI to manage apps on CodeGears}
12
12
  gem.summary = %q{Client library and command-line tool to manage apps on CodeGears}
13
- gem.homepage = "https://github.com/code-gears/codegears"
13
+ gem.homepage = "https://github.com/Semjonow/codegears"
14
14
  gem.license = "MIT"
15
15
  gem.executables << "cg"
16
16
  gem.default_executable = "cg"
@@ -20,5 +20,4 @@ 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"
24
23
  end
@@ -1,35 +1,7 @@
1
- require "cg/api"
2
- require "colorize"
3
-
4
1
  module Command
5
2
  class App
6
- def self.create(email = "")
7
- response = CG::API.create_app_request(email)
8
- if response["success"] == false
9
- response["errors"].each do |k,v|
10
- puts "#{k.capitalize} #{v.first}\n".red
11
- end
12
- else
13
- puts "Application successfully created.".green
14
- puts "Add the following lines to the file config/initializers/codegears.rb:\n".green
15
- puts "require \"cg\"\n".green
16
- puts "CG::App.configure do |instance|".green
17
- puts " instance.id = \"#{response['id']}\"".green
18
- puts " instance.secret_id = \"#{response['secret_id']}\"".green
19
- puts " instance.secret_token = \"#{response['secret_token']}\"\n".green
20
- puts "end\n".green
21
- puts "And restart application to start using the CodeGears platform.".green
22
- end
23
- end
24
-
25
- def self.status(id = "")
26
- response = CG::API.show_app_request(id)
27
- if response["success"] == false
28
- puts "Application not found".red
29
- else
30
- status = response["active"]
31
- puts "Active: #{status}".send(status ? :green : :red)
32
- end
3
+ def self.create!
4
+ puts "ok"
33
5
  end
34
6
  end
35
7
  end
data/lib/cg/command.rb CHANGED
@@ -1,5 +1,3 @@
1
- require "cg/version"
2
-
3
1
  module CG
4
2
  class Command
5
3
  def initialize(*args)
@@ -11,15 +9,7 @@ module CG
11
9
  namespace = Kernel.const_get("Command").const_get(namespace) rescue nil
12
10
  task = args.shift.downcase rescue nil
13
11
 
14
- if namespace
15
- if task
16
- namespace.send(task, *args)
17
- else
18
- namespace.send("main", *args)
19
- end
20
- else
21
- puts CG::VERSION
22
- end
12
+ namespace.send(task, *args)
23
13
  end
24
14
  end
25
15
  end
data/lib/cg/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CG
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3.pre"
3
3
  end
data/lib/cg.rb CHANGED
@@ -1,9 +1,4 @@
1
- require "rails"
2
1
  require "cg/version"
3
- require "cg/app"
4
2
 
5
3
  module CG
6
- class Engine < Rails::Engine
7
-
8
- end
9
4
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codegears
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.3.pre
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Juri Semjonov
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-06 00:00:00.000000000 Z
12
+ date: 2013-04-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -59,22 +59,6 @@ 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'
78
62
  description: Client library and CLI to manage apps on CodeGears
79
63
  email:
80
64
  - js@codegears.co
@@ -91,17 +75,12 @@ files:
91
75
  - bin/cg
92
76
  - codegears.gemspec
93
77
  - lib/cg.rb
94
- - lib/cg/api.rb
95
- - lib/cg/app.rb
96
78
  - lib/cg/cli.rb
97
79
  - lib/cg/command.rb
98
80
  - lib/cg/command/app.rb
99
- - lib/cg/command/version.rb
100
81
  - lib/cg/pusher.rb
101
82
  - lib/cg/version.rb
102
- - lib/generators/cg/install/install_generator.rb
103
- - lib/generators/cg/install/templates/config.rb.template
104
- homepage: https://github.com/code-gears/codegears
83
+ homepage: https://github.com/Semjonow/codegears
105
84
  licenses:
106
85
  - MIT
107
86
  post_install_message:
@@ -117,9 +96,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
117
96
  required_rubygems_version: !ruby/object:Gem::Requirement
118
97
  none: false
119
98
  requirements:
120
- - - ! '>='
99
+ - - ! '>'
121
100
  - !ruby/object:Gem::Version
122
- version: '0'
101
+ version: 1.3.1
123
102
  requirements: []
124
103
  rubyforge_project:
125
104
  rubygems_version: 1.8.23
data/lib/cg/api.rb DELETED
@@ -1,32 +0,0 @@
1
- require "httparty"
2
-
3
- module CG
4
- class API
5
- include HTTParty
6
- ROOT_URL = "http://api.codegears.co"
7
- PUSHER_URL = "#{ROOT_URL}:9292/stream"
8
-
9
- def self.create_app_request(email)
10
- JSON.parse(self.post("#{ROOT_URL}/apps", :body => { :application => { :email => email } }).body)
11
- end
12
-
13
- def self.show_app_request(id, secret_id = nil, secret_token = nil)
14
- JSON.parse(self.get("#{ROOT_URL}/apps/#{id}?#{self.attach_auth(secret_id, secret_token)}").body)
15
- end
16
-
17
- def self.push_message_request(channel, message)
18
- message = { :channel => channel,
19
- :message => message,
20
- :ext => { :secret_id => CG::APP.secret_id, :secret_token => CG::APP.secret_token } }.to_json
21
- JSON.parse(Net::HTTP.post_form(URI.parse(PUSHER_URL), :message => message).body)
22
- end
23
-
24
- def self.attach_auth(secret_id, secret_token)
25
- if secret_id && secret_token
26
- "secret_id=#{secret_id}&secret_token=#{secret_token}"
27
- else
28
- ""
29
- end
30
- end
31
- end
32
- end
data/lib/cg/app.rb DELETED
@@ -1,74 +0,0 @@
1
- require "singleton"
2
- require "cg/api"
3
-
4
- module CG
5
- class APP
6
- include Singleton
7
-
8
- attr_accessor :secret_id, :secret_token, :id, :channel, :message, :sent, :response
9
-
10
- def self.configure
11
- yield(self.instance)
12
- end
13
-
14
- def self.id
15
- self.instance.id
16
- end
17
-
18
- def self.secret_id
19
- self.instance.secret_id
20
- end
21
-
22
- def self.secret_token
23
- self.instance.secret_token
24
- end
25
-
26
- def self.init_message
27
- yield(self.instance)
28
- self.instance
29
- end
30
-
31
- def self.message
32
- self.instance.message
33
- end
34
-
35
- def self.channel
36
- self.instance.channel
37
- end
38
-
39
- def self.sent?
40
- !!self.instance.sent
41
- end
42
-
43
- def self.response
44
- self.instance.response
45
- end
46
-
47
- def self.push(channel, message = nil)
48
- instance = self.instance
49
-
50
- instance.channel = instance.perform(channel)
51
- instance.message = message || yield
52
-
53
- instance.response = CG::API.push_message_request(instance.channel, instance.message)
54
- end
55
-
56
- def self.stats
57
- instance = self.instance
58
-
59
- CG::API.show_app_request(instance.id, instance.secret_id, instance.secret_token)
60
- end
61
-
62
- def channel=(ch)
63
- @channel = perform(ch)
64
- end
65
-
66
- def push
67
- instance.response = CG::API.push_message_request(channel, message)
68
- end
69
-
70
- def perform(channel)
71
- channel[0] == "/" ? channel : "/#{channel}"
72
- end
73
- end
74
- end
@@ -1,9 +0,0 @@
1
- require "cg/version"
2
-
3
- module Command
4
- class Version
5
- def self.main(*args)
6
- puts CG::VERSION
7
- end
8
- end
9
- end
@@ -1,32 +0,0 @@
1
- require "cg/api"
2
- require "colorize"
3
-
4
- module Cg
5
- module Generators
6
- class InstallGenerator < Rails::Generators::Base
7
- source_root File.expand_path("../templates", __FILE__)
8
- desc "This generator installs CodeGears configuration in config/initializers/codegears.rb"
9
-
10
- argument :email, :type => :string, :default => ""
11
-
12
- def create_config_file
13
- init_settings
14
- template "config.rb.template", "config/initializers/codegears.rb"
15
- puts "Restart application to start using the CodeGears platform.".green
16
- end
17
-
18
- private
19
-
20
- def init_settings
21
- unless email.blank?
22
- response = CG::API.create_app_request(email)
23
- unless response["success"] == false
24
- @id = response['id']
25
- @secret_id = response['secret_id']
26
- @secret_token = response['secret_token']
27
- end
28
- end
29
- end
30
- end
31
- end
32
- end
@@ -1,7 +0,0 @@
1
- require "cg"
2
-
3
- CG::APP.configure do |instance|
4
- instance.id = "<%= @id %>"
5
- instance.secret_id = "<%= @secret_id %>"
6
- instance.secret_token = "<%= @secret_token %>"
7
- end