Skip to content

Commit

Permalink
Replaced hyphens with underscores in file and command names.
Browse files Browse the repository at this point in the history
Moved lib & model dirs to be under life_game_viewer dir.
Used bundle gem style of directory structure, etc.
Moved commands to main.rb.
Added version.rb.
Added Rakefile, Gemfile, and LICENSE.
  • Loading branch information
keithrbennett committed Sep 11, 2012
1 parent f746548 commit 10d6966
Show file tree
Hide file tree
Showing 22 changed files with 94 additions and 38 deletions.
4 changes: 4 additions & 0 deletions Gemfile
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in life_game_viewer.gemspec
gemspec
22 changes: 22 additions & 0 deletions LICENSE
@@ -0,0 +1,22 @@
Copyright (c) 2012 Keith Bennett

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.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -72,7 +72,7 @@ First, install the life-game-viewer gem. This installs a script that
you can then run on your command line:

```
life-view-sample
life_view_sample
```

You can experiment with different data sets by:
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
@@ -0,0 +1,2 @@
#!/usr/bin/env rake
require "bundler/gem_tasks"
11 changes: 0 additions & 11 deletions bin/life-view-sample

This file was deleted.

6 changes: 6 additions & 0 deletions bin/life_view_sample
@@ -0,0 +1,6 @@
#!/usr/bin/env jruby


require 'life_game_viewer'

LifeGameViewer::Main.view_sample
29 changes: 20 additions & 9 deletions lib/life_game_viewer.rb
@@ -1,16 +1,27 @@
#!/usr/bin/env ruby

#require_relative 'model/sample_life_model'
#require_relative 'view/life_table_model'
require_relative 'view/life_game_viewer_frame'

class LifeGameViewer
module LifeGameViewer

def self.view_sample
LifeGameViewerFrame.view_sample
unless /java$/ === RUBY_PLATFORM
puts "This program must be run in JRuby."
exit -1
end

def self.view(model)
LifeGameViewerFrame.new(model).visible = true
end
require 'java'

%w(
life_game_viewer/version.rb
life_game_viewer/model/life_calculator
life_game_viewer/model/life_visualizer
life_game_viewer/model/model_validation
life_game_viewer/model/sample_life_model
life_game_viewer/view/actions
life_game_viewer/view/clipboard_helper
life_game_viewer/view/generations
life_game_viewer/view/main
life_game_viewer/view/life_game_viewer_frame
life_game_viewer/view/life_table_model
).each { |file| require_relative(file) }

end
File renamed without changes.
File renamed without changes.
Expand Up @@ -34,7 +34,7 @@ def methods_missing(instance)
def methods_missing_message(instance)
missing_methods = methods_missing(instance)
missing_methods.empty? \
? nil
? nil \
: "Model is missing the following required methods: #{missing_methods.join(", ")}."
end
private
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions lib/life_game_viewer/version.rb
@@ -0,0 +1,3 @@
module LifeGameViewer
VERSION = "0.9.0"
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -191,7 +191,7 @@ def initialize
def initialize
@label = LifeLabel.new
image_spec = File.expand_path(File.join(
File.dirname(__FILE__), '..', '..', 'resources', 'images', 'alfred-e-neuman.jpg'))
File.dirname(__FILE__), '..', '..', '..', 'resources', 'images', 'alfred-e-neuman.jpg'))
@true_icon = ImageIcon.new(image_spec, 'Alfred E. Neuman')
end

Expand Down
File renamed without changes.
16 changes: 16 additions & 0 deletions lib/life_game_viewer/view/main.rb
@@ -0,0 +1,16 @@

# Main entry point into the application.
module LifeGameViewer
class Main


def self.view_sample
LifeGameViewerFrame.view_sample
end

def self.view(model)
LifeGameViewerFrame.new(model).visible = true
end

end
end
14 changes: 0 additions & 14 deletions life-game-viewer.gemspec

This file was deleted.

17 changes: 17 additions & 0 deletions life_game_viewer.gemspec
@@ -0,0 +1,17 @@
# -*- encoding: utf-8 -*-
require File.expand_path('../lib/life_game_viewer/version', __FILE__)

Gem::Specification.new do |gem|
gem.authors = ["Keith Bennett"]
gem.email = ["keithrbennett@gmail.com"]
gem.summary = "Game of Life Viewer"
gem.description = "Game of Life Viewer written in JRuby using Java Swing"
gem.homepage = 'https://github.com/keithrbennett/life_game_viewer'

gem.files = `git ls-files`.split($\)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.name = "life_game_viewer"
gem.require_paths = ["lib"]
gem.version = LifeGameViewer::VERSION
end
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
@@ -1 +1 @@
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib', 'life_game_viewer')

0 comments on commit 10d6966

Please sign in to comment.