ratchetio 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -10,20 +10,22 @@ Add this line to your application's Gemfile:
10
10
 
11
11
  And then execute:
12
12
 
13
- $ bundle
13
+ $ bundle install
14
14
 
15
15
  Or install it yourself as:
16
16
 
17
17
  $ gem install ratchetio
18
18
 
19
- Then, create the file `config/initializers/ratchetio.rb` in your rails app containing the following:
19
+ Then, run the following command from your rails root:
20
+
21
+ $ rails generate ratchetio YOUR_RATCHETIO_PROJECT_ACCESS_TOKEN
22
+
23
+ That will create the file `config/initializers/ratchetio.rb`, which holds the configuration values (currently just your access token) and is all you need to use Ratchet.io with Rails.
24
+
25
+ ## Help / Support
26
+
27
+ If you run into any issues, please email me at brian@ratchet.io
20
28
 
21
- ```
22
- require 'ratchetio/rails'
23
- Ratchetio.configure do |config|
24
- config.access_token = 'YOUR_RATCHETIO_PROJECT_ACCESS_TOKEN'
25
- end
26
- ```
27
29
 
28
30
  ## Contributing
29
31
 
@@ -0,0 +1,53 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/named_base'
3
+
4
+ module Ratchetio
5
+ module Generators
6
+ class RatchetioGenerator < ::Rails::Generators::Base
7
+ argument :access_token, :type => :string, :banner => "access_token"
8
+
9
+ source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
10
+
11
+ def create_initializer
12
+ puts "creating initializer..."
13
+ if access_token_configured?
14
+ puts "It looks like you've already configured Ratchetio."
15
+ puts "To re-create the config file, remove it first: config/initializers/ratchetio.rb"
16
+ exit
17
+ end
18
+
19
+ puts "access token: " << access_token
20
+
21
+ template 'initializer.rb', 'config/initializers/ratchetio.rb',
22
+ :assigns => { :access_token => access_token_expr }
23
+
24
+ # TODO run rake test task
25
+ end
26
+
27
+ #def add_options!(opt)
28
+ # opt.on('-a', '--access-token=token', String, "Your Ratchet.io project access token") { |v| options[:access_token] = v }
29
+ #end
30
+ #
31
+ # def manifest
32
+ # if !access_token_configured? && !options[:access_token]
33
+ # puts "access_token is required. Pass --access-token=YOUR_ACCESS_TOKEN"
34
+ # exit
35
+ # end
36
+ #
37
+ # record do |m|
38
+ # m.template 'initializer.rb', 'config/initializers/ratchetio.rb',
39
+ # :assigns => { :access_token => access_token_expr }
40
+ # # TODO run rake test task
41
+ # end
42
+ # end
43
+
44
+ def access_token_expr
45
+ "'#{access_token}'"
46
+ end
47
+
48
+ def access_token_configured?
49
+ File.exists?('config/initializers/ratchetio.rb')
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,4 @@
1
+ require 'ratchetio/rails'
2
+ Ratchetio.configure do |config|
3
+ config.access_token = <%= access_token_expr %>
4
+ end
@@ -1,3 +1,3 @@
1
1
  module Ratchetio
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ratchetio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-27 00:00:00.000000000 Z
12
+ date: 2012-08-28 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Rails plugin to catch and send exceptions to Ratchet.io
15
15
  email:
@@ -23,6 +23,8 @@ files:
23
23
  - LICENSE
24
24
  - README.md
25
25
  - Rakefile
26
+ - lib/generators/ratchetio/ratchetio_generator.rb
27
+ - lib/generators/ratchetio/templates/initializer.rb
26
28
  - lib/ratchetio.rb
27
29
  - lib/ratchetio/configuration.rb
28
30
  - lib/ratchetio/rails.rb