errplane 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,17 +11,20 @@ class ErrplaneGenerator < Rails::Generator::Base
11
11
  end
12
12
 
13
13
  begin
14
- puts "Contacting Errplane API"
15
- application_name = "ApplicationName"
16
- api_key = options[:api_key]
14
+ puts options
15
+ unless options[:application_id]
16
+ puts "Contacting Errplane API"
17
+ application_name = "ApplicationName"
18
+ api_key = options[:api_key]
17
19
 
18
- connection = Net::HTTP.new("errplane.com", 443)
19
- connection.use_ssl = true
20
- connection.verify_mode = OpenSSL::SSL::VERIFY_NONE
21
- url = "/api/v1/applications?api_key=#{api_key}&name=#{application_name}"
22
- response = connection.post(url, nil)
20
+ connection = Net::HTTP.new("errplane.com", 443)
21
+ connection.use_ssl = true
22
+ connection.verify_mode = OpenSSL::SSL::VERIFY_NONE
23
+ url = "/api/v1/applications?api_key=#{api_key}&name=#{application_name}"
24
+ response = connection.post(url, nil)
23
25
 
24
- @application = JSON.parse(response.body)
26
+ @application = JSON.parse(response.body)
27
+ end
25
28
 
26
29
  unless response.is_a?(Net::HTTPSuccess)
27
30
  raise "The Errplane API returned an error: #{response.inspect}"
@@ -1,3 +1,3 @@
1
1
  module Errplane
2
- VERSION = "0.6.3"
2
+ VERSION = "0.6.4"
3
3
  end
@@ -4,21 +4,28 @@ class ErrplaneGenerator < Rails::Generators::Base
4
4
  desc "Description:\n This creates a Rails initializer for Errplane."
5
5
 
6
6
  begin
7
- puts "Contacting Errplane API"
8
- application_name = Rails.application.class.parent_name || "NewApplication"
9
- api_key = ARGV.last
10
-
11
- connection = Net::HTTP.new("errplane.com", 443)
12
- connection.use_ssl = true
13
- connection.verify_mode = OpenSSL::SSL::VERIFY_NONE
14
- url = "/api/v1/applications?api_key=#{api_key}&name=#{application_name}"
15
- response = connection.post(url, nil)
16
-
17
- @application = JSON.parse(response.body)
18
-
19
- unless response.is_a?(Net::HTTPSuccess)
20
- raise "The Errplane API returned an error: #{response.inspect}"
7
+ if ARGV.count == 1
8
+ puts "No Application ID provided, contacting Errplane API."
9
+ application_name = Rails.application.class.parent_name || "NewApplication"
10
+ api_key = ARGV.first
11
+
12
+ connection = Net::HTTP.new("errplane.com", 443)
13
+ connection.use_ssl = true
14
+ connection.verify_mode = OpenSSL::SSL::VERIFY_NONE
15
+ url = "/api/v1/applications?api_key=#{api_key}&name=#{application_name}"
16
+ response = connection.post(url, nil)
17
+
18
+ unless response.is_a?(Net::HTTPSuccess)
19
+ raise "The Errplane API returned an error: #{response.inspect}"
20
+ end
21
+
22
+ @application = JSON.parse(response.body)
23
+ @application_id = @application["key"]
24
+ else
25
+ @application_id = ARGV[1]
21
26
  end
27
+ puts "Received Application ID: #{@application_id}"
28
+
22
29
  rescue => e
23
30
  puts "We ran into a problem creating your application via the API!"
24
31
  puts "If this issue persists, contact us at support@errplane.com with the following details:"
@@ -32,7 +39,7 @@ class ErrplaneGenerator < Rails::Generators::Base
32
39
  :description => "API key for your Errplane organization"
33
40
  argument :application_id,
34
41
  :required => false,
35
- :default => @application["key"],
42
+ :default => @application_id,
36
43
  :type => :string,
37
44
  :description => "Identifier for this application (Leave blank and a new one will be generated for you)"
38
45
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: errplane
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-06 00:00:00.000000000 Z
12
+ date: 2013-03-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &70201949454900 !ruby/object:Gem::Requirement
16
+ requirement: &70182812584520 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70201949454900
24
+ version_requirements: *70182812584520
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &70201949454380 !ruby/object:Gem::Requirement
27
+ requirement: &70182812584000 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70201949454380
35
+ version_requirements: *70182812584000
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: fakeweb
38
- requirement: &70201949484580 !ruby/object:Gem::Requirement
38
+ requirement: &70182812614700 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70201949484580
46
+ version_requirements: *70182812614700
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: guard
49
- requirement: &70201949484100 !ruby/object:Gem::Requirement
49
+ requirement: &70182812614220 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70201949484100
57
+ version_requirements: *70182812614220
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: guard-rspec
60
- requirement: &70201949483620 !ruby/object:Gem::Requirement
60
+ requirement: &70182812613740 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70201949483620
68
+ version_requirements: *70182812613740
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
- requirement: &70201949483140 !ruby/object:Gem::Requirement
71
+ requirement: &70182812613260 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70201949483140
79
+ version_requirements: *70182812613260
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rdoc
82
- requirement: &70201949482660 !ruby/object:Gem::Requirement
82
+ requirement: &70182812612780 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70201949482660
90
+ version_requirements: *70182812612780
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rspec
93
- requirement: &70201949482180 !ruby/object:Gem::Requirement
93
+ requirement: &70182812612300 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70201949482180
101
+ version_requirements: *70182812612300
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: tzinfo
104
- requirement: &70201949481700 !ruby/object:Gem::Requirement
104
+ requirement: &70182812611820 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70201949481700
112
+ version_requirements: *70182812611820
113
113
  description: This gem provides implements instrumentation with Errplane for Rails
114
114
  2.3.x and 3.x applications.
115
115
  email: