Skip to content

Commit

Permalink
Merge LTI2 reference.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrissler committed Apr 15, 2016
2 parents 09203e4 + 1032a53 commit cd00b78
Show file tree
Hide file tree
Showing 53 changed files with 1,024 additions and 18,147 deletions.
29 changes: 19 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
.bundle/
log/*.log
pkg/
spec/dummy/db/*.sqlite3
spec/dummy/db/*.sqlite3-journal
spec/dummy/config/database.yml
spec/dummy/log/*.log
spec/dummy/tmp/
spec/dummy/.sass-cache
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore all logfiles and tempfiles.
/log/*
!/log/.keep
/tmp

.idea
*.iml

1 change: 0 additions & 1 deletion .ruby-version

This file was deleted.

7 changes: 0 additions & 7 deletions CHANGELOG.md

This file was deleted.

3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ GEM
rspec-support (~> 3.1.0)
rspec-rails (3.1.0)
actionpack (>= 3.0)
activemodel (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.1.0)
Expand All @@ -134,6 +135,8 @@ GEM
sprockets (>= 2.8, < 4.0)
sqlite3 (1.3.9)
systemu (2.6.5)
sqlite3 (1.3.10)
systemu (2.6.5)
thor (0.19.1)
thread_safe (0.3.5)
tzinfo (1.2.2)
Expand Down
70 changes: 70 additions & 0 deletions LTI2-Reference.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="RUBY_MODULE" version="4">
<component name="FacetManager">
<facet type="RailsFacetType" name="Ruby on Rails">
<configuration>
<RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_SUPPORT_REMOVED" VALUE="false" />
<RAILS_FACET_CONFIG_ID NAME="RAILS_TESTS_SOURCES_PATCHED" VALUE="true" />
<RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_APPLICATION_ROOT" VALUE="$MODULE_DIR$" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/components" />
<excludeFolder url="file://$MODULE_DIR$/public/system" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="jdk" jdkName="rbenv: 2.1.4" jdkType="RUBY_SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="PriorityQueue (v0.1.2, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actionmailer (v4.1.10, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actionpack (v4.1.10, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actionview (v4.1.10, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activemodel (v4.1.10, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activerecord (v4.1.10, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activesupport (v4.1.10, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="arel (v5.0.1.20140414130214, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="builder (v3.2.2, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.10.6, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.2.5, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="erubis (v2.7.0, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="httparty (v0.13.1, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="i18n (v0.7.0, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="json (v1.8.2, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="jsonpath (v0.5.6, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="lrucache (v0.1.4, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="macaddr (v1.7.1, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mail (v2.6.3, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mime-types (v2.6.1, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.6.0, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="multi_json (v1.11.0, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="multi_xml (v0.5.5, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="oauth (v0.4.7, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rack (v1.5.2, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rack-test (v0.6.3, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rails (v4.2.4, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="railties (v4.1.10, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rake (v10.4.2, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rb-readline (v0.5.3, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v2.14.8, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v2.14.5, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v2.14.6, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rspec-rails (v3.2.1, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sprockets (v3.1.0, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sprockets-rails (v2.3.1, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sqlite3 (v1.3.11, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="systemu (v2.6.5, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="thor (v0.19.1, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.5, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.2, rbenv: 2.1.4) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="uuid (v2.3.8, rbenv: 2.1.4) [gem]" level="application" />
</component>
<component name="RModuleSettingsStorage">
<LOAD_PATH number="0" />
<I18N_FOLDERS number="1" string0="$MODULE_DIR$/config/locales" />
</component>
</module>
54 changes: 21 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@

LTI2 -- Ruby/Rails reference implementation
LTI2 Gem -- Ruby/Rails reference implementation
==============
__John Tibbetts, Integration Architect, Vital Source Technologies__

> #### Note the LTI2 gem and sample apps have been signficantly reorganized! The sample apps have been removed!
> #### The LTI2-Reference repo only contains the revised LTI2 gem
> #### The LTI2_tc_sample_app repo contains the Tool Consumer sample app
> #### The LTI2_tp_sample_app repo contains the Tool Provider sample app

This is Vital Source's LTI2 implementation. VST uses this code primarily as a Tool Provider. However there's also a Tool Consumer here that we've used for early testing (even before there were any LTI2 TCs). In addition we use the Tool Consumer for brokered LTI launches. This is used, say, in an interactive book that has been launched by an external Tool Consumer but contains dynamic pages within the book that, in turn, launch other LTI tools.

* It implements both sides of the LTI convesation; that is, Tool Consumer (often an LMS) and Tool Provider. These two components will work (out-of-the-box) with one another. Or the Tool Consumer can be aimed at an external Tool Provider (possibly in development) to test it. Or the Tool Provider can be addressed by an external Tool Consumer (possibly in development) to test it.

* As new facilities, messages, or services are added to LTI2 they will be added to this reference model. The intent is to add them in while they are still in development so that the LTI Services Task Force can see them in early operation.

* The actual LTI-specific TC and TP functionality are implemented as Rails mountable engines. A mountable engine is a type of gem that is used for creating a Rails 'sub-application'; that is, an application within an application. Each mountable engine has its own models, controller, etc. Common behavior of both engines is abstracted into a third gem: lti2-commons. A consequence of using this design modularity is that either one or both engines can also be mounted in real working production code. In particular, the Vital Source BusinessCenter incorporates the Tool Consumer engine to provide launches appropriate for viewing e-textbooks. It also incorporates the Tool Provider to allow new interactive e-textbooks to launch out of the book into other LTI tools, either provided by Vital Source, the book publisher, or anyone else.
* The actual LTI-specific TC and TP functionality are implemented as Rails mountable engines. A mountable engine is a type of gem that is used for creating a Rails 'sub-application'; that is, an application within an application. Each mountable engine has its own models, controller, etc. Both of these engines are embedded in the single parent gem. Common behavior of both engines is abstracted into the /lib folder. A consequence of using this design modularity is that either one or both engines can also be mounted in real working production code. In particular, the Vital Source BusinessCenter incorporates the Tool Consumer engine to provide launches appropriate for viewing e-textbooks. It also incorporates the Tool Provider to allow new interactive e-textbooks to launch out of the book into other LTI tools, either provided by Vital Source, the book publisher, or anyone else.

* The reference implementation contains sample applications that can either be run under sqlite3 or MySQL. Sample data is provided for each type of database.

Expand All @@ -22,50 +28,28 @@ Prerequisites

* Ruby/Rails. Follow online docs to install Ruby/Rails for your development platform. This code is currently built on Ruby 1.9.3.

* This code is in a github Vital Source public repo (LTI-Reference. Clone it in a work directory.
* This code is in a github Vital Source public repo 'LTI2-Reference'. Clone it in a work directory.

* Run bundler in subsdirectories tc_sample_app (the TC directory) and tp_sample_app (the TP directory).
* If you wish to use the sample Tool Consumer, clone 'LTI2_tc_sample_app. Then bundle.

* This code has been tested with either MySQL or sqlite. The default database load instructions will work for either of these databases. They would likely work with virtually any other Rails-compatible database.
* If you wish to use the sample Tool Provider, clone 'LTI2_tp_sample_app. Then bundle.

* This code has been tested with either MySQL or sqlite. The default database load instructions will work for either of these databases. They would likely work with virtually any other Rails-compatible database.

Structure of this repository
-----------------------------
The repository structure is as follows:

LTI2--
|
|
--closet (database backups, common scripts, metadata artifacts)
|
|
--lti2_tc (tool consumer engine)
|
|
--lti2_tp (tool provider engine)
|
|
--lib/lti2_commons (library used by both TC and TP)
|
|
--tc_sample_app (lightweight TC host based on active_admin gem)
|
--tp_sample_app (lightweight TP and tool)

Getting it running
==================

1. Clone the repo onto your machine.
1. Follow instructions above for cloning and building the three repos.

2. Create a command prompt for the tool consumer. chdir into <lti_repo>/tc_sample_app.
2. Create a command prompt for the tool consumer. chdir into <your_repo>/LTI2_tc_sample_app.

3. [FIRST-TIME ONLY after clone of TC] 'rake init_task:backup'. This will reset data to base state and ensure that sqlite3 is the current database. (Instructions below for changing to MySQL. Recommend running it first as sqlite3).

4. Start a rails server for the Tool Consumer on port 4000: 'rails s -p 4000'.

5. Create a command prompt for the tool provider. chdir into <lti_repo>/tp_sample_app.
5. Create a command prompt for the tool provider. chdir into <your_repo>/LTI2_tp_sample_app.

6. [FIRST-TIME ONLY after clone of TP] 'rake init_task:backup'. This will reset data to base state and ensure that sqlite3 is the current database. (Instructions below for changing to MySQL. Recommend running it first as sqlite3).

Expand Down Expand Up @@ -101,6 +85,8 @@ Changing your database configuration

__NOTE WELL: Default database choice has changed! It is now sqlite3, not MySQL__

__NOTE WELL: Both the TC and TP registries table has a base URL setting named tc_deployment_url and tp_deployment_url, respectively. Make sure these contain reasonable values for your environment. 'localhost' is handy for testing locally, but since these values are passed to their partners they may need to contain environment-specific, external URLs__

sqlite3 is built in and the data is prebuilt in github. This means that the TC and TP can be checked out and immediately run with no database prep.

If you'd prefer to use MySQL it's easy to switch.
Expand Down Expand Up @@ -152,9 +138,10 @@ As described above, this distribution uses tc_sample_app as a pseudo LMS. All o

2. At a rails command-line in the host, import the TC engine migrations into the db migrations of the host:
* rake lti2_tc:install:migrations
* rake db:migrate

3. In the host application's routes.rb, specify the mount point of the TC engine:
* mount Lti2Tc::Engine, :at => '/lti2_tc'
* mount Lti2Tc::Engine, :at => '/LTI2-Reference'

4. Implement the host responsibilities of the engine. The can be seen in exemplary code in the tc_sample_app.
* In the database table 'lti2_tc_registries': modify the tc_deployment_url to the base URL of your server.
Expand All @@ -169,10 +156,11 @@ Using the Tool Provider Engine with another host application
As described above, this distribution uses tp_sample_app as a pseudo tool provider. All of the LTI-specific behavior is mounted into this app using the Rails mountable engine capability. To use this same engine in another host application the following steps need to be followed.

1. The Gemfile of the host application should access the gem from VST github by including the line:
* gem 'lti2_tp', :github => 'vitalsource/lti2_tp'
* gem 'lti2_tp', :github => 'vitalsource/LTI2-Reference'

2. At a rails command-line in the host, import the TP engine migrations into the db migrations of the host:
* rake lti2_tp:install:migrations
* rake db:migrate

3. In the host application's routes.rb, specify the mount point of the TP engine:
* mount Lti2Tp::Engine, :at => '/lti2_tp'
Expand Down
Loading

0 comments on commit cd00b78

Please sign in to comment.