zemax 0.2.0 → 2.3.4.bui2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/HISTORY CHANGED
@@ -1,4 +1,4 @@
1
- == 1.0.0 / 2010-04-10
1
+ == 1.0.0 / 2010-04-12
2
2
 
3
3
  * 1 major enhancement
4
4
  * Birthday!
data/Rakefile CHANGED
@@ -1,5 +1,15 @@
1
- $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
2
- require "zemax"
1
+ require 'pathname'
2
+ NAME = 'zemax'
3
+ p BASE_DIR = Pathname.new(__FILE__).dirname
4
+ p LIB_DIR = BASE_DIR + 'lib'
5
+ p PKG_DIR = BASE_DIR + 'pkg'
6
+ p DOC_DIR = BASE_DIR + 'rdoc'
7
+
8
+ $LOAD_PATH.unshift LIB_DIR
9
+ require NAME
10
+
11
+ CLASS_NAME = Zemax
12
+ VERSION = CLASS_NAME::VERSION
3
13
 
4
14
  begin
5
15
  require 'rake'
@@ -12,5 +22,3 @@ end
12
22
  # Load rakefile tasks
13
23
  Dir['tasks/*.rake'].sort.each { |file| load file }
14
24
 
15
- #task :default => 'test:run'
16
- #task 'gem:release' => 'test:run'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 2.3.4.bui2
data/bin/zemax CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'pathname'
4
- require Pathname.new(__FILE__).dirname + '/../lib/zemax'
4
+ require Pathname.new(__FILE__).dirname + '../lib/zemax'
5
5
 
6
6
  # Put your code here
7
7
 
data/lib/zemax.rb CHANGED
@@ -4,26 +4,18 @@ module Zemax
4
4
  VERSION_FILE = Pathname.new(__FILE__).dirname + '../VERSION' # :nodoc:
5
5
  VERSION = VERSION_FILE.exist? ? VERSION_FILE.read.strip : nil
6
6
 
7
- # Require ruby source file(s). Lib should be either file name or glob
7
+ # Requires ruby source file(s). Accepts either single filename/glob or Array of filenames/globs.
8
8
  # Accepts following options:
9
- # :file:: Libs are required relative to this file - defaults to __FILE__
10
- # :dir:: Required libs are located under this dir name - defaults to gem name
11
- #
12
- def self.require_lib( lib, opts={} )
13
- file = Pathname.new(opts[:file] || __FILE__)
14
- name = file.dirname + (opts[:dir] || file.basename('.*')) + lib.gsub(/(?<!.rb)$/, '.rb')
15
- Pathname.glob(name.to_s).sort.each {|rb| require rb}
16
- end
17
-
18
- # Requires ruby source file(s). Accepts either single name or Array of filenames/globs
19
- # Accepts following options:
20
- # :file:: Libs are required relative to this file - defaults to __FILE__
21
- # :dir:: Required libs are located under this dir name - defaults to gem name
9
+ # :*file*:: Lib(s) required relative to this file - defaults to __FILE__
10
+ # :*dir*:: Required lib(s) located under this dir name - defaults to gem name
22
11
  #
23
12
  def self.require_libs( libs, opts={} )
24
- [libs].flatten.each {|lib| require_lib lib, opts }
13
+ file = Pathname.new(opts[:file] || __FILE__)
14
+ [libs].flatten.each do |lib|
15
+ name = file.dirname + (opts[:dir] || file.basename('.*')) + lib.gsub(/(?<!.rb)$/, '.rb')
16
+ Pathname.glob(name.to_s).sort.each {|rb| require rb}
17
+ end
25
18
  end
26
-
27
19
  end # module Zemax
28
20
 
29
21
  # Require all ruby source files located under directory lib/zemax
data/tasks/common.rake CHANGED
@@ -1,3 +1,6 @@
1
+ #task :default => 'test:run'
2
+ #task 'gem:release' => 'test:run'
3
+
1
4
  #task :build do
2
5
  # system "gem build zemax.gemspec"
3
6
  #end
data/tasks/doc.rake ADDED
@@ -0,0 +1,12 @@
1
+ desc 'Alias to doc:rdoc'
2
+ task :doc => 'doc:rdoc'
3
+
4
+ namespace :doc do
5
+ require 'rake/rdoctask'
6
+ Rake::RDocTask.new do |rdoc|
7
+ rdoc.rdoc_dir = DOC_DIR.basename.to_s
8
+ rdoc.title = "#{NAME} #{VERSION} Documentation"
9
+ rdoc.rdoc_files.include('README*')
10
+ rdoc.rdoc_files.include('lib/**/*.rb')
11
+ end
12
+ end
data/tasks/gem.rake CHANGED
@@ -1,11 +1,36 @@
1
- task :build do
2
- system "gem build zemax.gemspec"
3
- end
1
+ desc 'Alias to gem:release'
2
+ task :release => 'gem:release'
4
3
 
5
- task :install => :build do
6
- system "gem install zemax-#{Zemax::VERSION}"
7
- end
4
+ desc 'Alias to gem:build'
5
+ task :gem => 'gem:build'
8
6
 
9
- task :release => :build do
10
- system "gem push zemax-#{Zemax::VERSION}.gem"
7
+ namespace :gem do
8
+ gem_file = "#{NAME}-#{VERSION}.gem"
9
+
10
+ desc '(Re-)Build gem'
11
+ task :build do
12
+ puts "Remove existing gem package"
13
+ rm_rf PKG_DIR
14
+ puts "Build new gem package"
15
+ system "gem build #{NAME}.gemspec"
16
+ puts "Move built gem to package dir"
17
+ mkdir_p PKG_DIR
18
+ mv gem_file, PKG_DIR
19
+ end
20
+
21
+ desc 'Cleanup already installed gem(s)'
22
+ task :cleanup do
23
+ puts "Cleaning up installed gem(s)"
24
+ system "gem cleanup #{NAME}"
25
+ end
26
+
27
+ desc 'Build and install gem'
28
+ task :install => :build do
29
+ system "gem install #{PKG_DIR}/#{gem_file}"
30
+ end
31
+
32
+ desc 'Build and push gem to Gemcutter'
33
+ task :release => :build do
34
+ system "gem push #{PKG_DIR}/#{gem_file}"
35
+ end
11
36
  end
@@ -0,0 +1,67 @@
1
+ class Version
2
+ attr_accessor :major, :minor, :patch, :build
3
+
4
+ def initialize(version_string)
5
+ raise "Invalid version #{version_string}" unless version_string =~ /^(\d+)\.(\d+)\.(\d+)(?:\.(.*?))?$/
6
+ @major = $1.to_i
7
+ @minor = $2.to_i
8
+ @patch = $3.to_i
9
+ @build = $4
10
+ end
11
+
12
+ def bump_major(x)
13
+ @major += x.to_i
14
+ @minor = 0
15
+ @patch = 0
16
+ @build = nil
17
+ end
18
+
19
+ def bump_minor(x)
20
+ @minor += x.to_i
21
+ @patch = 0
22
+ @build = nil
23
+ end
24
+
25
+ def bump_patch(x)
26
+ @patch += x.to_i
27
+ @build = nil
28
+ end
29
+
30
+ def update(major, minor, patch, build=nil)
31
+ @major = major
32
+ @minor = minor
33
+ @patch = patch
34
+ @build = build
35
+ end
36
+
37
+ def write
38
+ CLASS_NAME::VERSION_FILE.open('w') {|file| file.puts to_s }
39
+ end
40
+
41
+ def to_s
42
+ [major, minor, patch, build].compact.join('.')
43
+ end
44
+ end
45
+
46
+ desc 'Set version: [x.y.z] - explicitly, [1/10/100] - bump major/minor/patch, [.build] - build'
47
+ task :version, [:command] do |t, args|
48
+ version = Version.new(VERSION)
49
+ case args.command
50
+ when /^(\d+)\.(\d+)\.(\d+)(?:\.(.*?))?$/ # Set version explicitly
51
+ version.update($1, $2, $3, $4)
52
+ when /^(\.(.*?))$/ # Set build
53
+ version.build = $1
54
+ when /^(\d{1})$/ # Bump patch
55
+ version.bump_patch $1
56
+ when /^(\d{1})0$/ # Bump minor
57
+ version.bump_minor $1
58
+ when /^(\d{1}00)$/ # Bump major
59
+ version.bump_major $1
60
+ else # Unknown command, just display VERSION
61
+ puts "#{NAME} #{version}"
62
+ next
63
+ end
64
+
65
+ puts "Writing version #{version} to VERSION file"
66
+ version.write
67
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zemax
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ prerelease: true
5
5
  segments:
6
- - 0
7
6
  - 2
8
- - 0
9
- version: 0.2.0
7
+ - 3
8
+ - 4
9
+ - bui2
10
+ version: 2.3.4.bui2
10
11
  platform: ruby
11
12
  authors:
12
13
  - arvicco
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-04-10 00:00:00 +04:00
18
+ date: 2010-04-12 00:00:00 +04:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
@@ -59,7 +60,9 @@ files:
59
60
  - spec/spec_helper.rb
60
61
  - spec/zemax_spec.rb
61
62
  - tasks/common.rake
63
+ - tasks/doc.rake
62
64
  - tasks/gem.rake
65
+ - tasks/version.rake
63
66
  - Rakefile
64
67
  - README.rdoc
65
68
  - LICENSE
@@ -83,11 +86,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
83
86
  version: "0"
84
87
  required_rubygems_version: !ruby/object:Gem::Requirement
85
88
  requirements:
86
- - - ">="
89
+ - - ">"
87
90
  - !ruby/object:Gem::Version
88
91
  segments:
89
- - 0
90
- version: "0"
92
+ - 1
93
+ - 3
94
+ - 1
95
+ version: 1.3.1
91
96
  requirements: []
92
97
 
93
98
  rubyforge_project: