wire-framework 0.1.5.7 → 0.1.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/app/db.rb +2 -2
- data/lib/app/history.rb +2 -0
- data/lib/app/history/svn.rb +4 -2
- data/lib/app/render/error.rb +1 -1
- data/lib/app/repo.rb +24 -18
- data/lib/app/repo/svn.rb +22 -12
- data/lib/wire.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d79aa2208acd914eb50a86bd6f577a9144509e0
|
4
|
+
data.tar.gz: 1bd6db517477eabc4f522dbf1322198664109ac4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff82b680ab9e22972050943e833bac2be76010fd0a6446c2912e84c7e6619acefcc8738d5776f72e9ff3fcdd49dffe309667582d1c86fbfb997b76c1200cc3ac
|
7
|
+
data.tar.gz: 2e23a270bbdb9de4f1e5ecc1ed81b53ee826d3d3a1fc2e1b8afd722fdcee452ff15602d7f48a22b47633aa5250aa0bee6e9a18688d053ed71b7f4469e6909e92
|
data/lib/app/db.rb
CHANGED
@@ -79,7 +79,7 @@ module DB
|
|
79
79
|
else
|
80
80
|
begin
|
81
81
|
instance = model.create(context.json)
|
82
|
-
if instance.
|
82
|
+
if instance.exists?
|
83
83
|
200
|
84
84
|
else
|
85
85
|
errors = ''
|
@@ -142,7 +142,7 @@ module DB
|
|
142
142
|
return 404 unless model
|
143
143
|
instance = model[context.uri[3]]
|
144
144
|
if instance
|
145
|
-
if instance.
|
145
|
+
if instance.destroy
|
146
146
|
200
|
147
147
|
else
|
148
148
|
[500, {}, 'Failed to delete instance']
|
data/lib/app/history.rb
CHANGED
data/lib/app/history/svn.rb
CHANGED
@@ -26,11 +26,13 @@ module History
|
|
26
26
|
# Get the log information for any part of a Repo
|
27
27
|
# @param [String] host the name of the host to connect to
|
28
28
|
# @param [String] repo the name of the repository to access
|
29
|
+
# @param [String] user the username for connecting to SVN
|
30
|
+
# @param [String] pass the password for connecting to SVN
|
29
31
|
# @param [String] web the web path of the repo
|
30
32
|
# @param [String] id the sub-URI of the item to access
|
31
33
|
# @return [Hash] the history entries
|
32
|
-
def self.get_log(host, repo, web, id = nil)
|
33
|
-
options = "--username #{
|
34
|
+
def self.get_log(host, repo, user, pass, web, id = nil)
|
35
|
+
options = "--username #{user} --password #{pass}"
|
34
36
|
uri = "svn://#{host}/#{repo}"
|
35
37
|
if id
|
36
38
|
if web
|
data/lib/app/render/error.rb
CHANGED
data/lib/app/repo.rb
CHANGED
@@ -26,7 +26,7 @@ module Repo
|
|
26
26
|
# @param [Hash] conf the raw configuration
|
27
27
|
# @return [Hash] post-processed configuration
|
28
28
|
def self.configure(conf)
|
29
|
-
conf['listing'] = Tilt.new(conf['listing'], 1, {ugly: true})
|
29
|
+
conf['listing'] = Tilt.new(conf['listing'], 1, { ugly: true })
|
30
30
|
conf
|
31
31
|
end
|
32
32
|
|
@@ -53,6 +53,8 @@ module Repo
|
|
53
53
|
def do_read_all(context)
|
54
54
|
mime = 'text/html'
|
55
55
|
list = do_read_listing(context.config['web'],
|
56
|
+
context.config['user'],
|
57
|
+
context.config['pass'],
|
56
58
|
context.config['repos'],
|
57
59
|
context.resource)
|
58
60
|
if list == 404
|
@@ -64,9 +66,9 @@ module Repo
|
|
64
66
|
resource: context.resource,
|
65
67
|
id: '',
|
66
68
|
referrer: context.referer)
|
67
|
-
headers = {'Content-Type' => mime,
|
68
|
-
|
69
|
-
|
69
|
+
headers = { 'Content-Type' => mime,
|
70
|
+
'Cache-Control' => 'public',
|
71
|
+
'Expires' => "#{(Time.now + 1000).utc}" }
|
70
72
|
[200, headers, [list]]
|
71
73
|
end
|
72
74
|
|
@@ -74,36 +76,38 @@ module Repo
|
|
74
76
|
# @param [Hash] context the context for this request
|
75
77
|
# @return [Response] the file, listing, or status code
|
76
78
|
def do_read(context)
|
77
|
-
|
79
|
+
user = context.config['user']
|
80
|
+
pass = context.config['pass']
|
81
|
+
repo = context.resource
|
78
82
|
referrer = context.referer
|
79
|
-
|
83
|
+
path = context.config['repos']
|
80
84
|
web = context.config['web']
|
81
85
|
rev = context.query[:rev]
|
82
86
|
id = context.id
|
83
|
-
info = do_read_info(rev, web,
|
87
|
+
info = do_read_info(rev, web, user, pass, path, repo, id)
|
84
88
|
if info == 404
|
85
89
|
return 404
|
86
90
|
end
|
87
91
|
type = info[:@kind]
|
88
92
|
if type.eql? 'dir'
|
89
93
|
mime = 'text/html'
|
90
|
-
list = do_read_listing(web,
|
94
|
+
list = do_read_listing(web, user, pass, path, repo, id)
|
91
95
|
template = context.config['listing']
|
92
96
|
body = template.render(self,
|
93
97
|
list: list,
|
94
|
-
resource:
|
98
|
+
resource: repo,
|
95
99
|
id: id,
|
96
100
|
referrer: referrer)
|
97
101
|
else
|
98
|
-
body = do_read_file(rev, web,
|
102
|
+
body = do_read_file(rev, web, user, pass, path, repo, id)
|
99
103
|
if body == 500
|
100
104
|
return body
|
101
105
|
end
|
102
|
-
mime = do_read_mime(rev, web,
|
106
|
+
mime = do_read_mime(rev, web, user, pass, path, repo, id)
|
103
107
|
end
|
104
|
-
headers = {'Content-Type' => mime,
|
105
|
-
|
106
|
-
|
108
|
+
headers = { 'Content-Type' => mime,
|
109
|
+
'Cache-Control' => 'public',
|
110
|
+
'Expires' => "#{(Time.now + 1000).utc}" }
|
107
111
|
[200, headers, [body]]
|
108
112
|
end
|
109
113
|
|
@@ -111,8 +115,10 @@ module Repo
|
|
111
115
|
# @param [Hash] context the context for this request
|
112
116
|
# @return [Response] status code
|
113
117
|
def do_update(context)
|
114
|
-
|
115
|
-
|
118
|
+
user = context.config['user']
|
119
|
+
pass = context.config['pass']
|
120
|
+
repo = context.resource
|
121
|
+
path = context.config['repos']
|
116
122
|
web = context.config['web']
|
117
123
|
content = context.json
|
118
124
|
id = context.id
|
@@ -124,9 +130,9 @@ module Repo
|
|
124
130
|
else
|
125
131
|
mime = content[:file][:mime]
|
126
132
|
end
|
127
|
-
do_update_file(web,
|
133
|
+
do_update_file(web, user, pass, path, repo, id, file, content[:message], mime, context.user)
|
128
134
|
else
|
129
|
-
do_update_file(web,
|
135
|
+
do_update_file(web, user, pass, path, repo, id, URI.unescape(content[:updated]), content[:message], context.query[:type], context.user)
|
130
136
|
end
|
131
137
|
end
|
132
138
|
|
data/lib/app/repo/svn.rb
CHANGED
@@ -43,12 +43,14 @@ module Repo
|
|
43
43
|
# Read a single file
|
44
44
|
# @param [String] rev the revision number to access
|
45
45
|
# @param [String] web the subdirectory for web content
|
46
|
+
# @param [String] user the username for connecting to SVN
|
47
|
+
# @param [String] pass the password for connecting to SVN
|
46
48
|
# @param [String] path the path to the repositories
|
47
49
|
# @param [String] repo the new repo name
|
48
50
|
# @param [String] id the relative path to the file
|
49
51
|
# @return [String] the file
|
50
|
-
def self.do_read_file(rev, web, path, repo, id)
|
51
|
-
options = "--username #{
|
52
|
+
def self.do_read_file(rev, web, user, pass, path, repo, id)
|
53
|
+
options = "--username #{user} --password #{pass}"
|
52
54
|
if rev.nil?
|
53
55
|
rev = 'HEAD'
|
54
56
|
end
|
@@ -67,12 +69,14 @@ module Repo
|
|
67
69
|
|
68
70
|
# Read a directory listing
|
69
71
|
# @param [String] web the subdirectory for web content
|
72
|
+
# @param [String] user the username for connecting to SVN
|
73
|
+
# @param [String] pass the password for connecting to SVN
|
70
74
|
# @param [String] path the path to the repositories
|
71
75
|
# @param [String] repo the new repo name
|
72
76
|
# @param [String] id the relative path to the file
|
73
77
|
# @return [Array] the directory listing
|
74
|
-
def self.do_read_listing(web, path, repo, id = nil)
|
75
|
-
options = "--username #{
|
78
|
+
def self.do_read_listing(web, user, pass, path, repo, id = nil)
|
79
|
+
options = "--username #{user} --password #{pass}"
|
76
80
|
if web.nil?
|
77
81
|
if id.nil?
|
78
82
|
list = `svn list #{options} --xml 'svn://localhost/#{repo}'`
|
@@ -96,12 +100,14 @@ module Repo
|
|
96
100
|
# Read Metadata for a single file
|
97
101
|
# @param [String] rev the revision number to access
|
98
102
|
# @param [String] web the subdirectory for web content
|
103
|
+
# @param [String] user the username for connecting to SVN
|
104
|
+
# @param [String] pass the password for connecting to SVN
|
99
105
|
# @param [String] path the path to the repositories
|
100
106
|
# @param [String] repo the new repo name
|
101
107
|
# @param [String] id the relative path to the file
|
102
108
|
# @return [Hash] the metadata
|
103
|
-
def self.do_read_info(rev, web, path, repo, id)
|
104
|
-
options = "--username #{
|
109
|
+
def self.do_read_info(rev, web, user, pass, path, repo, id)
|
110
|
+
options = "--username #{user} --password #{pass}"
|
105
111
|
if rev.nil?
|
106
112
|
rev = 'HEAD'
|
107
113
|
end
|
@@ -121,12 +127,14 @@ module Repo
|
|
121
127
|
# Get a file's MIME type
|
122
128
|
# @param [String] rev the revision number to access
|
123
129
|
# @param [String] web the subdirectory for web content
|
130
|
+
# @param [String] user the username for connecting to SVN
|
131
|
+
# @param [String] pass the password for connecting to SVN
|
124
132
|
# @param [String] path the path to the repositories
|
125
133
|
# @param [String] repo the new repo name
|
126
134
|
# @param [String] id the relative path to the file
|
127
135
|
# @return [String] the MIME type
|
128
|
-
def self.do_read_mime(rev, web, path, repo, id)
|
129
|
-
options = "--username #{
|
136
|
+
def self.do_read_mime(rev, web, user, pass, path, repo, id)
|
137
|
+
options = "--username #{user} --password #{pass}"
|
130
138
|
if rev.nil?
|
131
139
|
rev = 'HEAD'
|
132
140
|
end
|
@@ -148,16 +156,18 @@ module Repo
|
|
148
156
|
|
149
157
|
# Update a single file
|
150
158
|
# @param [String] web the subdirectory for web content
|
159
|
+
# @param [String] user the username for connecting to SVN
|
160
|
+
# @param [String] pass the password for connecting to SVN
|
151
161
|
# @param [String] path the path to the repositories
|
152
162
|
# @param [String] repo the new repo name
|
153
163
|
# @param [String] id the relative path to the file
|
154
164
|
# @param [String] content the updated file
|
155
165
|
# @param [String] message the commit message
|
156
166
|
# @param [String] mime the mime-type to set
|
157
|
-
# @param [String]
|
167
|
+
# @param [String] username the Author of this change
|
158
168
|
# @return [Integer] status code
|
159
|
-
def self.do_update_file(web, path, repo, id, content, message, mime,
|
160
|
-
options = "--username #{
|
169
|
+
def self.do_update_file(web, user, pass, path, repo, id, content, message, mime, username)
|
170
|
+
options = "--username #{user} --password #{pass}"
|
161
171
|
status = 500
|
162
172
|
id = id.split('/')
|
163
173
|
id.pop
|
@@ -196,7 +206,7 @@ module Repo
|
|
196
206
|
if $?.exitstatus == 0
|
197
207
|
status = 200
|
198
208
|
end
|
199
|
-
`svn propset #{options} --revprop -r HEAD svn:author '#{
|
209
|
+
`svn propset #{options} --revprop -r HEAD svn:author '#{username}' "/tmp/svn/#{repo}"`
|
200
210
|
end
|
201
211
|
`rm -R '/tmp/svn/#{repo}'`
|
202
212
|
status
|
data/lib/wire.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wire-framework
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.5.
|
4
|
+
version: 0.1.5.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan T. Meyers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|