dolt 0.18.0 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Gemfile.lock +3 -11
  2. data/bin/dolt +52 -68
  3. data/dolt.gemspec +2 -2
  4. metadata +22 -23
@@ -4,39 +4,30 @@ PATH
4
4
  dolt (0.18.0)
5
5
  json (~> 1.5)
6
6
  libdolt (~> 0.21)
7
- main (~> 5.2)
8
7
  sinatra (~> 1.0)
9
8
  thin (~> 1.4)
10
9
  tiltout (~> 1.4)
10
+ trollop (~> 2.0)
11
11
 
12
12
  GEM
13
13
  remote: http://rubygems.org/
14
14
  specs:
15
- arrayfields (4.9.0)
16
- chronic (0.9.1)
17
15
  daemons (1.1.9)
18
16
  eventmachine (1.0.3)
19
- fattr (2.2.1)
20
17
  github-markup (0.7.5)
21
18
  htmlentities (4.3.1)
22
19
  json (1.8.0)
23
- libdolt (0.21.0)
20
+ libdolt (0.22.0)
24
21
  htmlentities (~> 4.3)
25
22
  json (~> 1.7)
26
23
  makeup (~> 0.2)
27
24
  mime-types (~> 1.19)
28
25
  rugged (= 0.17.0.b6)
29
26
  tzinfo (~> 0.3)
30
- main (5.2.0)
31
- arrayfields (>= 4.7.4)
32
- chronic (>= 0.6.2)
33
- fattr (>= 2.2.0)
34
- map (>= 5.1.0)
35
27
  makeup (0.3.0)
36
28
  github-markup (~> 0.7)
37
29
  htmlentities (~> 4.3)
38
30
  pygments.rb (~> 0.2)
39
- map (6.5.1)
40
31
  mime-types (1.23)
41
32
  minitest (2.12.1)
42
33
  posix-spawn (0.3.6)
@@ -61,6 +52,7 @@ GEM
61
52
  tilt (1.4.1)
62
53
  tiltout (1.4.0)
63
54
  tilt (~> 1.3)
55
+ trollop (2.0)
64
56
  tzinfo (0.3.37)
65
57
  yajl-ruby (1.1.0)
66
58
 
data/bin/dolt CHANGED
@@ -4,7 +4,7 @@ require "tiltout"
4
4
  require "thin"
5
5
  require "sinatra/base"
6
6
  require "cgi"
7
- require "main"
7
+ require "trollop"
8
8
 
9
9
  ### TODO: Extract this into a testable API
10
10
 
@@ -83,71 +83,55 @@ class DoltApp
83
83
  end
84
84
  end
85
85
 
86
- Main {
87
- argument("root") {
88
- required
89
- validate {|dir| File.exists?(dir) }
90
- description "The base directory to serve repositories from"
91
- }
92
-
93
- option("socket=[socket]") {
94
- cast :string
95
- description "A socket to listen to"
96
- }
97
-
98
- option("port=[port]") {
99
- cast :int
100
- description "A port to listen to"
101
- }
102
-
103
- option("bind=[bind]") {
104
- description "An IP address to bind to"
105
- default "0.0.0.0"
106
- }
107
-
108
- option("tabwidth=[tabwidth]") {
109
- cast :int
110
- description "The number of spaces to use as a tab"
111
- default 4
112
- }
113
-
114
- option("pidfile=[pidfile]") {
115
- description "Run as daemon with pidfile stored here."
116
- }
117
-
118
- option("logfile=[logfile]") {
119
- description "Use as log file. Assumes --pidfile option"
120
- }
121
-
122
- environment("IP") {
123
- description "An IP address to bind to"
124
- }
125
-
126
- environment("PORT") {
127
- description "A port to listen on"
128
- cast :int
129
- }
130
-
131
- # Use option if given, otherwise ENV var if given, otherwise default value
132
- def option(param, env, default)
133
- return params[param].value if params[param].given?
134
- return params[env].value || default
135
- end
86
+ # Use option if given, otherwise ENV var if given, otherwise default value
87
+ def option_from_options_or_env(option_name, env_name, default, options)
88
+ return options[option_name] if options[option_name]
89
+ return ENV[env_name] || default
90
+ end
136
91
 
137
- def run
138
- options = {}
139
- if params[:socket].given?
140
- options[:socket] = params[:socket].value
141
- else
142
- options[:port] = option(:port, :PORT, 3000)
143
- options[:ip] = option(:bind, :IP, "0.0.0.0")
144
- end
145
- if params[:pidfile].given?
146
- options[:pidfile] = params[:pidfile].value
147
- options[:logfile] = params[:logfile].value || "/tmp/dolt.log"
148
- end
149
- options[:tab_width] = params[:tabwidth].value
150
- root = File.expand_path(params[:root].value)
151
- DoltApp.new(File.join(File.dirname(__FILE__), "..")).run(root, options)
152
- end
153
- }
92
+ given_root = ARGV.pop
93
+ parser = Trollop::Parser.new do
94
+ version "Dolt #{Dolt::VERSION}"
95
+ banner <<-END_HELP
96
+ Dolt is a Git repository browser.
97
+
98
+ Usage:
99
+ #{$0} [options] ROOT
100
+
101
+ where ROOT is either the path to a repository or a directory containing
102
+ repositories.
103
+
104
+ Valid options are:
105
+ END_HELP
106
+
107
+ opt :socket, "A socket to listen to", :type => :string
108
+ opt :port, "A port to listen to", :type => :integer
109
+ opt :bind, "An IP address to bind to", :type => :string
110
+ opt :tabwidth, "The number of spaces to use as a tab", :type => :integer, :default => 4
111
+ opt :pidfile, "Run as daemon with pidfile stored here", :type => :string
112
+ opt :logfile, "Use as log file. Assumes --pidfile option", :type => :string
113
+ end
114
+
115
+ params = Trollop::with_standard_exception_handling(parser) do
116
+ raise Trollop::HelpNeeded if given_root.nil?
117
+ raise Trollop::HelpNeeded unless File.exist?(given_root)
118
+ parser.parse(ARGV)
119
+ end
120
+
121
+ options = {}
122
+ options[:root] = File.expand_path(given_root)
123
+ if params[:socket]
124
+ options[:socket] = params[:socket]
125
+ else
126
+ options[:port] = option_from_options_or_env(:port, "PORT", 3000, params).to_i
127
+ options[:ip] = option_from_options_or_env(:ip, "IP", "0.0.0.0", params)
128
+ end
129
+
130
+ if params[:pidfile]
131
+ options[:pidfile] = params[:pidfile]
132
+ options[:logfile] = params[:logfile] || "/tmp/dolt.log"
133
+ end
134
+
135
+ options[:tab_width] = params[:tabwidth]
136
+
137
+ DoltApp.new(File.join(File.dirname(__FILE__), "..")).run(options.delete(:root), options)
@@ -11,7 +11,7 @@ end
11
11
 
12
12
  Gem::Specification.new do |s|
13
13
  s.name = "dolt"
14
- s.version = "0.18.0"
14
+ s.version = "0.19.0"
15
15
  s.authors = ["Christian Johansen"]
16
16
  s.email = ["christian@gitorious.org"]
17
17
  s.homepage = "http://gitorious.org/gitorious/dolt"
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
25
25
  s.add_dependency "sinatra", "~>1.0"
26
26
  s.add_dependency "tiltout", "~>1.4"
27
27
  s.add_dependency "json", "~>1.5"
28
- s.add_dependency "main", "~>5.2"
28
+ s.add_dependency "trollop", "~>2.0"
29
29
 
30
30
  s.add_development_dependency "minitest", "~> 2.0"
31
31
  s.add_development_dependency "rake", "~> 0.9"
metadata CHANGED
@@ -1,25 +1,24 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dolt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
5
4
  prerelease:
5
+ version: 0.19.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Christian Johansen
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-18 00:00:00.000000000 Z
12
+ date: 2013-06-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: libdolt
15
+ type: :runtime
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
21
  version: '0.21'
22
- type: :runtime
23
22
  prerelease: false
24
23
  version_requirements: !ruby/object:Gem::Requirement
25
24
  none: false
@@ -27,15 +26,15 @@ dependencies:
27
26
  - - ~>
28
27
  - !ruby/object:Gem::Version
29
28
  version: '0.21'
29
+ name: libdolt
30
30
  - !ruby/object:Gem::Dependency
31
- name: thin
31
+ type: :runtime
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
35
  - - ~>
36
36
  - !ruby/object:Gem::Version
37
37
  version: '1.4'
38
- type: :runtime
39
38
  prerelease: false
40
39
  version_requirements: !ruby/object:Gem::Requirement
41
40
  none: false
@@ -43,15 +42,15 @@ dependencies:
43
42
  - - ~>
44
43
  - !ruby/object:Gem::Version
45
44
  version: '1.4'
45
+ name: thin
46
46
  - !ruby/object:Gem::Dependency
47
- name: sinatra
47
+ type: :runtime
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
51
51
  - - ~>
52
52
  - !ruby/object:Gem::Version
53
53
  version: '1.0'
54
- type: :runtime
55
54
  prerelease: false
56
55
  version_requirements: !ruby/object:Gem::Requirement
57
56
  none: false
@@ -59,15 +58,15 @@ dependencies:
59
58
  - - ~>
60
59
  - !ruby/object:Gem::Version
61
60
  version: '1.0'
61
+ name: sinatra
62
62
  - !ruby/object:Gem::Dependency
63
- name: tiltout
63
+ type: :runtime
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
67
67
  - - ~>
68
68
  - !ruby/object:Gem::Version
69
69
  version: '1.4'
70
- type: :runtime
71
70
  prerelease: false
72
71
  version_requirements: !ruby/object:Gem::Requirement
73
72
  none: false
@@ -75,15 +74,15 @@ dependencies:
75
74
  - - ~>
76
75
  - !ruby/object:Gem::Version
77
76
  version: '1.4'
77
+ name: tiltout
78
78
  - !ruby/object:Gem::Dependency
79
- name: json
79
+ type: :runtime
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
83
  - - ~>
84
84
  - !ruby/object:Gem::Version
85
85
  version: '1.5'
86
- type: :runtime
87
86
  prerelease: false
88
87
  version_requirements: !ruby/object:Gem::Requirement
89
88
  none: false
@@ -91,31 +90,31 @@ dependencies:
91
90
  - - ~>
92
91
  - !ruby/object:Gem::Version
93
92
  version: '1.5'
93
+ name: json
94
94
  - !ruby/object:Gem::Dependency
95
- name: main
95
+ type: :runtime
96
96
  requirement: !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
99
99
  - - ~>
100
100
  - !ruby/object:Gem::Version
101
- version: '5.2'
102
- type: :runtime
101
+ version: '2.0'
103
102
  prerelease: false
104
103
  version_requirements: !ruby/object:Gem::Requirement
105
104
  none: false
106
105
  requirements:
107
106
  - - ~>
108
107
  - !ruby/object:Gem::Version
109
- version: '5.2'
108
+ version: '2.0'
109
+ name: trollop
110
110
  - !ruby/object:Gem::Dependency
111
- name: minitest
111
+ type: :development
112
112
  requirement: !ruby/object:Gem::Requirement
113
113
  none: false
114
114
  requirements:
115
115
  - - ~>
116
116
  - !ruby/object:Gem::Version
117
117
  version: '2.0'
118
- type: :development
119
118
  prerelease: false
120
119
  version_requirements: !ruby/object:Gem::Requirement
121
120
  none: false
@@ -123,15 +122,15 @@ dependencies:
123
122
  - - ~>
124
123
  - !ruby/object:Gem::Version
125
124
  version: '2.0'
125
+ name: minitest
126
126
  - !ruby/object:Gem::Dependency
127
- name: rake
127
+ type: :development
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  none: false
130
130
  requirements:
131
131
  - - ~>
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0.9'
134
- type: :development
135
134
  prerelease: false
136
135
  version_requirements: !ruby/object:Gem::Requirement
137
136
  none: false
@@ -139,15 +138,15 @@ dependencies:
139
138
  - - ~>
140
139
  - !ruby/object:Gem::Version
141
140
  version: '0.9'
141
+ name: rake
142
142
  - !ruby/object:Gem::Dependency
143
- name: rack-test
143
+ type: :development
144
144
  requirement: !ruby/object:Gem::Requirement
145
145
  none: false
146
146
  requirements:
147
147
  - - ~>
148
148
  - !ruby/object:Gem::Version
149
149
  version: '0.6'
150
- type: :development
151
150
  prerelease: false
152
151
  version_requirements: !ruby/object:Gem::Requirement
153
152
  none: false
@@ -155,6 +154,7 @@ dependencies:
155
154
  - - ~>
156
155
  - !ruby/object:Gem::Version
157
156
  version: '0.6'
157
+ name: rack-test
158
158
  description: Dolt serves git trees and syntax highlighted blobs
159
159
  email:
160
160
  - christian@gitorious.org
@@ -252,4 +252,3 @@ signing_key:
252
252
  specification_version: 3
253
253
  summary: Dolt serves git trees and syntax highlighted blobs
254
254
  test_files: []
255
- has_rdoc: