Skip to content
This repository has been archived by the owner on Aug 25, 2023. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
xinhui committed Jan 27, 2016
0 parents commit b1fcbed
Show file tree
Hide file tree
Showing 82 changed files with 1,543 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.bundle/
log/*.log
pkg/
spec/test_app/db/*.sqlite3
spec/test_app/db/*.sqlite3-journal
spec/test_app/log/*.log
spec/test_app/tmp/
spec/test_app/.sass-cache
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--color
--require spec_helper
16 changes: 16 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
source 'https://rubygems.org'

# Declare your gem's dependencies in codifligne.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec

# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.

# To use a debugger
# gem 'byebug', group: [:development, :test]

gem "webmock", "~> 1.22.6" , group: [:test]
143 changes: 143 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
PATH
remote: .
specs:
codifligne (0.0.1)
rails (~> 4.2.5.1)

GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.5.1)
actionpack (= 4.2.5.1)
actionview (= 4.2.5.1)
activejob (= 4.2.5.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.5.1)
actionview (= 4.2.5.1)
activesupport (= 4.2.5.1)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.5.1)
activesupport (= 4.2.5.1)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (4.2.5.1)
activesupport (= 4.2.5.1)
globalid (>= 0.3.0)
activemodel (4.2.5.1)
activesupport (= 4.2.5.1)
builder (~> 3.1)
activerecord (4.2.5.1)
activemodel (= 4.2.5.1)
activesupport (= 4.2.5.1)
arel (~> 6.0)
activesupport (4.2.5.1)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.4.0)
arel (6.0.3)
awesome_print (1.6.1)
builder (3.2.2)
concurrent-ruby (1.0.0)
crack (0.4.3)
safe_yaml (~> 1.0.0)
diff-lcs (1.2.5)
erubis (2.7.0)
globalid (0.3.6)
activesupport (>= 4.1.0)
hashdiff (0.2.3)
i18n (0.7.0)
json (1.8.3)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
mime-types (2.99)
mini_portile2 (2.0.0)
minitest (5.8.4)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.5.1)
actionmailer (= 4.2.5.1)
actionpack (= 4.2.5.1)
actionview (= 4.2.5.1)
activejob (= 4.2.5.1)
activemodel (= 4.2.5.1)
activerecord (= 4.2.5.1)
activesupport (= 4.2.5.1)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.5.1)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.7)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (4.2.5.1)
actionpack (= 4.2.5.1)
activesupport (= 4.2.5.1)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.5.0)
rspec-core (3.1.7)
rspec-support (~> 3.1.0)
rspec-expectations (3.1.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.1.0)
rspec-mocks (3.1.3)
rspec-support (~> 3.1.0)
rspec-rails (3.1.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.1.0)
rspec-expectations (~> 3.1.0)
rspec-mocks (~> 3.1.0)
rspec-support (~> 3.1.0)
rspec-support (3.1.2)
safe_yaml (1.0.4)
sprockets (3.5.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.0.0)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.11)
thor (0.19.1)
thread_safe (0.3.5)
tzinfo (1.2.2)
thread_safe (~> 0.1)
webmock (1.22.6)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff

PLATFORMS
ruby

DEPENDENCIES
awesome_print (>= 1.6.1)
bundler (~> 1.11)
codifligne!
rake (~> 10.0)
rspec-rails
sqlite3
webmock (~> 1.22.6)

BUNDLED WITH
1.11.2
20 changes: 20 additions & 0 deletions MIT-LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright 2016 Xinhui

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3 changes: 3 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
= Codifligne

This project rocks and uses MIT-LICENSE.
19 changes: 19 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end

APP_RAKEFILE = File.expand_path("../spec/test_app/Rakefile", __FILE__)
load 'rails/tasks/engine.rake'
load 'rails/tasks/statistics.rake'

load 'lib/tasks/codifligne_tasks.rake'

begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
rescue LoadError
end

Bundler::GemHelper.install_tasks
Empty file.
13 changes: 13 additions & 0 deletions app/assets/javascripts/codifligne/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require_tree .
15 changes: 15 additions & 0 deletions app/assets/stylesheets/codifligne/application.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require_tree .
*= require_self
*/
4 changes: 4 additions & 0 deletions app/controllers/codifligne/application_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Codifligne
class ApplicationController < ActionController::Base
end
end
4 changes: 4 additions & 0 deletions app/helpers/codifligne/application_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Codifligne
module ApplicationHelper
end
end
10 changes: 10 additions & 0 deletions app/models/codifligne/line.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module Codifligne
class Line < ActiveRecord::Base
has_and_belongs_to_many :operators, :class_name => "Codifligne::Operator"

validates :name, presence: true
validates :stif_id, presence: true
validates :short_name, presence: true
validates :private_code, presence: true
end
end
8 changes: 8 additions & 0 deletions app/models/codifligne/operator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module Codifligne
class Operator < ActiveRecord::Base
has_and_belongs_to_many :lines, :class_name => "Codifligne::Line"

validates :name, presence: true
validates :stif_id, presence: true
end
end
12 changes: 12 additions & 0 deletions bin/rails
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.

ENGINE_ROOT = File.expand_path('../..', __FILE__)
ENGINE_PATH = File.expand_path('../../lib/codifligne/engine', __FILE__)

# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])

require 'rails/all'
require 'rails/engine/commands'
23 changes: 23 additions & 0 deletions codifligne.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
$:.push File.expand_path("../lib", __FILE__)

# Maintain your gem's version:
require "codifligne/version"

# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "codifligne"
s.version = Codifligne::VERSION
s.authors = ["Xinhui"]
s.email = ["[email protected]"]
s.summary = "A Ruby interface to STIF - Codifligne API."
s.license = "MIT"

s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]

s.add_dependency "rails", "~> 4.2.5.1"
s.add_development_dependency "sqlite3"
s.add_development_dependency "awesome_print", ">= 1.6.1"
s.add_development_dependency "bundler", "~> 1.11"
s.add_development_dependency "rake", "~> 10.0"
s.add_development_dependency "rspec-rails"
end
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Codifligne::Engine.routes.draw do
end
16 changes: 16 additions & 0 deletions db/migrate/20160127131654_create_codifligne_lines.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class CreateCodifligneLines < ActiveRecord::Migration
def change
create_table :codifligne_lines do |t|
t.string :stif_id
t.string :name
t.string :short_name
t.string :transport_mode
t.string :private_code
t.string :status

t.timestamps null: false
end

add_index :codifligne_lines, [:transport_mode, :status]
end
end
10 changes: 10 additions & 0 deletions db/migrate/20160127131729_create_codifligne_operators.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateCodifligneOperators < ActiveRecord::Migration
def change
create_table :codifligne_operators do |t|
t.string :stif_id
t.string :name

t.timestamps null: false
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class CreateCodifligneOperatorsLines < ActiveRecord::Migration
def change
create_table :codifligne_lines_operators do |t|
t.belongs_to :operator, index: true
t.belongs_to :line, index: true
end
end
end
Binary file added lib/.DS_Store
Binary file not shown.
9 changes: 9 additions & 0 deletions lib/codifligne.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require "open-uri"
require "nokogiri"

require "codifligne/engine"
require "codifligne/api"
require "codifligne/codifligne_error"

module Codifligne
end
Binary file added lib/codifligne/.DS_Store
Binary file not shown.
Loading

0 comments on commit b1fcbed

Please sign in to comment.