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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd4274e5b145b99f303b5fab714b9950a296e783
4
- data.tar.gz: 727b2beca939b042ea2d16d1d38bc0edd53d6361
3
+ metadata.gz: 2d79aa2208acd914eb50a86bd6f577a9144509e0
4
+ data.tar.gz: 1bd6db517477eabc4f522dbf1322198664109ac4
5
5
  SHA512:
6
- metadata.gz: ed6e45a2c421be5bc7c4b9e716c1b5dc484d9ee379e67ee53f155788ffc3b2a335192ecd6843c6e3b1ecfad0e89e2b9148c8e000e4799798f290f60a095690dc
7
- data.tar.gz: 4f35ee62abcb5eacda644e51efa8f5709c776be1da523f28f5a2af71d144bfa57c0c820fa300699ed641c7d2b7a56fb6ad6a0fa5453410762fe1794ba62396ca
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.modified?
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.delete
145
+ if instance.destroy
146
146
  200
147
147
  else
148
148
  [500, {}, 'Failed to delete instance']
data/lib/app/history.rb CHANGED
@@ -35,6 +35,8 @@ module History
35
35
  def do_read(actions, context)
36
36
  list = get_log(context.config['host'],
37
37
  context.resource,
38
+ context.config['user'],
39
+ context.config['pass'],
38
40
  context.config['web_folder'],
39
41
  context.id)
40
42
  if list == 404
@@ -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 #{$environment[:repos_user]} --password #{$environment[:repos_password]}"
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
@@ -30,7 +30,7 @@ module Render
30
30
  end
31
31
 
32
32
  def self.error_check(actions, context, result)
33
- errors = context.app['errors']
33
+ errors = context.config['errors']
34
34
  if errors
35
35
  template = errors[result[0]]
36
36
  if template
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
- 'Cache-Control' => 'public',
69
- 'Expires' => "#{(Time.now + 1000).utc}"}
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
- path = context.resource
79
+ user = context.config['user']
80
+ pass = context.config['pass']
81
+ repo = context.resource
78
82
  referrer = context.referer
79
- repos = context.config['repos']
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, repos, path, id)
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, repos, path, id)
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: path,
98
+ resource: repo,
95
99
  id: id,
96
100
  referrer: referrer)
97
101
  else
98
- body = do_read_file(rev, web, repos, path, id)
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, repos, path, id)
106
+ mime = do_read_mime(rev, web, user, pass, path, repo, id)
103
107
  end
104
- headers = {'Content-Type' => mime,
105
- 'Cache-Control' => 'public',
106
- 'Expires' => "#{(Time.now + 1000).utc}"}
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
- path = context.resource
115
- repos = context.config['repos']
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, repos, path, id, file, content[:message], mime, context.user)
133
+ do_update_file(web, user, pass, path, repo, id, file, content[:message], mime, context.user)
128
134
  else
129
- do_update_file(web, repos, path, id, URI.unescape(content[:updated]), content[:message], context.query[:type], context.user)
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 #{$environment[:repos_user]} --password #{$environment[:repos_password]}"
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 #{$environment[:repos_user]} --password #{$environment[:repos_password]}"
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 #{$environment[:repos_user]} --password #{$environment[:repos_password]}"
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 #{$environment[:repos_user]} --password #{$environment[:repos_password]}"
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] user the Author of this change
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, user)
160
- options = "--username #{$environment[:repos_user]} --password #{$environment[:repos_password]}"
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 '#{user}' "/tmp/svn/#{repo}"`
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
@@ -33,7 +33,7 @@ end
33
33
  # @author Bryan T. Meyers
34
34
  module Wire
35
35
  # Current version of the Wire Gem
36
- VERSION = '0.1.5.7'
36
+ VERSION = '0.1.5.8'
37
37
  end
38
38
 
39
39
  require_relative 'app'
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.7
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-18 00:00:00.000000000 Z
11
+ date: 2017-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print