Browse Source

Initialize command code and test

renovate/configure
Yota Toyama 8 years ago
parent
commit
9b9bd4e052
  1. 32
      .circleci/config.yml
  2. 3
      .gitignore
  3. 2
      Gemfile
  4. 44
      Gemfile.lock
  5. 1
      examples/aruba.rb
  6. 5
      examples/read.feature
  7. 4
      main.go
  8. 63
      rakefile.rb

32
.circleci/config.yml

@ -0,0 +1,32 @@
version: 2
jobs:
build:
docker:
- image: golang
working_directory: /go/src/github.com/raviqqe/linkcheck
steps:
- checkout
- run:
name: Setup
command: |
apt -y update --fix-missing
apt -y install rake
apt -y install bundler rake
- run:
name: Dependencies
command: rake deps
- run:
name: Lint
command: rake lint
- run:
name: Unit Test
command: rake unit_test
- run:
name: Command Test
command: rake command_test
- run:
name: Build
command: rake build
- run:
name: Install
command: rake install

3
.gitignore

@ -0,0 +1,3 @@
bin
coverage.txt
tmp

2
Gemfile

@ -0,0 +1,2 @@
source 'https://rubygems.org'
gem 'aruba', '~> 0.14.2'

44
Gemfile.lock

@ -0,0 +1,44 @@
GEM
remote: https://rubygems.org/
specs:
aruba (0.14.2)
childprocess (~> 0.5.6)
contracts (~> 0.9)
cucumber (>= 1.3.19)
ffi (~> 1.9.10)
rspec-expectations (>= 2.99)
thor (~> 0.19)
builder (3.2.3)
childprocess (0.5.9)
ffi (~> 1.0, >= 1.0.11)
contracts (0.16.0)
cucumber (2.4.0)
builder (>= 2.1.2)
cucumber-core (~> 1.5.0)
cucumber-wire (~> 0.0.1)
diff-lcs (>= 1.1.3)
gherkin (~> 4.0)
multi_json (>= 1.7.5, < 2.0)
multi_test (>= 0.1.2)
cucumber-core (1.5.0)
gherkin (~> 4.0)
cucumber-wire (0.0.1)
diff-lcs (1.3)
ffi (1.9.18)
gherkin (4.1.3)
multi_json (1.12.1)
multi_test (0.1.2)
rspec-expectations (3.6.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.6.0)
rspec-support (3.6.0)
thor (0.19.4)
PLATFORMS
ruby
DEPENDENCIES
aruba (~> 0.14.2)
BUNDLED WITH
1.15.0

1
examples/aruba.rb

@ -0,0 +1 @@
require 'aruba/cucumber'

5
examples/read.feature

@ -0,0 +1,5 @@
Feature: Markdown
Scenario: Check an empty markdown file
Given a file named "foo.md" with ""
When I successfully run `linkcheck foo.md`
Then the stdout should contain exactly ""

4
main.go

@ -0,0 +1,4 @@
package main
func main() {
}

63
rakefile.rb

@ -0,0 +1,63 @@
TOTAL_COVERAGE_FILE = 'coverage.txt'.freeze # This path is specified by codecov.
BIN_PATH = File.absolute_path 'bin'
task :deps do
sh 'go get github.com/alecthomas/gometalinter github.com/mattn/goveralls'
sh 'gometalinter --install'
sh 'go get -d -t ./...'
sh 'gem install rake rubocop'
end
task :build do
sh 'go build -o bin/linkcheck'
end
task :fast_unit_test do
sh 'go test ./...'
end
task :unit_test do
sh "go test -covermode atomic -coverprofile #{TOTAL_COVERAGE_FILE}"
end
task command_test: :build do
sh 'bundler install'
sh %W[bundler exec cucumber
-r examples/aruba.rb
PATH=#{BIN_PATH}:$PATH
examples].join ' '
end
task test: %i[unit_test command_test]
task :format do
sh 'go fix ./...'
sh 'go fmt ./...'
Dir.glob '**/*.go' do |file|
sh "goimports -w #{file}"
end
sh 'rubocop -a'
end
task :lint do
sh %w[gometalinter
--disable gocyclo
--disable vetshadow
--enable gofmt
--enable goimports
--enable misspell
./...].join ' '
sh 'rubocop'
end
task install: %i[deps test build] do
sh 'go get ./...'
end
task default: %i[test build]
task :clean do
sh 'git clean -dfx'
end
Loading…
Cancel
Save