saddler 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9dd3cae47008a75ae80a3981523f7d032b358aa8
4
- data.tar.gz: 4a74dcc120b0e80b16f645ea7a2748650e86fa4b
3
+ metadata.gz: c0f001bda35125b041d894da07196b1fbfaa9e8e
4
+ data.tar.gz: 717514af9b6c3bfbf43a2ac60d7dd66e3d22dc4d
5
5
  SHA512:
6
- metadata.gz: 2b31d17efdd5d2d107d55e1257416829f9ced81fe9e12f8e11491ddbb00278cefecdcadf101d14cf11f5da541f72d6fb4a2d9e212c317cee3997bc4c9d4a0ea8
7
- data.tar.gz: 08c216c7c48a19fa5b5f7edf8702d88aaec8219493be5355a4f2e0b2d497bee50ac740fe051777cb5bf1d0732ba5bdb745dbbcac2bde79109bd65dd0a40906fe
6
+ metadata.gz: 02e77eaaa3b3588b4155a02b5a0c43864626d3c6f5f93ac8cc216e11966ef06d8f79d316de85d988d14dfa48ae516a82934c154ccb63e2965ae4922582bc3987
7
+ data.tar.gz: 9c53e08d4b77d59e179cf40a9e4c9e0fcb32df9c725366750995f539f86bc8ac0eacfe7950413ee13c6b9a5b471ed881abe98364eedeb313602b2d87d1d6c273
@@ -0,0 +1,17 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'bundle_bin/*'
4
+ - 'vendor/bundle/**/*'
5
+
6
+ Style/Documentation:
7
+ Enabled: false
8
+
9
+ Metrics/LineLength:
10
+ Max: 100
11
+
12
+ Style/FileName:
13
+ Exclude:
14
+ - exe/*
15
+
16
+ Style/RegexpLiteral:
17
+ MaxSlashes: 0
@@ -1,3 +1,15 @@
1
1
  language: ruby
2
+ sudo: false
2
3
  rvm:
3
- - 2.2.0
4
+ - 1.9
5
+ - 2.0
6
+ - 2.1
7
+ - 2.2
8
+ before_install:
9
+ - gem update bundler
10
+ notifications:
11
+ email:
12
+ - ogataken@gmail.com
13
+ branches:
14
+ only:
15
+ - master
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # Saddler
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/saddler`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ [![Gem Version](http://img.shields.io/gem/v/saddler.svg?style=flat)](http://badge.fury.io/rb/saddler)
4
+ [![Build Status](http://img.shields.io/travis/packsaddle/ruby-saddler/master.svg?style=flat)](https://travis-ci.org/packsaddle/ruby-saddler)
6
5
 
7
6
  ## Installation
8
7
 
@@ -32,7 +31,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
31
 
33
32
  ## Contributing
34
33
 
35
- 1. Fork it ( https://github.com/[my-github-username]/saddler/fork )
34
+ 1. Fork it ( https://github.com/packsaddle/ruby-saddler/fork )
36
35
  2. Create your feature branch (`git checkout -b my-new-feature`)
37
36
  3. Commit your changes (`git commit -am 'Add some feature'`)
38
37
  4. Push to the branch (`git push origin my-new-feature`)
data/Rakefile CHANGED
@@ -1,9 +1,9 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
3
 
4
4
  Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
5
+ t.libs << 'test'
6
+ t.test_files = FileList['test/**/test*.rb']
6
7
  end
7
8
 
8
- task :default => :test
9
-
9
+ task default: :test
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "saddler"
3
+ require 'bundler/setup'
4
+ require 'saddler'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +10,5 @@ require "saddler"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start
@@ -1,3 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "saddler"
3
+ require 'saddler'
4
+ require 'saddler/cli'
5
+ Saddler::CLI.start(ARGV)
@@ -1,4 +1,5 @@
1
- require "saddler/version"
1
+ require 'saddler/version'
2
+ require 'saddler/reporter'
2
3
 
3
4
  module Saddler
4
5
  # Your code goes here...
@@ -0,0 +1,47 @@
1
+ require 'thor'
2
+
3
+ module Saddler
4
+ class CLI < Thor
5
+ def self.exit_on_failure?
6
+ true
7
+ end
8
+
9
+ desc 'version', 'Show the Saddler version'
10
+ map %w(-v --version) => :version
11
+
12
+ def version
13
+ puts "Saddler version #{::Saddler::VERSION}"
14
+ end
15
+
16
+ desc 'report', 'Exec Report'
17
+ option :data
18
+ option :file
19
+ option :repo
20
+ option :require
21
+ option :reporter
22
+ def report
23
+ data = \
24
+ if options[:data]
25
+ options[:data]
26
+ elsif options[:file]
27
+ File.read(options[:file])
28
+ elsif !$stdin.tty?
29
+ ARGV.clear
30
+ ARGF.read
31
+ end
32
+
33
+ abort('no input') if !data || data.empty?
34
+
35
+ pass_options = {}
36
+ pass_options[:repo] = options[:repo] if options[:repo]
37
+
38
+ require options[:require] if options[:require]
39
+ if(options[:reporter])
40
+ reporter = ::Saddler::Reporter.add_reporter(options[:reporter], $stdout)
41
+ end
42
+
43
+ abort('no reporter') unless reporter
44
+ reporter.report(data, pass_options)
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,19 @@
1
+ module Saddler
2
+ module Reporter
3
+ def self.add_reporter(reporter_type, output = nil)
4
+ reporter = custom_reporter_class(reporter_type)
5
+ output = $stdout unless output
6
+ reporter.new(output)
7
+ end
8
+
9
+ # Copy from rubocop:
10
+ # lib/rubocop/formatter/formatter_set.rb
11
+ def self.custom_reporter_class(specified_class_name)
12
+ constant_names = specified_class_name.split('::')
13
+ constant_names.shift if constant_names.first.empty?
14
+ constant_names.reduce(Object) do |namespace, constant_name|
15
+ namespace.const_get(constant_name, false)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module Saddler
2
- VERSION = "0.0.1"
2
+ VERSION = '0.0.2'
3
3
  end
@@ -4,22 +4,25 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'saddler/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "saddler"
7
+ spec.name = 'saddler'
8
8
  spec.version = Saddler::VERSION
9
- spec.authors = ["sanemat"]
10
- spec.email = ["o.gata.ken@gmail.com"]
9
+ spec.authors = ['sanemat']
10
+ spec.email = ['o.gata.ken@gmail.com']
11
11
 
12
- spec.summary = %q{Saddler.}
13
- spec.description = %q{Saddler.}
14
- spec.homepage = "https://github.com/packsaddle/ruby-saddler"
15
- spec.license = "MIT"
12
+ spec.summary = 'Saddler.'
13
+ spec.description = 'Saddler.'
14
+ spec.homepage = 'https://github.com/packsaddle/ruby-saddler'
15
+ spec.license = 'MIT'
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.bindir = "exe"
18
+ spec.bindir = 'exe'
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
20
+ spec.require_paths = ['lib']
21
21
 
22
- spec.add_development_dependency "bundler", "~> 1.8"
23
- spec.add_development_dependency "rake", "~> 10.0"
24
- spec.add_development_dependency "minitest"
22
+ spec.add_runtime_dependency 'thor'
23
+ spec.add_runtime_dependency 'saddler-reporter-text'
24
+
25
+ spec.add_development_dependency 'bundler', '~> 1.8'
26
+ spec.add_development_dependency 'rake', '~> 10.0'
27
+ spec.add_development_dependency 'minitest'
25
28
  end
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saddler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sanemat
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-02-17 00:00:00.000000000 Z
11
+ date: 2015-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: saddler-reporter-text
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: bundler
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -61,6 +89,7 @@ extensions: []
61
89
  extra_rdoc_files: []
62
90
  files:
63
91
  - ".gitignore"
92
+ - ".rubocop.yml"
64
93
  - ".travis.yml"
65
94
  - CODE_OF_CONDUCT.md
66
95
  - Gemfile
@@ -71,6 +100,8 @@ files:
71
100
  - bin/setup
72
101
  - exe/saddler
73
102
  - lib/saddler.rb
103
+ - lib/saddler/cli.rb
104
+ - lib/saddler/reporter.rb
74
105
  - lib/saddler/version.rb
75
106
  - saddler.gemspec
76
107
  homepage: https://github.com/packsaddle/ruby-saddler