chameleon 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NzIyNGNlMWMzOTRlNGFmNzQwMWZhOTQzZTIwNDI4ZTJiNGZjYTE5OA==
5
+ data.tar.gz: !binary |-
6
+ OTMzNjg2OWE4ZmUyN2UxODc4OWFlMzM1M2I4MjdjOGE5NDhlY2JlZg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ NDk5MTNlMjM0N2FkYzcxYWEzMTA2NTBlMzZhOTRlYmQ4MTIxNGY0MTNjNDRi
10
+ YzNmZjA1YTBmN2JlZTcyNWQ4YWY1ZDI3ZDE3NWQ2ZDJiYmUxY2I1ODBlNTA5
11
+ MmExYzQ5MmY1MTg2OWZjZDkyMzY1MTBmNWZjYWY2ZWViOWMyNmE=
12
+ data.tar.gz: !binary |-
13
+ ZjI2MzM3M2YzZTc2ZDE3NzBjZDU1NTlkOTIxNzJhYTc2MTA1M2IzZDc4NWRj
14
+ ZGVkNTI0OGQ2MmZhNTEzNmZkOTEwM2MyNGVjN2I2Y2Q1MWNhZWJjMDlhN2Q5
15
+ MmQ1Y2M3NmVjMTM2OTMxNzkzZGQ5OTY2MWFlYTU0ZjM4NzQ2Y2I=
@@ -6,7 +6,7 @@
6
6
 
7
7
  This is a Rails engine designed to make it super easy to expose data from your application as widgets for use with Geckoboard (http://geckoboard.com).
8
8
 
9
- This only works for Rails 3 apps.
9
+ This works for Rails 3 and Rails 4 apps.
10
10
 
11
11
  == FEATURES:
12
12
 
@@ -56,7 +56,7 @@ More documentation on the settings available for the widgets, as well as the dif
56
56
 
57
57
  == REQUIREMENTS:
58
58
 
59
- A Rails 3 application.
59
+ A Rails 3 or Rails 4 application and a Geckoboard account.
60
60
 
61
61
  == INSTALL:
62
62
 
@@ -67,11 +67,14 @@ It's best to add it to the Gemfile for your Rails 3 app, but if needed you can i
67
67
  == CONTRIBUTORS:
68
68
 
69
69
  Elliott Draper
70
+
70
71
  Tim Blair
71
72
 
73
+ Jared Armstrong
74
+
72
75
  == LICENSE:
73
76
 
74
- Copyright 2011 Elliott Draper <el@ejdraper.com>
77
+ Copyright 2013 Elliott Draper <el@kickcode.com>
75
78
 
76
79
  Permission is hereby granted, free of charge, to any person obtaining
77
80
  a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- class WidgetsController < ApplicationController
1
+ class Chameleon::WidgetsController < ApplicationController
2
2
  before_filter :find_widget
3
3
  before_filter :validate_key
4
4
  skip_before_filter :verify_authenticity_token
@@ -10,7 +10,7 @@ class WidgetsController < ApplicationController
10
10
 
11
11
  protected
12
12
  def find_widget
13
- @widget = Widget.find(params[:id].gsub(".xml", ""))
13
+ @widget = Chameleon::Widget.find(params[:id].gsub(".xml", ""))
14
14
  raise "Invalid widget!" if @widget.nil?
15
15
  end
16
16
 
@@ -0,0 +1,54 @@
1
+ module Chameleon
2
+ class Widget
3
+ cattr_accessor :widgets
4
+
5
+ def self.widget(name, &block)
6
+ @@widgets ||= {}
7
+ @@widgets[name] = Widget.new(name, &block)
8
+ end
9
+
10
+ def self.find(name)
11
+ Dir.glob(File.join("app", "widgets", "*.rb")).each { |f| load File.expand_path(f) } if Rails.env == "development"
12
+ (@@widgets || {})[name.to_sym]
13
+ end
14
+
15
+ def initialize(name, &block)
16
+ @name = name
17
+ instance_eval(&block)
18
+ end
19
+
20
+ def name
21
+ @name
22
+ end
23
+
24
+ def key(value = nil)
25
+ @key = value unless value.nil?
26
+ @key
27
+ end
28
+
29
+ def key_parameter(value = nil)
30
+ @key_parameter = value unless value.nil?
31
+ @key_parameter || :key
32
+ end
33
+
34
+ def auth(&block)
35
+ @auth = block if block_given?
36
+ @auth
37
+ end
38
+
39
+ def type(value = nil)
40
+ @type = value unless value.nil?
41
+ @type
42
+ end
43
+
44
+ def public(value = nil)
45
+ @public = value unless value.nil?
46
+ @public || false
47
+ end
48
+
49
+ def data(&block)
50
+ @data = block if block_given?
51
+ @data
52
+ end
53
+ end
54
+ end
@@ -1,3 +1,3 @@
1
1
  Rails.application.routes.draw do
2
- match "widgets/:id", :to => "widgets#show"
2
+ match "widgets/:id", :to => "chameleon/widgets#show", :via => [:get, :post]
3
3
  end
@@ -1,5 +1,7 @@
1
1
  module Chameleon
2
2
  class Engine < Rails::Engine
3
+ isolate_namespace Chameleon
4
+
3
5
  initializer "chameleon.initialization" do
4
6
  Dir.glob(File.join("app", "widgets", "*.rb")).each { |f| require File.expand_path(f) }
5
7
  end
@@ -8,6 +10,6 @@ end
8
10
 
9
11
  Kernel.class_eval do
10
12
  def widget(name, &block)
11
- Widget.widget(name, &block)
13
+ Chameleon::Widget.widget(name, &block)
12
14
  end
13
15
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chameleon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
5
- prerelease:
4
+ version: 0.2.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Elliott Draper
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-07-25 00:00:00.000000000 Z
11
+ date: 2013-10-09 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - '='
20
18
  - !ruby/object:Gem::Version
@@ -22,13 +20,12 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - '='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 3.2.6
30
27
  description:
31
- email: el@ejdraper.com
28
+ email: el@kickcode.com
32
29
  executables: []
33
30
  extensions: []
34
31
  extra_rdoc_files:
@@ -36,20 +33,21 @@ extra_rdoc_files:
36
33
  files:
37
34
  - MIT-LICENSE
38
35
  - README.rdoc
39
- - app/controllers/widgets_controller.rb
40
- - app/models/widget.rb
41
- - app/views/widgets/funnel.xml.erb
42
- - app/views/widgets/geckometer.xml.erb
43
- - app/views/widgets/line.xml.erb
44
- - app/views/widgets/number_and_secondary.xml.erb
45
- - app/views/widgets/pie.xml.erb
46
- - app/views/widgets/rag.xml.erb
47
- - app/views/widgets/text.xml.erb
36
+ - app/controllers/chameleon/widgets_controller.rb
37
+ - app/models/chameleon/widget.rb
38
+ - app/views/chameleon/widgets/funnel.xml.erb
39
+ - app/views/chameleon/widgets/geckometer.xml.erb
40
+ - app/views/chameleon/widgets/line.xml.erb
41
+ - app/views/chameleon/widgets/number_and_secondary.xml.erb
42
+ - app/views/chameleon/widgets/pie.xml.erb
43
+ - app/views/chameleon/widgets/rag.xml.erb
44
+ - app/views/chameleon/widgets/text.xml.erb
48
45
  - config/routes.rb
49
46
  - lib/chameleon.rb
50
47
  - lib/generators/chameleon/widget_generator.rb
51
48
  homepage: http://github.com/ejdraper/chameleon
52
49
  licenses: []
50
+ metadata: {}
53
51
  post_install_message:
54
52
  rdoc_options:
55
53
  - --main
@@ -57,24 +55,19 @@ rdoc_options:
57
55
  require_paths:
58
56
  - lib
59
57
  required_ruby_version: !ruby/object:Gem::Requirement
60
- none: false
61
58
  requirements:
62
59
  - - ! '>='
63
60
  - !ruby/object:Gem::Version
64
61
  version: '0'
65
- segments:
66
- - 0
67
- hash: 522234829210247769
68
62
  required_rubygems_version: !ruby/object:Gem::Requirement
69
- none: false
70
63
  requirements:
71
64
  - - ! '>='
72
65
  - !ruby/object:Gem::Version
73
66
  version: '0'
74
67
  requirements: []
75
68
  rubyforge_project:
76
- rubygems_version: 1.8.24
69
+ rubygems_version: 2.0.7
77
70
  signing_key:
78
- specification_version: 3
71
+ specification_version: 4
79
72
  summary: Rails engine to let you easily build Geckoboard widgets
80
73
  test_files: []
@@ -1,52 +0,0 @@
1
- class Widget
2
- cattr_accessor :widgets
3
-
4
- def self.widget(name, &block)
5
- @@widgets ||= {}
6
- @@widgets[name] = Widget.new(name, &block)
7
- end
8
-
9
- def self.find(name)
10
- Dir.glob(File.join("app", "widgets", "*.rb")).each { |f| load File.expand_path(f) } if Rails.env == "development"
11
- (@@widgets || {})[name.to_sym]
12
- end
13
-
14
- def initialize(name, &block)
15
- @name = name
16
- instance_eval(&block)
17
- end
18
-
19
- def name
20
- @name
21
- end
22
-
23
- def key(value = nil)
24
- @key = value unless value.nil?
25
- @key
26
- end
27
-
28
- def key_parameter(value = nil)
29
- @key_parameter = value unless value.nil?
30
- @key_parameter || :key
31
- end
32
-
33
- def auth(&block)
34
- @auth = block if block_given?
35
- @auth
36
- end
37
-
38
- def type(value = nil)
39
- @type = value unless value.nil?
40
- @type
41
- end
42
-
43
- def public(value = nil)
44
- @public = value unless value.nil?
45
- @public || false
46
- end
47
-
48
- def data(&block)
49
- @data = block if block_given?
50
- @data
51
- end
52
- end