Skip to content

Commit

Permalink
Merge 33fbff8 into fa38974
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbaudino committed Aug 13, 2017
2 parents fa38974 + 33fbff8 commit 831b81c
Show file tree
Hide file tree
Showing 55 changed files with 3,047 additions and 2,320 deletions.
18 changes: 18 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
engines:
duplication:
enabled: true
config:
languages:
- ruby
fixme:
enabled: false
rubocop:
enabled: true
brakeman:
enabled: false
ratings:
paths:
- "**.rb"
exclude_paths:
- spec/
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ pkg

# Ignore Bundler config
/.bundle
/vendor/bundle/

# Ignore built gems
/*.gem

# YARD doc stuff
/.yardoc
/doc/
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
20 changes: 20 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
AllCops:
TargetRubyVersion: 2.4

Style/StringLiterals:
EnforcedStyle: double_quotes
Enabled: true

Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes
Enabled: true

Style/Documentation:
Enabled: false

Metrics/LineLength:
Max: 100

Metrics/BlockLength:
Exclude:
- spec/**/*.rb
13 changes: 11 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
language: ruby
cache: bundler
dist: trusty
rvm:
- ruby-2.0
- ruby-2.1
- ruby-2.2
- ruby-2.3.0
- rbx
- ruby-2.3
- ruby-2.4
- rbx-3.84
- jruby
before_install:
- gem update --system
- gem update bundler
before_script:
- bundle exec rubocop -D
notifications:
email:
on_success: change
on_failure: change
1 change: 1 addition & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib/addic7ed/models/**/*.rb
16 changes: 9 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
source 'https://rubygems.org'
# frozen_string_literal: true

source "https://rubygems.org"
# The gem's dependencies will be specified in addic7ed.gemspec
gemspec

group :test do
gem 'coveralls', require: false
gem "coveralls", require: false
end

platforms :rbx do
gem 'json'
gem 'racc'
gem 'rubysl'
gem 'psych'
gem 'iconv'
gem "iconv"
gem "json"
gem "psych"
gem "racc"
gem "rubysl"
end
37 changes: 31 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,44 @@
# addic7ed-ruby

[![Build Status](https://api.travis-ci.org/michaelbaudino/addic7ed-ruby.svg?branch=master)](https://travis-ci.org/michaelbaudino/addic7ed-ruby)
[![Build Status](https://api.travis-ci.org/michaelbaudino/addic7ed-ruby.svg?branch=full-rewrite)](https://travis-ci.org/michaelbaudino/addic7ed-ruby)
[![Dependency Status](https://gemnasium.com/michaelbaudino/addic7ed-ruby.svg?travis)](https://gemnasium.com/michaelbaudino/addic7ed-ruby)
[![Code Climate](https://codeclimate.com/github/michaelbaudino/addic7ed-ruby.svg)](https://codeclimate.com/github/michaelbaudino/addic7ed-ruby)
[![Coverage Status](https://coveralls.io/repos/michaelbaudino/addic7ed-ruby/badge.svg?branch=master)](https://coveralls.io/r/michaelbaudino/addic7ed-ruby)
[![Gem Version](https://badge.fury.io/rb/addic7ed.svg)](http://badge.fury.io/rb/addic7ed)
[![security](https://hakiri.io/github/michaelbaudino/addic7ed-ruby/master.svg)](https://hakiri.io/github/michaelbaudino/addic7ed-ruby/master)


Ruby command-line script to fetch subtitles on Addic7ed
[![Inline docs](http://inch-ci.org/github/michaelbaudino/addic7ed-ruby.svg?branch=full-rewrite)](http://inch-ci.org/github/michaelbaudino/addic7ed-ruby?branch=full-rewrite)

Fetch TV shows subtitles on Addic7ed using Ruby.

### Refactoring TODO list

* [x] move download logic to a service object
* [x] add a new `Search` model
* [x] move compatibility logic to a `CheckCompatibility` service object
* [x] create a `SubtitlesCollection` class to hold and filter subtitles
* [x] move best subtitle logic to `SubtitlesCollection`
* [x] rename `Subtitle#via` to `Subtitle#source`
* [x] refactor how `Episode` holds `Subtitle`s
* [x] rename `ShowList` and make it a service object
* [x] write code documentation
* [x] Configure GitHub hook for [RubyDoc](http://www.rubydoc.info)
* [ ] move CLI to a separate gem (and use Thor or similar)
* [ ] update README to include only API stuff
* [x] add `bin/console`
* [x] remove `bin/addic7ed`
* [ ] move all `to_s` and `to_inspect` methods to the CLI
* [ ] refactor errors (to match Ruby errors hierarchy and maybe allow both bang-erroring and not-erroring versions of public API methods)
* [ ] refactor how HI works (allow both "no HI", "force HI" and "don't care")
* [x] use symbols rather than strings for languages
* [x] add Rubocop
* [x] move user agents and languages to a config file
* [ ] add specs for parsing
* [ ] Create a `Dockerfile` for the CLI

### Is it working ?

Until next time Addic7ed break their HTML/CSS structure, yes :smile:
As long as Addic7ed HTML/CSS structure remains the same: yes :smile:

### How to use it ?

Expand Down Expand Up @@ -74,7 +99,7 @@ Don't get mad, they have to pay for their servers, you know.

Ho, and by the way, please, **please**: do not hammer their servers, play fair !

### Roadmap
### Contribution ideas

There's some work remaining:
- Support registered users
Expand Down
8 changes: 5 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
require 'rspec/core/rake_task'
# frozen_string_literal: true

require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

task :default => :spec
task default: :spec

require 'bundler'
require "bundler"
Bundler::GemHelper.install_tasks
17 changes: 9 additions & 8 deletions addic7ed.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
$:.push File.expand_path("../lib", __FILE__)
# frozen_string_literal: true

$LOAD_PATH.push File.expand_path("../lib", __FILE__)

require "addic7ed/version"

Expand All @@ -16,14 +18,13 @@ Gem::Specification.new do |s|
s.add_development_dependency("rake")
s.add_development_dependency("webmock")
s.add_development_dependency("pry")
s.add_development_dependency("rubocop")
s.add_development_dependency("inch")
s.add_development_dependency("yard")

s.add_runtime_dependency("oga", "~> 2.7")
s.add_runtime_dependency("json", "~> 1.8.3")
s.add_runtime_dependency("oga", "~> 2.7")

s.executables = ["addic7ed"]
s.files = `git ls-files -- lib/* LICENSE.md`.split("\n")
s.test_files = `git ls-files -- spec/*`.split("\n")
s.files = `git ls-files -z lib LICENSE.md`.split("\x0")
s.require_paths = ["lib"]
s.has_rdoc = false
s.license = "MIT"
s.license = "MIT"
end
144 changes: 0 additions & 144 deletions bin/addic7ed

This file was deleted.

13 changes: 13 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
Bundler.require(:default, ENV["RACK_ENV"] || :development)

APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), ".."))

$LOAD_PATH.unshift File.expand_path("lib", APP_ROOT)

require "addic7ed"

Pry.start
17 changes: 7 additions & 10 deletions lib/addic7ed.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
require 'addic7ed/version'
require 'addic7ed/common'
require 'addic7ed/services/addic7ed_version_normalizer'
require 'addic7ed/services/addic7ed_comment_normalizer'
require 'addic7ed/errors'
require 'addic7ed/show_list'
require 'addic7ed/video_file'
require 'addic7ed/episode'
require 'addic7ed/subtitle'
require 'addic7ed/parser'
# frozen_string_literal: true

Dir[
File.join(File.dirname(__FILE__), "addic7ed/*.rb"),
File.join(File.dirname(__FILE__), "addic7ed/services/**/*.rb"),
File.join(File.dirname(__FILE__), "addic7ed/models/**/*.rb")
].each { |file| require file }

0 comments on commit 831b81c

Please sign in to comment.