Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterCamilleri committed Feb 5, 2016
0 parents commit 5ea8aa3
Show file tree
Hide file tree
Showing 10 changed files with 222 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/.bundle/
/.yardoc
/Gemfile.lock
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
*.bundle
*.so
*.o
*.a
mkmf.log
docs/.~lock.*
*.bat
*.zip
*.tmp
rdoc
test/tmp
test/version_tmp
tmp
temp.txt
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 ruby_sscanf.gemspec
gemspec
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Peter Camilleri

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

The ruby_sscanf gem monkey patches the String class to ass the sscanf instance
method. This method is modeled after the POSIX "C" standard sscanf but with
alterations and omissions to suit the Ruby programming language.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'ruby_sscanf'
```

And then execute:

$ bundle

Or install it yourself as:

$ gem install ruby_sscanf

## Usage

The basic usage for sscanf is:

```ruby
"<input string>".sscanf("<format string>")
```

<br>where the input string is a collection of formatted information and the
format string is a description of that format.

## Development

After checking out the repo, run `bin/setup` to install dependencies. You can
also run `bin/console` for an interactive prompt that will allow you to
experiment.

To install this gem onto your local machine, run `bundle exec rake install`.
To release a new version, update the version number in `version.rb`, and then
run `bundle exec rake release`, which will create a git tag for the version,
push git commits and tags, and push the `.gem` file to
[rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at
https://github.com/PeterCamilleri/ruby_sscanf.


## License

The gem is available as open source under the terms of the
[MIT License](http://opensource.org/licenses/MIT).

55 changes: 55 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env rake
# coding: utf-8

require 'rake/testtask'
require 'rdoc/task'
require "bundler/gem_tasks"

#Generate internal documentation with rdoc.
RDoc::Task.new do |rdoc|
rdoc.rdoc_dir = "rdoc"

#List out all the files to be documented.
rdoc.rdoc_files.include("lib/**/*.rb", "license.txt", "README.md")

#Make all access levels visible.
rdoc.options << '--visibility' << 'private'
#rdoc.options << '--verbose'
#rdoc.options << '--coverage-report'

#Set a title.
rdoc.options << '--title' << 'fOOrth Language Internals'

end

#Run the format_engine unit test suite.
Rake::TestTask.new do |t|
#List out all the test files.
t.test_files = FileList['tests/**/*.rb']
t.verbose = false
end

desc "Run a scan for smelly code!"
task :reek do |t|
`reek --no-color lib > reek.txt`
end

desc "Run an IRB Session with format_engine loaded."
task :console do
require 'irb'
require 'irb/completion'
require './lib/ruby_sscanf'
puts "Starting an IRB console with ruby_sscanf."
puts "Use 'quit' to exit."
puts
ARGV.clear
IRB.start
end

desc "What version of code is this?"
task :vers do |t|
puts
puts "ruby_sscanf version = #{RubySscanf::VERSION}"
end


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

require "bundler/setup"
require "ruby_sscanf"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start

require "irb"
IRB.start
8 changes: 8 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx

bundle install

# Do any other automated setup that you need to do here
5 changes: 5 additions & 0 deletions lib/ruby_sscanf.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require "ruby_sscanf/version"

module RubySscanf
# Your code goes here...
end
3 changes: 3 additions & 0 deletions lib/ruby_sscanf/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module RubySscanf
VERSION = "0.1.0"
end
33 changes: 33 additions & 0 deletions ruby_sscanf.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'ruby_sscanf/version'

Gem::Specification.new do |spec|
spec.name = "ruby_sscanf"
spec.version = RubySscanf::VERSION
spec.authors = ["Peter Camilleri"]
spec.email = ["peter.c.camilleri@gmail.com"]

spec.summary = "A string parser."
spec.description = "A formatted string data parser for Ruby"
spec.homepage = "http://teuthida-technologies.com/"
spec.license = "MIT"

raw_list = `git ls-files`.split($/)
spec.files = raw_list.keep_if {|entry| !entry.start_with?("docs") }
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.required_ruby_version = '>= 1.9.3'

spec.add_runtime_dependency "format_engine", ">= 0.5"

spec.add_development_dependency "bundler", "~> 1.11"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency 'minitest', "~> 5.5.1"
spec.add_development_dependency 'minitest_visible', "~> 0.0.1"
spec.add_development_dependency 'rdoc', "~> 4.0.1"

end

0 comments on commit 5ea8aa3

Please sign in to comment.