Skip to content

Commit

Permalink
plugin structure
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriomazzeo committed Aug 2, 2016
0 parents commit 189f952
Show file tree
Hide file tree
Showing 15 changed files with 405 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
pkg
.idea/
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: ruby
cache:
directories:
- bundle

rvm:
- 2.0
- 2.1.3
- 2.3.1

script:
- bundle exec rake spec

notifications:
email: false
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in danger-podliblint.gemspec
gemspec
113 changes: 113 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
PATH
remote: .
specs:
danger-podliblint (0.0.1)
danger (~> 2.0)

GEM
remote: https://rubygems.org/
specs:
addressable (2.4.0)
claide (1.0.0)
claide-plugins (0.9.1)
cork
nap
open4 (~> 1.3)
coderay (1.1.1)
colored (1.2)
cork (0.1.0)
colored (~> 1.2)
danger (2.1.1)
claide (~> 1.0)
claide-plugins (> 0.9.0)
colored (~> 1.2)
cork (~> 0.1)
faraday (~> 0)
faraday-http-cache (~> 1.0)
git (~> 1)
kramdown (~> 1.5)
octokit (~> 4.2)
terminal-table (~> 1)
diff-lcs (1.2.5)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
faraday-http-cache (1.3.0)
faraday (~> 0.8)
ffi (1.9.14)
formatador (0.2.5)
git (1.3.0)
guard (2.14.0)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
lumberjack (~> 1.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-compat (1.2.1)
guard-rspec (4.7.3)
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
kramdown (1.11.1)
listen (3.0.7)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9.7)
lumberjack (1.0.10)
method_source (0.8.2)
multipart-post (2.0.0)
nap (1.1.0)
nenv (0.3.0)
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
octokit (4.3.0)
sawyer (~> 0.7.0, >= 0.5.3)
open4 (1.3.4)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rake (10.5.0)
rb-fsevent (0.9.7)
rb-inotify (0.9.7)
ffi (>= 0.5.0)
rspec (3.5.0)
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0)
rspec-core (3.5.2)
rspec-support (~> 3.5.0)
rspec-expectations (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-mocks (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-support (3.5.0)
sawyer (0.7.0)
addressable (>= 2.3.5, < 2.5)
faraday (~> 0.8, < 0.10)
shellany (0.0.1)
slop (3.6.0)
terminal-table (1.6.0)
thor (0.19.1)
yard (0.9.5)

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 1.3)
danger-podliblint!
guard (~> 2.14)
guard-rspec (~> 4.7)
listen (= 3.0.7)
pry
rake (~> 10.0)
rspec (~> 3.4)
yard (~> 0.8)

BUNDLED WITH
1.12.5
19 changes: 19 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# A guardfile for making Danger Plugins
# For more info see https://github.com/guard/guard#readme

# To run, use `bundle exec guard`.

guard :rspec, cmd: 'bundle exec rspec' do
require 'guard/rspec/dsl'
dsl = Guard::RSpec::Dsl.new(self)

# RSpec files
rspec = dsl.rspec
watch(rspec.spec_helper) { rspec.spec_dir }
watch(rspec.spec_support) { rspec.spec_dir }
watch(rspec.spec_files)

# Ruby files
ruby = dsl.ruby
dsl.watch_spec_files_for(ruby.lib_files)
end
22 changes: 22 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (c) 2016 Valerio Mazzeo

MIT License

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.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# danger-podliblint

[![Gem Version](https://badge.fury.io/rb/danger-podliblint.svg)](https://badge.fury.io/rb/danger-podliblint) [![Build Status](https://travis-ci.org/valeriomazzeo/danger-podliblint.svg?branch=master)](https://travis-ci.org/valeriomazzeo/danger-podliblint)

A Danger plugin for Pod lib lint.

## Installation

$ gem install danger-podliblint

## Usage

If a log file is specified `lint` will parse it, otherwise it will execute `pod lib lint` and parse the output.

# Optionally specify a log file:
podliblint.log_file = "/tmp/podliblint.log"

# Lint
podliblint.lint

## Development

1. Clone this repo
2. Run `bundle install` to setup dependencies.
3. Run `bundle exec rake spec` to run the tests.
4. Use `bundle exec guard` to automatically have tests run as you make changes.
5. Make your changes.
16 changes: 16 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'

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

task default: :specs

task :spec do
Rake::Task['specs'].invoke
Rake::Task['spec_docs'].invoke
end

desc 'Ensure that the plugin passes `danger plugins lint`'
task :spec_docs do
sh 'bundle exec danger plugins lint'
end
47 changes: 47 additions & 0 deletions danger-podliblint.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'podliblint/gem_version.rb'

Gem::Specification.new do |spec|
spec.name = 'danger-podliblint'
spec.version = Podliblint::VERSION
spec.authors = ['Valerio Mazzeo']
spec.email = ['[email protected]']
spec.description = %q{A Danger plugin for Pod lib lint.}
spec.summary = %q{A Danger plugin for Pod lib lint.}
spec.homepage = 'https://github.com/valeriomazzeo/danger-podliblint'
spec.license = 'MIT'

spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']

spec.add_runtime_dependency 'danger', '~>2.0'
spec.add_runtime_dependency 'cocoapods'

# General ruby development
spec.add_development_dependency 'bundler', '~> 1.3'
spec.add_development_dependency 'rake', '~> 10.0'

# Testing support
spec.add_development_dependency 'rspec', '~> 3.4'

# Linting code and docs
spec.add_development_dependency "yard", "~> 0.8"

# Makes testing easy via `bundle exec guard`
spec.add_development_dependency 'guard', '~> 2.14'
spec.add_development_dependency 'guard-rspec', '~> 4.7'

# If you want to work on older builds of ruby
spec.add_development_dependency 'listen', '3.0.7'

# This gives you the chance to run a REPL inside your test
# via
# require 'pry'
# binding.pry
# This will stop test execution and let you inspect the results
spec.add_development_dependency 'pry'
end
1 change: 1 addition & 0 deletions lib/danger_plugin.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require 'podliblint/plugin'
1 change: 1 addition & 0 deletions lib/danger_podliblint.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require 'podliblint/gem_version'
3 changes: 3 additions & 0 deletions lib/podliblint/gem_version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Podliblint
VERSION = "0.0.1".freeze
end
54 changes: 54 additions & 0 deletions lib/podliblint/plugin.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
module Danger
# A Danger plugin for Pod lib lint.
#
# @example Ensure pod lib lint executes correctly
#
# If a log file is specified `lint` will parse it,
# otherwise it will execute `pod lib lint` and parse the output.
#
# # Optionally specify a log file:
# podliblint.log_file = "/tmp/podliblint.log"
#
# # Lint
# podliblint.lint
#
# @see valeriomazzeo/danger-podliblint
# @tags pod, lib, lint, cocoapods
#
class DangerPodliblint < Plugin

def initialize(arg)
super
@warning_count = 0
@error_count = 0
@test_failures_count = 0
end

# Allows you to specify a pod lib lint log file location to parse.
attr_accessor :log_file

# Parses and exposes eventual warnings.
# @return [warning_count]
#
def lint

data = nil

if @log_file?
data = File.open(@log_file).read
else
require 'cocoapods'
data = pod lib lint
end

end

def lint(data)

end

def self.instance_name
to_s.gsub("Danger", "").danger_underscore.split("/").last
end
end
end
21 changes: 21 additions & 0 deletions spec/podliblint_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require File.expand_path('../spec_helper', __FILE__)

module Danger
describe Danger::DangerPodliblint do
it 'should be a plugin' do
expect(Danger::DangerPodliblint.new(nil)).to be_a Danger::Plugin
end

describe 'with Dangerfile' do
before do
@dangerfile = testing_dangerfile
@podliblint = @dangerfile.podliblint
end

it "is parses data" do

end

end
end
end
Loading

0 comments on commit 189f952

Please sign in to comment.