reivt 1.2.6 → 1.4.0
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.
- checksums.yaml +4 -4
- data/exe/revit +1 -1
- data/lib/reivt/api.rb +8 -9
- data/lib/reivt/cli.rb +18 -11
- data/lib/reivt/version.rb +1 -1
- data/lib/reivt.rb +10 -0
- 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: 4055671ea0bb1c2eae15270474dc80013937d6d8
|
4
|
+
data.tar.gz: b2063e141f8db3d72326bd6c390eecb9ed06e510
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9cf6dce3702c4409fbf6f8c6dc1fa468dea013bb29ea29ad278e69bc8ea6de92775c2f796fafd1a9cde986f918010d90d180e6cd270c9135350a0698f9f4cf0
|
7
|
+
data.tar.gz: 6966e27b24a42a4560c03526ca87b6c5553da460c3f2ebf39495150134d0a63ede47802b7573ceb33d7867da9a3b51dda0ea50930e65040c1faf26a6ae2ad385
|
data/exe/revit
CHANGED
data/lib/reivt/api.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'graphql/client'
|
2
2
|
require 'graphql/client/http'
|
3
3
|
|
4
|
+
require 'pp'
|
5
|
+
|
4
6
|
# An extension of our main module Reivt
|
5
7
|
#
|
6
8
|
# @author [brwnrclse]
|
@@ -41,18 +43,15 @@ module Reivt
|
|
41
43
|
# @return [Array] A list containing the data and error object from the req
|
42
44
|
#
|
43
45
|
def self.retrieve(api_response)
|
44
|
-
errors = api_response.errors
|
46
|
+
errors = api_response.errors
|
45
47
|
data = api_response.data
|
46
48
|
|
47
|
-
if
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
raise Reivt::GraphQLDataException, data.errors[:data].join(', ')
|
49
|
+
if data.nil?
|
50
|
+
msg = errors.details[:data].map { |error| error['message'] }
|
51
|
+
raise Reivt::GraphQLDataException, msg.join(",\n")
|
52
|
+
else
|
53
|
+
data
|
53
54
|
end
|
54
|
-
|
55
|
-
data
|
56
55
|
end
|
57
56
|
end
|
58
57
|
end
|
data/lib/reivt/cli.rb
CHANGED
@@ -29,7 +29,7 @@ module Reivt
|
|
29
29
|
desc: 'A list of files to add to the rev'
|
30
30
|
method_option :title, type: :string, aliases: '-t', lazy_default: '',
|
31
31
|
desc: 'A title for the rev'
|
32
|
-
desc 'create PATH', 'Make a new rev
|
32
|
+
desc 'create PATH', 'Make a new rev and populate with documents'
|
33
33
|
long_desc <<-LONGDESC
|
34
34
|
`Initiates a flow for creating a new rev. To bypass the prompts users can use the provided flags.
|
35
35
|
If using git the title, description and files will be retrieved from git via the git repo name, latest commit msg and latest commit file list respectively.
|
@@ -44,7 +44,7 @@ module Reivt
|
|
44
44
|
doc_ids = Set.new
|
45
45
|
paths = path.split
|
46
46
|
paths += options[:list_files] if options[:list_files]
|
47
|
-
rev_id =
|
47
|
+
rev_id = nil
|
48
48
|
spinner = TTY::Spinner.new('[:spinner] :msg', format: :bouncing_ball)
|
49
49
|
|
50
50
|
spinner.update(msg: 'Creating a rev...')
|
@@ -92,20 +92,27 @@ module Reivt
|
|
92
92
|
end
|
93
93
|
spinner.success(Paint['docs uploaded to api', :green])
|
94
94
|
|
95
|
-
|
95
|
+
Reivt::LOGGER.info(
|
96
|
+
"Login at #{Paint['wver.vaemoi.co/', :green]} to start your rev!"
|
97
|
+
)
|
96
98
|
rescue Errno::ECONNRESET, Errno::EINVAL, EOFError, Net::HTTPBadResponse,
|
97
99
|
Net::HTTPHeaderSyntaxError, Net::OpenTimeout, Net::ProtocolError,
|
98
100
|
Reivt::BaemptyException, Reivt::GraphQLDataException,
|
99
101
|
Reivt::GraphQLValidationException => e
|
100
102
|
|
101
103
|
Reivt::DEVLOGGER.error(e.message)
|
102
|
-
|
104
|
+
Reivt::LOGGER.error(e.message)
|
103
105
|
|
104
|
-
doc_ids.
|
105
|
-
|
106
|
+
unless doc_ids.empty?
|
107
|
+
doc_ids.each do |id|
|
108
|
+
RevAPI.delete_doc(id)
|
109
|
+
end
|
106
110
|
end
|
107
111
|
|
108
|
-
|
112
|
+
unless rev_id.nil?
|
113
|
+
RevAPI.delete_rev(rev_id) unless rev_id.nil?
|
114
|
+
end
|
115
|
+
Reivt::LOGGER.info('Done!')
|
109
116
|
end
|
110
117
|
|
111
118
|
desc 'login', 'Get an auth token for accessing the rev api'
|
@@ -118,10 +125,10 @@ module Reivt
|
|
118
125
|
`rev login -u brwnrclse`
|
119
126
|
LONGDESC
|
120
127
|
def login
|
121
|
-
|
122
|
-
|
128
|
+
Reivt::LOGGER.info('Login here for your token:')
|
129
|
+
Reivt::LOGGER.info(Paint[Auth.auth_code_url, :green])
|
123
130
|
|
124
|
-
auth_code = Thor::Shell::Basic.new.ask(
|
131
|
+
auth_code = Thor::Shell::Basic.new.ask("\nEnter your auth code => ")
|
125
132
|
spinner = TTY::Spinner.new('[:spinner] :msg', format: :bouncing_ball)
|
126
133
|
|
127
134
|
spinner.update(msg: 'Logging in')
|
@@ -150,7 +157,7 @@ module Reivt
|
|
150
157
|
Reivt::GraphQLValidationException => e
|
151
158
|
|
152
159
|
Reivt::DEVLOGGER.error(e.message)
|
153
|
-
|
160
|
+
Reivt::DEVLOGGER.error(e.message)
|
154
161
|
end
|
155
162
|
end
|
156
163
|
end
|
data/lib/reivt/version.rb
CHANGED
data/lib/reivt.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require 'logger'
|
3
|
+
require 'paint'
|
3
4
|
require 'pstore'
|
4
5
|
|
5
6
|
# The cli tool for rev. Revit process paths passed to it in order to create new
|
@@ -18,9 +19,18 @@ module Reivt
|
|
18
19
|
FileUtils.mkdir_p("#{Dir.home}/.reivt")
|
19
20
|
|
20
21
|
REIVT_STORE = PStore.new("#{Dir.home}/.reivt/reivt.pstore")
|
22
|
+
LOGGER = Logger.new(STDOUT)
|
21
23
|
DEVLOGGER = Logger.new("#{Dir.home}/.reivt/reivt-dev.log")
|
22
24
|
|
23
25
|
DEVLOGGER.datetime_format = '%Y-%m-%d %H:%M:%S '
|
26
|
+
LOGGER.formatter = proc do |severity, _, _, msg|
|
27
|
+
case severity
|
28
|
+
when 'ERROR' then "\n#{Paint[severity, :red]}: #{msg}\n"
|
29
|
+
when 'FATAL' then "\n#{Paint[severity, :red]}L #{msg}\n"
|
30
|
+
else
|
31
|
+
"\n#{msg}\n"
|
32
|
+
end
|
33
|
+
end
|
24
34
|
end
|
25
35
|
|
26
36
|
require 'reivt/api'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reivt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vaemoi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-04-
|
12
|
+
date: 2017-04-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: graphql-client
|