jive-add_on 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4be7d97437243712eff1183d857ad2def032287a
4
+ data.tar.gz: b29b48e46ea6fd6006af82e054f44bd635b1ab30
5
+ SHA512:
6
+ metadata.gz: 360cc6d99d5f3eb1d25f53fe211fb6ffbeb9714d5c1a401476d9a41929fc8068ee2d155e61237825f0b1343b4d6aedcff1fac0be1bb8aad23b3ad81094905d20
7
+ data.tar.gz: adc34e7733d492c3a658986212551f3043ed3eaa949ce34e05391d87ca8af9cb4f2dc991ae87ab8adedf5bc03c372a3d973bd01e5c4472ae310f3c673f620626
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.1
4
+ - 2.0.0
5
+ - 1.9.3
6
+ script: bundle exec rspec
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jive-add_on.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Butch Marshall
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,46 @@
1
+ [![Gem Version](https://badge.fury.io/rb/jive-add_on.svg)](http://badge.fury.io/rb/jive-add_on)
2
+ [![Build Status](https://travis-ci.org/butchmarshall/ruby-jive-add_on.svg?branch=master)](https://travis-ci.org/butchmarshall/ruby-jive-add_on)
3
+
4
+ # Jive::AddOn
5
+
6
+ An implemention of Jives AddOns using ActiveRecord.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'jive-add_on'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install jive-add_on
23
+
24
+ then run
25
+
26
+ ```ruby
27
+ rails generate jive:add_on:active_record
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ To the ActiveRecord model:
33
+
34
+ ```ruby
35
+ Jive::AddOn::Model.new(...)
36
+ ```
37
+
38
+ ## Contributing
39
+
40
+ Bug reports and pull requests are welcome on GitHub at https://github.com/butchmarshall/ruby-jive-add_on.
41
+
42
+
43
+ ## License
44
+
45
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
46
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "jive/add_on"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,37 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'jive/add_on/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "jive-add_on"
8
+ spec.version = Jive::AddOn::VERSION
9
+ spec.authors = ["Butch Marshall"]
10
+ spec.email = ["butch.a.marshall@gmail.com"]
11
+ spec.summary = "Jive AddOn functionality implemented using ActiveRecord."
12
+ spec.description = "Implements the functionality required for dealing with and storing Jive AddOns using ActiveRecord as a storage backend.}"
13
+ spec.homepage = "https://github.com/butchmarshall/ruby-jive-add_on"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "activerecord", [">= 3.0", "< 5.0"]
22
+ spec.add_dependency "jive-signed_request"
23
+
24
+ if RUBY_PLATFORM == 'java'
25
+ spec.add_development_dependency "jdbc-sqlite3", "> 0"
26
+ spec.add_development_dependency "activerecord-jdbcsqlite3-adapter", "> 0"
27
+ else
28
+ spec.add_development_dependency "sqlite3", "> 0"
29
+ end
30
+
31
+ spec.add_development_dependency "database_cleaner"
32
+ spec.add_development_dependency "factory_girl", "> 4.0"
33
+ spec.add_development_dependency "bundler", "~> 1.7"
34
+ spec.add_development_dependency "rake", "~> 10.0"
35
+
36
+ spec.add_development_dependency "rspec"
37
+ end
@@ -0,0 +1,24 @@
1
+ require "generators/jive/add_on/add_on_generator"
2
+ require "generators/jive/add_on/next_migration_version"
3
+ require "rails/generators/migration"
4
+ require "rails/generators/active_record"
5
+
6
+ # Extend the HasDynamicColumnsGenerator so that it creates an AR migration
7
+ module Jive
8
+ module AddOn
9
+ class ActiveRecordGenerator < ::Jive::AddOn::Generator
10
+ include Rails::Generators::Migration
11
+ extend NextMigrationVersion
12
+
13
+ source_paths << File.join(File.dirname(__FILE__), "templates")
14
+
15
+ def create_migration_file
16
+ migration_template "migration_0.1.0.rb", "db/migrate/add_jive_add_ons_0_1_0_migration.rb"
17
+ end
18
+
19
+ def self.next_migration_number(dirname)
20
+ ::ActiveRecord::Generators::Base.next_migration_number dirname
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,11 @@
1
+ require 'rails/generators/base'
2
+ require 'jive/add_on/compatibility'
3
+
4
+ module Jive
5
+ module AddOn
6
+ class Generator < Rails::Generators::Base
7
+ source_paths << File.join(File.dirname(__FILE__), 'templates')
8
+ end
9
+ end
10
+ end
11
+
@@ -0,0 +1,16 @@
1
+ module Jive
2
+ module AddOn
3
+ module NextMigrationVersion
4
+ # while methods have moved around this has been the implementation
5
+ # since ActiveRecord 3.0
6
+ def next_migration_number(dirname)
7
+ next_migration_number = current_migration_number(dirname) + 1
8
+ if ActiveRecord::Base.timestamped_migrations
9
+ [Time.now.utc.strftime("%Y%m%d%H%M%S"), format("%.14d", next_migration_number)].max
10
+ else
11
+ format("%.3d", next_migration_number)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,22 @@
1
+ class AddJiveAddOns010Migration < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :jive_add_ons do |t|
4
+ t.string :name
5
+ t.string :tenant_id
6
+ t.string :client_id
7
+ t.string :client_secret
8
+ t.string :jive_signature
9
+ t.string :jive_signature_url
10
+ t.string :jive_url
11
+ t.string :timestamp
12
+ t.boolean :uninstalled
13
+ t.integer :attempt
14
+
15
+ t.timestamps null: false
16
+ end
17
+ end
18
+
19
+ def self.down
20
+ drop_table :jive_add_ons
21
+ end
22
+ end
@@ -0,0 +1,29 @@
1
+ require 'jive/add_on/version'
2
+
3
+ module Jive
4
+ module AddOn
5
+ module Compatibility
6
+ if ActiveSupport::VERSION::MAJOR >= 4
7
+ require 'active_support/proxy_object'
8
+
9
+ def self.executable_prefix
10
+ 'bin'
11
+ end
12
+
13
+ def self.proxy_object_class
14
+ ActiveSupport::ProxyObject
15
+ end
16
+ else
17
+ require 'active_support/basic_object'
18
+
19
+ def self.executable_prefix
20
+ 'script'
21
+ end
22
+
23
+ def self.proxy_object_class
24
+ ActiveSupport::BasicObject
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,23 @@
1
+ module Jive
2
+ module AddOn
3
+ class Model < ActiveRecord::Base
4
+ self.table_name = :jive_add_ons
5
+ validate :validate_registration
6
+
7
+ private
8
+ def validate_registration
9
+ if !::Jive::SignedRequest.validate_registration({
10
+ clientId: self.client_id,
11
+ tenantId: self.tenant_id,
12
+ jiveSignatureURL: self.jive_signature_url,
13
+ clientSecret: self.client_secret,
14
+ jiveSignature: self.jive_signature,
15
+ jiveUrl: self.jive_url,
16
+ timestamp: self.timestamp,
17
+ })
18
+ errors.add(:base, "INVALID_JIVE_SIGNATURE")
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ module Jive
2
+ module AddOn
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,18 @@
1
+ require "active_support"
2
+ require "active_support/dependencies"
3
+ require "active_record"
4
+
5
+ require "jive/signed_request"
6
+
7
+ require "jive/add_on/version"
8
+ require "jive/add_on/compatibility"
9
+ require "jive/add_on/model"
10
+
11
+ module Jive
12
+ module AddOn
13
+ end
14
+ #def AddOn
15
+ # Jive::AddOn::Model
16
+ #end
17
+ #module_function :AddOn
18
+ end
metadata ADDED
@@ -0,0 +1,181 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jive-add_on
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Butch Marshall
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-01-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activerecord
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: jive-signed_request
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: sqlite3
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">"
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">"
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: database_cleaner
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: factory_girl
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">"
80
+ - !ruby/object:Gem::Version
81
+ version: '4.0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">"
87
+ - !ruby/object:Gem::Version
88
+ version: '4.0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: bundler
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '1.7'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '1.7'
103
+ - !ruby/object:Gem::Dependency
104
+ name: rake
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '10.0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '10.0'
117
+ - !ruby/object:Gem::Dependency
118
+ name: rspec
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ description: Implements the functionality required for dealing with and storing Jive
132
+ AddOns using ActiveRecord as a storage backend.}
133
+ email:
134
+ - butch.a.marshall@gmail.com
135
+ executables: []
136
+ extensions: []
137
+ extra_rdoc_files: []
138
+ files:
139
+ - ".gitignore"
140
+ - ".rspec"
141
+ - ".travis.yml"
142
+ - Gemfile
143
+ - LICENSE.txt
144
+ - README.md
145
+ - Rakefile
146
+ - bin/console
147
+ - bin/setup
148
+ - jive-add_on.gemspec
149
+ - lib/generators/jive/add_on/active_record_generator.rb
150
+ - lib/generators/jive/add_on/add_on_generator.rb
151
+ - lib/generators/jive/add_on/next_migration_version.rb
152
+ - lib/generators/jive/add_on/templates/migration_0.1.0.rb
153
+ - lib/jive/add_on.rb
154
+ - lib/jive/add_on/compatibility.rb
155
+ - lib/jive/add_on/model.rb
156
+ - lib/jive/add_on/version.rb
157
+ homepage: https://github.com/butchmarshall/ruby-jive-add_on
158
+ licenses:
159
+ - MIT
160
+ metadata: {}
161
+ post_install_message:
162
+ rdoc_options: []
163
+ require_paths:
164
+ - lib
165
+ required_ruby_version: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: '0'
170
+ required_rubygems_version: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ requirements: []
176
+ rubyforge_project:
177
+ rubygems_version: 2.4.8
178
+ signing_key:
179
+ specification_version: 4
180
+ summary: Jive AddOn functionality implemented using ActiveRecord.
181
+ test_files: []