maestrano-connector-rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +1 -0
- data/DEVELOPER.md +10 -0
- data/Gemfile +18 -0
- data/Gemfile.lock +222 -0
- data/LICENSE +21 -0
- data/README.md +138 -0
- data/Rakefile +37 -0
- data/VERSION +1 -0
- data/app/controllers/maestrano/account/group_users_controller.rb +20 -0
- data/app/controllers/maestrano/account/groups_controller.rb +22 -0
- data/app/controllers/maestrano/application_controller.rb +7 -0
- data/app/controllers/maestrano/auth/saml_controller.rb +31 -0
- data/app/controllers/maestrano/sessions_controller.rb +15 -0
- data/app/helpers/maestrano/connector/rails/session_helper.rb +17 -0
- data/app/jobs/maestrano/connector/rails/synchronization_job.rb +49 -0
- data/app/models/maestrano/connector/rails/complex_entity.rb +175 -0
- data/app/models/maestrano/connector/rails/concerns/entity.rb +231 -0
- data/app/models/maestrano/connector/rails/concerns/external.rb +13 -0
- data/app/models/maestrano/connector/rails/connector_logger.rb +9 -0
- data/app/models/maestrano/connector/rails/entity.rb +5 -0
- data/app/models/maestrano/connector/rails/external.rb +5 -0
- data/app/models/maestrano/connector/rails/id_map.rb +6 -0
- data/app/models/maestrano/connector/rails/organization.rb +60 -0
- data/app/models/maestrano/connector/rails/sub_entity_base.rb +32 -0
- data/app/models/maestrano/connector/rails/synchronization.rb +38 -0
- data/app/models/maestrano/connector/rails/user.rb +25 -0
- data/app/models/maestrano/connector/rails/user_organization_rel.rb +9 -0
- data/bin/rails +12 -0
- data/config/routes.rb +28 -0
- data/db/migrate/20151122162100_create_maestrano_connector_rails_users.rb +16 -0
- data/db/migrate/20151122162414_create_maestrano_connector_rails_organizations.rb +21 -0
- data/db/migrate/20151122162613_create_maestrano_connector_rails_user_organization_rels.rb +12 -0
- data/db/migrate/20151122163325_create_maestrano_connector_rails_synchronizations.rb +13 -0
- data/db/migrate/20151122163449_create_maestrano_connector_rails_id_maps.rb +18 -0
- data/lib/generators/connector/USAGE +2 -0
- data/lib/generators/connector/complex_entity_generator.rb +19 -0
- data/lib/generators/connector/install_generator.rb +70 -0
- data/lib/generators/connector/templates/admin_controller.rb +48 -0
- data/lib/generators/connector/templates/admin_index.html.erb +51 -0
- data/lib/generators/connector/templates/complex_entity_example/contact.rb +22 -0
- data/lib/generators/connector/templates/complex_entity_example/contact_and_lead.rb +56 -0
- data/lib/generators/connector/templates/complex_entity_example/contact_mapper.rb +17 -0
- data/lib/generators/connector/templates/complex_entity_example/lead.rb +22 -0
- data/lib/generators/connector/templates/complex_entity_example/lead_mapper.rb +15 -0
- data/lib/generators/connector/templates/complex_entity_example/person.rb +23 -0
- data/lib/generators/connector/templates/contact_and_lead.rb +55 -0
- data/lib/generators/connector/templates/entity.rb +48 -0
- data/lib/generators/connector/templates/example_entity.rb +26 -0
- data/lib/generators/connector/templates/external.rb +19 -0
- data/lib/generators/connector/templates/home_controller.rb +17 -0
- data/lib/generators/connector/templates/home_index.html.erb +42 -0
- data/lib/generators/connector/templates/oauth_controller.rb +45 -0
- data/lib/maestrano-connector-rails.rb +1 -0
- data/lib/maestrano/connector/rails.rb +13 -0
- data/maestrano-connector-rails.gemspec +197 -0
- data/maestrano.png +0 -0
- data/spec/dummy/README.md +1 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/admin_controller.rb +48 -0
- data/spec/dummy/app/controllers/application_controller.rb +8 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/controllers/home_controller.rb +17 -0
- data/spec/dummy/app/controllers/oauth_controller.rb +45 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/entities/example_entitiy.rb +26 -0
- data/spec/dummy/app/models/maestrano/connector/rails/entity.rb +10 -0
- data/spec/dummy/app/models/maestrano/connector/rails/external.rb +11 -0
- data/spec/dummy/app/views/admin/index.html.erb +51 -0
- data/spec/dummy/app/views/home/index.html.erb +36 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +26 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/maestrano.rb +135 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +9 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20151209134445_create_maestrano_connector_rails_users.maestrano_connector_rails.rb +17 -0
- data/spec/dummy/db/migrate/20151209134446_create_maestrano_connector_rails_organizations.maestrano_connector_rails.rb +22 -0
- data/spec/dummy/db/migrate/20151209134447_create_maestrano_connector_rails_user_organization_rels.maestrano_connector_rails.rb +13 -0
- data/spec/dummy/db/migrate/20151209134448_create_maestrano_connector_rails_synchronizations.maestrano_connector_rails.rb +14 -0
- data/spec/dummy/db/migrate/20151209134449_create_maestrano_connector_rails_id_maps.maestrano_connector_rails.rb +19 -0
- data/spec/dummy/db/schema.rb +83 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories.rb +33 -0
- data/spec/jobs/syncrhonization_job_spec.rb +53 -0
- data/spec/models/complex_entity_spec.rb +353 -0
- data/spec/models/connector_logger_spec.rb +21 -0
- data/spec/models/entity_spec.rb +457 -0
- data/spec/models/external_spec.rb +15 -0
- data/spec/models/id_map_spec.rb +12 -0
- data/spec/models/organizaztion_spec.rb +105 -0
- data/spec/models/sub_entity_base_spec.rb +51 -0
- data/spec/models/synchronization_spec.rb +75 -0
- data/spec/models/user_organization_rel_spec.rb +14 -0
- data/spec/models/user_spec.rb +15 -0
- data/spec/spec_helper.rb +19 -0
- metadata +327 -0
@@ -0,0 +1,60 @@
|
|
1
|
+
module Maestrano::Connector::Rails
|
2
|
+
class Organization < ActiveRecord::Base
|
3
|
+
# Enable Maestrano for this group
|
4
|
+
maestrano_group_via :provider, :uid, :tenant do |group, maestrano|
|
5
|
+
group.name = (maestrano.name.blank? ? "Default Group name" : maestrano.name)
|
6
|
+
group.tenant = 'default' # To be set from SSO parameter
|
7
|
+
#group.country_alpha2 = maestrano.country
|
8
|
+
#group.free_trial_end_at = maestrano.free_trial_end_at
|
9
|
+
#group.some_required_field = 'some-appropriate-default-value'
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
super
|
14
|
+
self.synchronized_entities = {}
|
15
|
+
Entity.entities_list.each do |entity|
|
16
|
+
self.synchronized_entities[entity.to_sym] = true
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
#===================================
|
21
|
+
# Associations
|
22
|
+
#===================================
|
23
|
+
has_many :user_organization_rels
|
24
|
+
has_many :users, through: :user_organization_rels
|
25
|
+
|
26
|
+
#===================================
|
27
|
+
# Validation
|
28
|
+
#===================================
|
29
|
+
validates :name, presence: true
|
30
|
+
validates :tenant, presence: true
|
31
|
+
|
32
|
+
#===================================
|
33
|
+
# Serialized field
|
34
|
+
#===================================
|
35
|
+
serialize :synchronized_entities
|
36
|
+
|
37
|
+
def add_member(user)
|
38
|
+
if self.tenant == user.tenant && !self.member?(user)
|
39
|
+
self.user_organization_rels.create(user:user)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def member?(user)
|
44
|
+
self.user_organization_rels.where(user_id:user.id).count > 0
|
45
|
+
end
|
46
|
+
|
47
|
+
def remove_member(user)
|
48
|
+
self.user_organization_rels.where(user_id:user.id).delete_all
|
49
|
+
end
|
50
|
+
|
51
|
+
def from_omniauth(auth)
|
52
|
+
self.oauth_provider = auth.provider
|
53
|
+
self.oauth_uid = auth.uid
|
54
|
+
self.oauth_token = auth.credentials.token
|
55
|
+
self.refresh_token = auth.credentials.refresh_token
|
56
|
+
self.instance_url = auth.credentials.instance_url
|
57
|
+
self.save!
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Maestrano::Connector::Rails
|
2
|
+
class SubEntityBase < Entity
|
3
|
+
|
4
|
+
def external?
|
5
|
+
raise "Not implemented"
|
6
|
+
end
|
7
|
+
|
8
|
+
def entity_name
|
9
|
+
raise "Not implemented"
|
10
|
+
end
|
11
|
+
|
12
|
+
def map_to(name, entity, organization)
|
13
|
+
raise "Not implemented"
|
14
|
+
end
|
15
|
+
|
16
|
+
def external_entity_name
|
17
|
+
if self.external?
|
18
|
+
self.entity_name
|
19
|
+
else
|
20
|
+
raise "Forbidden call"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def connec_entity_name
|
25
|
+
if self.external?
|
26
|
+
raise "Forbidden call"
|
27
|
+
else
|
28
|
+
self.entity_name
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Maestrano::Connector::Rails
|
2
|
+
class Synchronization < ActiveRecord::Base
|
3
|
+
#===================================
|
4
|
+
# Associations
|
5
|
+
#===================================
|
6
|
+
belongs_to :organization
|
7
|
+
|
8
|
+
validates :status, presence: true
|
9
|
+
|
10
|
+
def is_running?
|
11
|
+
self.status == 'RUNNING'
|
12
|
+
end
|
13
|
+
|
14
|
+
def is_error?
|
15
|
+
self.status == 'ERROR'
|
16
|
+
end
|
17
|
+
|
18
|
+
def is_success?
|
19
|
+
self.status == 'SUCCESS'
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.create_running(organization)
|
23
|
+
Synchronization.create(organization_id: organization.id, status: 'RUNNING')
|
24
|
+
end
|
25
|
+
|
26
|
+
def set_success
|
27
|
+
self.update_attributes(status: 'SUCCESS')
|
28
|
+
end
|
29
|
+
|
30
|
+
def set_error(msg)
|
31
|
+
self.update_attributes(status: 'ERROR', message: msg)
|
32
|
+
end
|
33
|
+
|
34
|
+
def set_partial
|
35
|
+
self.update_attributes(partial: true)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Maestrano::Connector::Rails
|
2
|
+
class User < ActiveRecord::Base
|
3
|
+
# Enable Maestrano for this user
|
4
|
+
maestrano_user_via :provider, :uid, :tenant do |user, maestrano|
|
5
|
+
user.uid = maestrano.uid
|
6
|
+
user.provider = maestrano.provider
|
7
|
+
user.first_name = maestrano.first_name
|
8
|
+
user.last_name = maestrano.last_name
|
9
|
+
user.email = maestrano.email
|
10
|
+
user.tenant = 'default' # To be set from SSO parameter
|
11
|
+
end
|
12
|
+
|
13
|
+
#===================================
|
14
|
+
# Associations
|
15
|
+
#===================================
|
16
|
+
has_many :user_organization_rels
|
17
|
+
has_many :organizations, through: :user_organization_rels
|
18
|
+
|
19
|
+
#===================================
|
20
|
+
# Validation
|
21
|
+
#===================================
|
22
|
+
validates :email, presence: true
|
23
|
+
validates :tenant, presence: true
|
24
|
+
end
|
25
|
+
end
|
data/bin/rails
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
|
3
|
+
|
4
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
5
|
+
ENGINE_PATH = File.expand_path('../../lib/maestrano/connector/rails.rb', __FILE__)
|
6
|
+
|
7
|
+
# Set up gems listed in the Gemfile.
|
8
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
9
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
10
|
+
|
11
|
+
require 'rails/all'
|
12
|
+
require 'rails/engine/commands'
|
data/config/routes.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
Maestrano::Connector::Rails::Engine.routes.draw do
|
2
|
+
maestrano_routes
|
3
|
+
|
4
|
+
#--------------------------------------------------------------------
|
5
|
+
# Maintainability issue
|
6
|
+
# Should use maestrano_routes but it creates a scoping error with the metadata routes
|
7
|
+
# get '/maestrano/metadata', to: '/maestrano/rails/metadata#index'
|
8
|
+
# get '/maestrano/metadata/:tenant', to: '/maestrano/rails/metadata#index', as: 'tenant'
|
9
|
+
|
10
|
+
# namespace :maestrano do
|
11
|
+
# namespace :auth do
|
12
|
+
# resources :saml, only:[] do
|
13
|
+
# get 'init', on: :collection
|
14
|
+
# get 'init/:tenant', on: :collection, to: 'saml#init', as: 'tenant'
|
15
|
+
# post 'consume', on: :collection
|
16
|
+
# end
|
17
|
+
# end
|
18
|
+
|
19
|
+
# namespace :account do
|
20
|
+
# resources :groups, only: [:destroy] do
|
21
|
+
# resources :users, only: [:destroy], controller: 'group_users'
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
# end
|
25
|
+
#--------------------------------------------------------------------
|
26
|
+
|
27
|
+
match 'signout', to: 'sessions#destroy', as: 'signout', via: [:get, :post]
|
28
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateMaestranoConnectorRailsUsers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :maestrano_connector_rails_users do |t|
|
4
|
+
t.string :provider
|
5
|
+
t.string :uid
|
6
|
+
t.string :first_name
|
7
|
+
t.string :last_name
|
8
|
+
t.string :email
|
9
|
+
t.string :tenant
|
10
|
+
|
11
|
+
t.timestamps null: false
|
12
|
+
end
|
13
|
+
|
14
|
+
add_index :maestrano_connector_rails_users, [:uid, :tenant], name: 'user_uid_index'
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class CreateMaestranoConnectorRailsOrganizations < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :maestrano_connector_rails_organizations do |t|
|
4
|
+
t.string :provider
|
5
|
+
t.string :uid
|
6
|
+
t.string :name
|
7
|
+
t.string :tenant
|
8
|
+
|
9
|
+
t.string :oauth_provider
|
10
|
+
t.string :oauth_uid
|
11
|
+
t.string :oauth_token
|
12
|
+
t.string :refresh_token
|
13
|
+
t.string :instance_url
|
14
|
+
|
15
|
+
t.string :synchronized_entities
|
16
|
+
|
17
|
+
t.timestamps null: false
|
18
|
+
end
|
19
|
+
add_index :maestrano_connector_rails_organizations, [:uid, :tenant], name: 'orga_uid_index'
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateMaestranoConnectorRailsUserOrganizationRels < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :maestrano_connector_rails_user_organization_rels do |t|
|
4
|
+
t.integer :user_id
|
5
|
+
t.integer :organization_id
|
6
|
+
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
add_index :maestrano_connector_rails_user_organization_rels, :organization_id, name: 'rels_orga_index'
|
10
|
+
add_index :maestrano_connector_rails_user_organization_rels, :user_id, name: 'rels_user_index'
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateMaestranoConnectorRailsSynchronizations < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :maestrano_connector_rails_synchronizations do |t|
|
4
|
+
t.integer :organization_id
|
5
|
+
t.string :status
|
6
|
+
t.text :message
|
7
|
+
t.boolean :partial, default: false
|
8
|
+
|
9
|
+
t.timestamps null: false
|
10
|
+
end
|
11
|
+
add_index :maestrano_connector_rails_synchronizations, :organization_id, name: 'synchronization_orga_id_index'
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateMaestranoConnectorRailsIdMaps < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :maestrano_connector_rails_id_maps do |t|
|
4
|
+
t.string :connec_id
|
5
|
+
t.string :connec_entity
|
6
|
+
t.string :external_id
|
7
|
+
t.string :external_entity
|
8
|
+
t.integer :organization_id
|
9
|
+
t.datetime :last_push_to_connec
|
10
|
+
t.datetime :last_push_to_external
|
11
|
+
|
12
|
+
t.timestamps null: false
|
13
|
+
end
|
14
|
+
add_index :maestrano_connector_rails_id_maps, [:connec_id, :connec_entity, :organization_id], name: 'idmap_connec_index'
|
15
|
+
add_index :maestrano_connector_rails_id_maps, [:external_id, :external_entity, :organization_id], name: 'idmap_external_index'
|
16
|
+
add_index :maestrano_connector_rails_id_maps, :organization_id, name: 'idmap_organization_index'
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Connector
|
2
|
+
module Generators
|
3
|
+
class ComplexEntityGenerator < ::Rails::Generators::Base
|
4
|
+
source_root File.expand_path("../templates", __FILE__)
|
5
|
+
|
6
|
+
def copy_example_files
|
7
|
+
copy_file 'complex_entity_example/contact_and_lead.rb', 'app/models/entities/example_contact_and_lead.rb'
|
8
|
+
|
9
|
+
copy_file 'complex_entity_example/contact.rb', 'app/models/entities/sub_entities/example_contact.rb'
|
10
|
+
copy_file 'complex_entity_example/contact_mapper.rb', 'app/models/entities/sub_entities/example_contact_mapper.rb'
|
11
|
+
|
12
|
+
copy_file 'complex_entity_example/lead.rb', 'app/models/entities/sub_entities/example_lead.rb'
|
13
|
+
copy_file 'complex_entity_example/lead_mapper.rb', 'app/models/entities/sub_entities/example_lead_mapper.rb'
|
14
|
+
|
15
|
+
copy_file 'complex_entity_example/person.rb', 'app/models/entities/sub_entities/example_person.rb'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Connector
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < ::Rails::Generators::Base
|
4
|
+
source_root File.expand_path("../templates", __FILE__)
|
5
|
+
|
6
|
+
def maestrano_generator
|
7
|
+
#Temporary
|
8
|
+
# generate 'maestrano:initializer'
|
9
|
+
end
|
10
|
+
|
11
|
+
def include_helpers
|
12
|
+
sentinel = 'class ApplicationController < ActionController::Base'
|
13
|
+
code_lines = [
|
14
|
+
"helper Maestrano::Connector::Rails::Engine.helpers",
|
15
|
+
"include Maestrano::Connector::Rails::SessionHelper"
|
16
|
+
]
|
17
|
+
|
18
|
+
in_root do
|
19
|
+
gsub_file 'app/controllers/application_controller.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
|
20
|
+
"#{match}\n #{code_lines.join("\n ")}\n"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def include_routes
|
26
|
+
sentinel = 'Rails.application.routes.draw do'
|
27
|
+
code_lines = [
|
28
|
+
"mount Maestrano::Connector::Rails::Engine, at: '/'\n",
|
29
|
+
"root 'home#index'",
|
30
|
+
"get 'home/index' => 'home#index'",
|
31
|
+
"get 'admin/index' => 'admin#index'",
|
32
|
+
"put 'admin/update' => 'admin#update'",
|
33
|
+
"post 'admin/synchronize' => 'admin#synchronize'"
|
34
|
+
]
|
35
|
+
|
36
|
+
in_root do
|
37
|
+
gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
|
38
|
+
"#{match}\n #{code_lines.join("\n ")}\n"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def copy_entity
|
44
|
+
copy_file 'entity.rb', 'app/models/maestrano/connector/rails/entity.rb'
|
45
|
+
end
|
46
|
+
|
47
|
+
def copy_external
|
48
|
+
copy_file 'external.rb', 'app/models/maestrano/connector/rails/external.rb'
|
49
|
+
end
|
50
|
+
|
51
|
+
def copy_example_entity
|
52
|
+
copy_file 'example_entity.rb', 'app/models/entities/example_entitiy.rb'
|
53
|
+
end
|
54
|
+
|
55
|
+
def copy_home
|
56
|
+
copy_file 'home_controller.rb', 'app/controllers/home_controller.rb'
|
57
|
+
copy_file 'home_index.html.erb', 'app/views/home/index.html.erb'
|
58
|
+
end
|
59
|
+
|
60
|
+
def copy_admin_view
|
61
|
+
copy_file 'admin_controller.rb', 'app/controllers/admin_controller.rb'
|
62
|
+
copy_file 'admin_index.html.erb', 'app/views/admin/index.html.erb'
|
63
|
+
end
|
64
|
+
|
65
|
+
def copy_oauth_controller
|
66
|
+
copy_file 'oauth_controller.rb', 'app/controllers/oauth_controller.rb'
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|