zemax 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +4 -0
- data/LICENSE +20 -20
- data/README.rdoc +26 -17
- data/Rakefile +16 -57
- data/VERSION +1 -1
- data/bin/zemax +7 -0
- data/lib/zemax.rb +32 -1
- data/spec/spec.opts +1 -1
- data/spec/spec_helper.rb +18 -190
- data/spec/zemax_spec.rb +7 -0
- data/tasks/common.rake +11 -0
- data/tasks/gem.rake +11 -0
- metadata +41 -46
- data/.document +0 -5
- data/.gitignore +0 -21
- data/bin/git_hub +0 -7
- data/features/step_definitions/zemax_steps.rb +0 -0
- data/features/support/env.rb +0 -4
- data/features/zemax.feature +0 -9
- data/lib/git_hub.rb +0 -48
- data/lib/git_hub/api.rb +0 -39
- data/lib/git_hub/base.rb +0 -50
- data/lib/git_hub/repo.rb +0 -155
- data/spec/git_hub/api_spec.rb +0 -99
- data/spec/git_hub/base_spec.rb +0 -47
- data/spec/git_hub/repo_spec.rb +0 -247
- data/spec/stubs/repos/create.res +0 -24
- data/spec/stubs/repos/delete/new_repo.1.res +0 -14
- data/spec/stubs/repos/delete/new_repo.2.res +0 -14
- data/spec/stubs/repos/search/joe+repo.res +0 -54
- data/spec/stubs/repos/show/joe007.res +0 -44
- data/spec/stubs/repos/show/joe007/err_repo.res +0 -14
- data/spec/stubs/repos/show/joe007/fine_repo.res +0 -24
- data/spec/stubs/repos/show/joe007/new_repo.res +0 -24
- data/zemax.gemspec +0 -80
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zemax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 0.2.0
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- arvicco
|
@@ -9,68 +14,57 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-
|
13
|
-
default_executable:
|
17
|
+
date: 2010-04-10 00:00:00 +04:00
|
18
|
+
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: rspec
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 2
|
30
|
+
- 9
|
23
31
|
version: 1.2.9
|
24
|
-
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id001
|
25
34
|
- !ruby/object:Gem::Dependency
|
26
35
|
name: cucumber
|
27
|
-
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
38
|
requirements:
|
31
39
|
- - ">="
|
32
40
|
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
33
43
|
version: "0"
|
34
|
-
|
35
|
-
|
44
|
+
type: :development
|
45
|
+
version_requirements: *id002
|
46
|
+
description: Describe package zemax
|
36
47
|
email: arvitallian@gmail.com
|
37
48
|
executables:
|
38
|
-
-
|
49
|
+
- zemax
|
39
50
|
extensions: []
|
40
51
|
|
41
52
|
extra_rdoc_files:
|
42
53
|
- LICENSE
|
43
54
|
- README.rdoc
|
44
55
|
files:
|
45
|
-
-
|
46
|
-
- .gitignore
|
47
|
-
- LICENSE
|
48
|
-
- README.rdoc
|
49
|
-
- Rakefile
|
50
|
-
- VERSION
|
51
|
-
- bin/git_hub
|
52
|
-
- features/step_definitions/zemax_steps.rb
|
53
|
-
- features/support/env.rb
|
54
|
-
- features/zemax.feature
|
55
|
-
- lib/git_hub.rb
|
56
|
-
- lib/git_hub/api.rb
|
57
|
-
- lib/git_hub/base.rb
|
58
|
-
- lib/git_hub/repo.rb
|
56
|
+
- bin/zemax
|
59
57
|
- lib/zemax.rb
|
60
|
-
- spec/git_hub/api_spec.rb
|
61
|
-
- spec/git_hub/base_spec.rb
|
62
|
-
- spec/git_hub/repo_spec.rb
|
63
58
|
- spec/spec.opts
|
64
59
|
- spec/spec_helper.rb
|
65
|
-
- spec/
|
66
|
-
-
|
67
|
-
-
|
68
|
-
-
|
69
|
-
-
|
70
|
-
-
|
71
|
-
-
|
72
|
-
-
|
73
|
-
- zemax.gemspec
|
60
|
+
- spec/zemax_spec.rb
|
61
|
+
- tasks/common.rake
|
62
|
+
- tasks/gem.rake
|
63
|
+
- Rakefile
|
64
|
+
- README.rdoc
|
65
|
+
- LICENSE
|
66
|
+
- VERSION
|
67
|
+
- HISTORY
|
74
68
|
has_rdoc: true
|
75
69
|
homepage: http://github.com/arvicco/zemax
|
76
70
|
licenses: []
|
@@ -84,23 +78,24 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
84
78
|
requirements:
|
85
79
|
- - ">="
|
86
80
|
- !ruby/object:Gem::Version
|
81
|
+
segments:
|
82
|
+
- 0
|
87
83
|
version: "0"
|
88
|
-
version:
|
89
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
85
|
requirements:
|
91
86
|
- - ">="
|
92
87
|
- !ruby/object:Gem::Version
|
88
|
+
segments:
|
89
|
+
- 0
|
93
90
|
version: "0"
|
94
|
-
version:
|
95
91
|
requirements: []
|
96
92
|
|
97
93
|
rubyforge_project:
|
98
|
-
rubygems_version: 1.3.
|
94
|
+
rubygems_version: 1.3.6
|
99
95
|
signing_key:
|
100
96
|
specification_version: 3
|
101
|
-
summary:
|
97
|
+
summary: Describe package zemax
|
102
98
|
test_files:
|
103
|
-
- spec/
|
104
|
-
- spec/git_hub/base_spec.rb
|
105
|
-
- spec/git_hub/repo_spec.rb
|
99
|
+
- spec/spec.opts
|
106
100
|
- spec/spec_helper.rb
|
101
|
+
- spec/zemax_spec.rb
|
data/.document
DELETED
data/.gitignore
DELETED
data/bin/git_hub
DELETED
File without changes
|
data/features/support/env.rb
DELETED
data/features/zemax.feature
DELETED
data/lib/git_hub.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
|
2
|
-
module GitHub
|
3
|
-
|
4
|
-
# :stopdoc:
|
5
|
-
VERSION = '0.0.1'
|
6
|
-
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
|
7
|
-
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
|
8
|
-
# :startdoc:
|
9
|
-
|
10
|
-
# Returns the version string for the library.
|
11
|
-
#
|
12
|
-
def self.version
|
13
|
-
VERSION
|
14
|
-
end
|
15
|
-
|
16
|
-
# Returns the library path for the module. If any arguments are given,
|
17
|
-
# they will be joined to the end of the libray path using
|
18
|
-
# <tt>File.join</tt>.
|
19
|
-
#
|
20
|
-
def self.libpath( *args )
|
21
|
-
args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
|
22
|
-
end
|
23
|
-
|
24
|
-
# Returns the path for the module. If any arguments are given,
|
25
|
-
# they will be joined to the end of the path using
|
26
|
-
# <tt>File.join</tt>.
|
27
|
-
#
|
28
|
-
def self.path( *args )
|
29
|
-
args.empty? ? PATH : ::File.join(PATH, args.flatten)
|
30
|
-
end
|
31
|
-
|
32
|
-
# Utility method used to require all files ending in .rb that lie in the
|
33
|
-
# directory below this file that has the same name as the filename passed
|
34
|
-
# in. Optionally, a specific _directory_ name can be passed in such that
|
35
|
-
# the _filename_ does not have to be equivalent to the directory.
|
36
|
-
#
|
37
|
-
def self.require_all_libs_relative_to( fname, dir = nil )
|
38
|
-
dir ||= ::File.basename(fname, '.*')
|
39
|
-
search_me = ::File.expand_path(
|
40
|
-
::File.join(::File.dirname(fname), dir, '**', '*.rb'))
|
41
|
-
|
42
|
-
Dir.glob(search_me).sort.each {|rb| require rb}
|
43
|
-
end
|
44
|
-
|
45
|
-
end # module GitHub
|
46
|
-
|
47
|
-
GitHub.require_all_libs_relative_to(__FILE__)
|
48
|
-
|
data/lib/git_hub/api.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'net/https'
|
2
|
-
require 'singleton'
|
3
|
-
|
4
|
-
module GitHub
|
5
|
-
class Api
|
6
|
-
include Singleton
|
7
|
-
|
8
|
-
attr_writer :auth
|
9
|
-
|
10
|
-
def auth
|
11
|
-
@auth || {}
|
12
|
-
end
|
13
|
-
|
14
|
-
def authenticated?
|
15
|
-
auth != {}
|
16
|
-
end
|
17
|
-
|
18
|
-
# Turns string into appropriate class constant, returns nil if class not found
|
19
|
-
def classify name
|
20
|
-
klass = name.split("::").inject(Kernel) {|klass, const_name| klass.const_get const_name }
|
21
|
-
klass.is_a?(Class) ? klass : nil
|
22
|
-
rescue NameError
|
23
|
-
nil
|
24
|
-
end
|
25
|
-
|
26
|
-
def request verb, url, params = {}
|
27
|
-
method = classify('Net::HTTP::' + verb.to_s.capitalize)
|
28
|
-
uri = URI.parse url
|
29
|
-
server = Net::HTTP.new(uri.host, uri.port)
|
30
|
-
server.use_ssl = (uri.scheme == 'https')
|
31
|
-
server.verify_mode = OpenSSL::SSL::VERIFY_NONE if server.use_ssl?
|
32
|
-
server.start do |http|
|
33
|
-
req = method.new(uri.path)
|
34
|
-
req.form_data = params.merge(auth)
|
35
|
-
http.request(req)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
data/lib/git_hub/base.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
|
3
|
-
module GitHub
|
4
|
-
class Base
|
5
|
-
@base_uri = ''
|
6
|
-
|
7
|
-
def initialize(attributes={})
|
8
|
-
attributes.each do |key, value|
|
9
|
-
raise "No attr_accessor for #{key} on #{self.class}" unless respond_to?("#{key}=")
|
10
|
-
self.send("#{key}=", value)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.base_uri uri
|
15
|
-
@base_uri = uri
|
16
|
-
end
|
17
|
-
|
18
|
-
class << self
|
19
|
-
def request verb, uri, params = {}
|
20
|
-
res = api.request verb, @base_uri+uri, params
|
21
|
-
YAML::load(res.body) if res.respond_to?(:body) # res.kind_of?(Net::HTTPSuccess)
|
22
|
-
#p "in show: #{res}: #{res.code}: #{res.http_version}: #{res.message}", res.body
|
23
|
-
end
|
24
|
-
|
25
|
-
def get uri, params ={}
|
26
|
-
request :get, uri, params
|
27
|
-
end
|
28
|
-
|
29
|
-
def post uri, params = {}
|
30
|
-
request :post, uri, params
|
31
|
-
end
|
32
|
-
|
33
|
-
def api
|
34
|
-
@@api ||= GitHub::Api.instance
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def get uri, params ={}
|
39
|
-
self.class.get uri, params
|
40
|
-
end
|
41
|
-
|
42
|
-
def post uri, params ={}
|
43
|
-
self.class.post uri, params
|
44
|
-
end
|
45
|
-
|
46
|
-
def api
|
47
|
-
self.class.api
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
data/lib/git_hub/repo.rb
DELETED
@@ -1,155 +0,0 @@
|
|
1
|
-
module GitHub
|
2
|
-
class Repo < Base
|
3
|
-
GITHUB_SERVICES = {
|
4
|
-
#[github]
|
5
|
-
# user = user
|
6
|
-
# token = token
|
7
|
-
# :donate => {:path => '/edit/donate', :inputs => ['paypal']}
|
8
|
-
# homepage = homepage_url
|
9
|
-
# webhooks => {:path => '/edit/postreceive_urls', :fields => []
|
10
|
-
#http://rdoc.info/projects/update, http://runcoderun.com/github, http://api.devver.net/github
|
11
|
-
# basecamp = url, username, password, project, category
|
12
|
-
# cia = true
|
13
|
-
# campfire = subdomain, username, password, room, ssl, play_sound
|
14
|
-
# email = arvitallian@gmail.com
|
15
|
-
# fogbugz = cvssubmit_url, fb_version, fb_repoid
|
16
|
-
# friendfeed = nickname, remotekey
|
17
|
-
# irc = server, port, room, password, nick, ssl
|
18
|
-
# jabber = user
|
19
|
-
# lighthouse = subdomain, project_id, token, private
|
20
|
-
# presently = subdomain, group_name, username, password
|
21
|
-
# rubyforge = username, password, grupid
|
22
|
-
# runcoderun = true
|
23
|
-
# trac = url, token
|
24
|
-
# twitter = username, password, digest
|
25
|
-
}
|
26
|
-
|
27
|
-
base_uri 'http://github.com/api/v2/yaml/repos'
|
28
|
-
|
29
|
-
attr_accessor :name, :owner, :description, :url, :homepage, :open_issues, :watchers, :forks, :fork, :private,
|
30
|
-
# additional attributes from search:
|
31
|
-
:id, :type, :size, :language, :created, :pushed, :score #?
|
32
|
-
|
33
|
-
def initialize options
|
34
|
-
super
|
35
|
-
raise "Unable to initialize #{self.class} without name" unless @name
|
36
|
-
@url ||= "http://github.com/#{@owner}/#{@name}"
|
37
|
-
@type ||= "repo"
|
38
|
-
end
|
39
|
-
|
40
|
-
alias followers= watchers=
|
41
|
-
alias followers watchers
|
42
|
-
alias username= owner=
|
43
|
-
alias username owner
|
44
|
-
|
45
|
-
def fork?;
|
46
|
-
!!self.fork
|
47
|
-
end
|
48
|
-
|
49
|
-
def private?;
|
50
|
-
!!self.private
|
51
|
-
end
|
52
|
-
|
53
|
-
def clone_url
|
54
|
-
url = private? || api.auth['login'] == self.owner ? "git@github.com:" : "git://github.com/"
|
55
|
-
url += "#{self.owner}/#{self.name}.git"
|
56
|
-
end
|
57
|
-
|
58
|
-
class << self # Repo class methods
|
59
|
-
# Find repo(s) of a (valid) github user
|
60
|
-
# Accepts either options Hash (:owner/:user/:username and :repo/:repository/:project/:name)
|
61
|
-
# or several search terms as strings or symbols
|
62
|
-
def find(*params)
|
63
|
-
if params.size == 1 && params.first.is_a?(Hash) # this is /show request
|
64
|
-
opts = params.first
|
65
|
-
owner = opts[:owner] || opts[:user] || opts[:username] || opts[:login] || api.auth['login'] || ''
|
66
|
-
repo = opts[:repo] || opts[:repository] || opts[:name] || opts[:project]
|
67
|
-
path = repo ? "/show/#{owner}/#{repo}" : "/show/#{owner}"
|
68
|
-
else # this is /search request, params are search terms
|
69
|
-
query = params.map(&:to_s).join('+')
|
70
|
-
path = "/search/#{query}"
|
71
|
-
end
|
72
|
-
result = get(path)
|
73
|
-
if result['repository']
|
74
|
-
new result['repository']
|
75
|
-
elsif result['repositories']
|
76
|
-
result['repositories'].map {|r| new r}
|
77
|
-
else
|
78
|
-
result
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
alias show find
|
83
|
-
alias search find
|
84
|
-
|
85
|
-
# Create new github repo, accepts Hash with :repo, :description, :homepage, :public/:private
|
86
|
-
# or repo name as a single parameter
|
87
|
-
def create(*params)
|
88
|
-
if params.size == 1 && params.first.is_a?(Hash)
|
89
|
-
opts = params.first
|
90
|
-
repo = opts[:repo] || opts[:repository] || opts[:name] || opts[:project]
|
91
|
-
description = opts[:description] || opts[:descr] || opts[:desc]
|
92
|
-
homepage = opts[:homepage]
|
93
|
-
public = opts[:public] || !opts[:private] # default to true
|
94
|
-
else # repo name as a single parameter
|
95
|
-
repo = params.first.to_s
|
96
|
-
description = nil
|
97
|
-
homepage = nil
|
98
|
-
public = false
|
99
|
-
end
|
100
|
-
raise("Unable to create #{self.class} without authorization") unless api.authenticated?
|
101
|
-
result = post("/create", 'name' => repo, 'description' => description,
|
102
|
-
'homepage' => homepage, 'public' => (public ? 1 : 0))
|
103
|
-
if result['repository']
|
104
|
-
new result['repository']
|
105
|
-
else
|
106
|
-
result
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
# Delete github repo
|
112
|
-
def delete
|
113
|
-
result = post("/delete/#{@name}")
|
114
|
-
if result['delete_token']
|
115
|
-
post("/delete/#{@name}", 'delete_token' => result['delete_token'])
|
116
|
-
else
|
117
|
-
result
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
def add_service
|
122
|
-
end
|
123
|
-
|
124
|
-
def remove_service
|
125
|
-
end
|
126
|
-
|
127
|
-
def add_collaborator
|
128
|
-
end
|
129
|
-
|
130
|
-
def remove_collaborator
|
131
|
-
end
|
132
|
-
|
133
|
-
# repos/show/:user/:repo/tags
|
134
|
-
# repos/show/:user/:repo/branches
|
135
|
-
# repos/show/:user/:repo/languages
|
136
|
-
# repos/show/:user/:repo/network
|
137
|
-
#
|
138
|
-
# repos/show/:user/:repo/collaborators
|
139
|
-
# POST repos/collaborators/:repo/add/:user
|
140
|
-
# POST repos/collaborators/:repo/remove/:user
|
141
|
-
#
|
142
|
-
# repos/keys/:repo
|
143
|
-
# POST repos/key/:repo/remove
|
144
|
-
# POST repos/key/:repo/add {title => title of the key, key => public key data}
|
145
|
-
|
146
|
-
# POST repos/set/public/:repo
|
147
|
-
# POST repos/set/private/:repo
|
148
|
-
|
149
|
-
# ? repos/fork/:user/:repo
|
150
|
-
# repos/unwatch/:user/:repo
|
151
|
-
# repos/watch/:user/:repo
|
152
|
-
# repos/show/:user/:repo ? new?
|
153
|
-
|
154
|
-
end
|
155
|
-
end
|