MuranoCLI 3.1.0.beta.3 → 3.1.0.beta.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
- SHA1:
3
- metadata.gz: 25973070b3866a68896c64e0e6441c7074843861
4
- data.tar.gz: ae58ca8833ece3921eb83bf8599af83fe4f1efbe
2
+ SHA256:
3
+ metadata.gz: a496a97244bc5b3c72007dbeca1b1aba1727c5b04d30e0918ee89ea8bdfe7299
4
+ data.tar.gz: 9c2b8a4552c037a649c09eafe16eeed9ef758c85d2ac091bd13054ad5c5f7056
5
5
  SHA512:
6
- metadata.gz: 43414685ea25b78957e864971c26c238883c59bf857bc06615d0bde21be57c8b40688ba44e1bf837bd4648042f18ccc6c0aa25d160e8f4b0e180a09966b02325
7
- data.tar.gz: f7135347312c72ed57d579a53b6580fde26c4954fc570025b8e905b2c0c239a3fea4addbb06f6442ba03d3093d1dcfc52d39abc68027c97d19b686bbcb0bfe27
6
+ metadata.gz: 9fd6b6278866a777328db9aa3921e1e27f239ffdd4d880b97502c50e824d910e3ecaa5e6063cb5b6c8cad1813d6d7d16081cc9f38f53e281a367135a61c21fd4
7
+ data.tar.gz: e66db775e437b051dcee81a55f84861bb0fca0d022a144ee617cacb5ac3b86809731fdfffcd385e8622e04fa6d85129c08a533869313f25b3fb1989179a3d9e7
@@ -0,0 +1,27 @@
1
+ FROM ruby:2.2.9-jessie
2
+
3
+ USER root
4
+
5
+ ENV LANGUAGE en_US.UTF-8
6
+ ENV LANG en_US.UTF-8
7
+
8
+ RUN useradd -m -s /bin/bash --uid 1001 -G root jenkins
9
+
10
+ WORKDIR /app
11
+ COPY . /app
12
+
13
+ RUN /bin/chown -R jenkins /app
14
+
15
+ USER jenkins
16
+
17
+ RUN cd /app && \
18
+ gem install bundler && \
19
+ gem install rspec && \
20
+ bundler install && \
21
+ rake build
22
+
23
+ RUN gem install \
24
+ pkg/MuranoCLI-$(ruby -e \
25
+ 'require "/app/lib/MrMurano/version.rb"; puts MrMurano::VERSION' \
26
+ ).gem
27
+
@@ -0,0 +1,27 @@
1
+ FROM ruby:2.3.6-jessie
2
+
3
+ USER root
4
+
5
+ ENV LANGUAGE en_US.UTF-8
6
+ ENV LANG en_US.UTF-8
7
+
8
+ RUN useradd -m -s /bin/bash --uid 1001 -G root jenkins
9
+
10
+ WORKDIR /app
11
+ COPY . /app
12
+
13
+ RUN /bin/chown -R jenkins /app
14
+
15
+ USER jenkins
16
+
17
+ RUN cd /app && \
18
+ gem install bundler && \
19
+ gem install rspec && \
20
+ bundler install && \
21
+ rake build
22
+
23
+ RUN gem install \
24
+ pkg/MuranoCLI-$(ruby -e \
25
+ 'require "/app/lib/MrMurano/version.rb"; puts MrMurano::VERSION' \
26
+ ).gem
27
+
@@ -0,0 +1,27 @@
1
+ FROM ruby:2.4.3-jessie
2
+
3
+ USER root
4
+
5
+ ENV LANGUAGE en_US.UTF-8
6
+ ENV LANG en_US.UTF-8
7
+
8
+ RUN useradd -m -s /bin/bash --uid 1001 -G root jenkins
9
+
10
+ WORKDIR /app
11
+ COPY . /app
12
+
13
+ RUN /bin/chown -R jenkins /app
14
+
15
+ USER jenkins
16
+
17
+ RUN cd /app && \
18
+ gem install bundler && \
19
+ gem install rspec && \
20
+ bundler install && \
21
+ rake build
22
+
23
+ RUN gem install \
24
+ pkg/MuranoCLI-$(ruby -e \
25
+ 'require "/app/lib/MrMurano/version.rb"; puts MrMurano::VERSION' \
26
+ ).gem
27
+
@@ -0,0 +1,27 @@
1
+ FROM ruby:2.5.0-jessie
2
+
3
+ USER root
4
+
5
+ ENV LANGUAGE en_US.UTF-8
6
+ ENV LANG en_US.UTF-8
7
+
8
+ RUN useradd -m -s /bin/bash --uid 1001 -G root jenkins
9
+
10
+ WORKDIR /app
11
+ COPY . /app
12
+
13
+ RUN /bin/chown -R jenkins /app
14
+
15
+ USER jenkins
16
+
17
+ RUN cd /app && \
18
+ gem install bundler && \
19
+ gem install rspec && \
20
+ bundler install && \
21
+ rake build
22
+
23
+ RUN gem install \
24
+ pkg/MuranoCLI-$(ruby -e \
25
+ 'require "/app/lib/MrMurano/version.rb"; puts MrMurano::VERSION' \
26
+ ).gem
27
+
@@ -0,0 +1,47 @@
1
+ FROM ruby:2.2.9-jessie
2
+
3
+ USER root
4
+
5
+ ENV LANGUAGE en_US.UTF-8
6
+ ENV LANG en_US.UTF-8
7
+
8
+ RUN useradd -m -s /bin/bash --uid 1001 -G root jenkins
9
+
10
+ RUN \
11
+ echo "deb http://ftp.us.debian.org/debian/ jessie main contrib non-free" \
12
+ >> /etc/apt/sources.list \
13
+ && echo "deb-src http://ftp.us.debian.org/debian/ jessie main contrib non-free" \
14
+ >> /etc/apt/sources.list \
15
+ && apt-get -qq update \
16
+ && apt-get install -y curl \
17
+ && apt-get install -y bzip2 \
18
+ && apt-get install -y tar
19
+
20
+ WORKDIR /app
21
+ COPY . /app
22
+
23
+ RUN /bin/chown -R jenkins /app
24
+
25
+ USER jenkins
26
+
27
+ RUN cd /app && \
28
+ gem install bundler && \
29
+ gem install rspec && \
30
+ bundler install && \
31
+ rake build
32
+
33
+ RUN gem install \
34
+ pkg/MuranoCLI-$(ruby -e \
35
+ 'require "/app/lib/MrMurano/version.rb"; puts MrMurano::VERSION' \
36
+ ).gem
37
+
38
+ # Install github-release.
39
+
40
+ RUN mkdir -p /home/jenkins/Downloads && \
41
+ cd /home/jenkins/Downloads && \
42
+ curl -L https://github.com/aktau/github-release/releases/download/v0.6.2/linux-amd64-github-release.tar.bz2 | bzcat | tar xf - && \
43
+ mkdir -p /home/jenkins/bin && \
44
+ cp bin/linux/amd64/github-release /home/jenkins/bin/github-release
45
+
46
+ # vim:tw=0:ts=4:sw=4:noet:ft=conf:
47
+
@@ -0,0 +1,103 @@
1
+ FROM ruby:RUBY_VERSION()-jessie
2
+
3
+ dnl # NOTE: Environs from Jenkins, like ${WORKSPACE} or any passwords you
4
+ dnl # inject, are not available from here (Build Environment setup).
5
+ dnl #
6
+ dnl # This is already a given, but just to be clear:
7
+ USER root
8
+
9
+ dnl # Jenkins defaults to the ASCII encoding, but we want UTF-8.
10
+ dnl #
11
+ dnl # FIXME/MEH: (lb): Murano CLI still has encoding issues, e.g.,
12
+ dnl # the highline.say() command crashes on some strings, complaining:
13
+ dnl #
14
+ dnl # invalid byte sequence in US-ASCII
15
+ dnl #
16
+ dnl # which we currently work around by running Murand CLI in ASCII, e.g.,
17
+ dnl #
18
+ dnl # murano --no-progress --no-color --ascii ...
19
+ dnl #
20
+ dnl # which means our Jenkins/Docker test is not quite testing how
21
+ dnl # people usually run the app. Oh well.
22
+ dnl #
23
+ dnl # ((lb): I had hoped that setting ENV herein would help, and while it
24
+ dnl # does change the encoding for the `docker exec` command that Jenkins
25
+ dnl # runs later, it doesn't fix the "invalid byte sequence" error.)
26
+ dnl #
27
+ dnl # NOTE: You cannot change the encoding from the Execute Shell build
28
+ dnl # command. If you tried, you'd see, e.g.,:
29
+ dnl #
30
+ dnl # $ export LC_ALL=en_US.UTF-8
31
+ dnl # setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
32
+ dnl #
33
+ dnl # ALSO: Skip LC_ALL, otherwise when Jenkins runs `docker exec ...` you'll see:
34
+ dnl #
35
+ dnl # /bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
36
+ dnl #
37
+ ENV LANGUAGE en_US.UTF-8
38
+ ENV LANG en_US.UTF-8
39
+
40
+ dnl # Jenkins runs the Execute Shell script on Docker as the 'jenkins' user,
41
+ dnl # but Docker is confused unless we create that user now and assign it the
42
+ dnl # UID that gets used. ((lb): This is hacky; Ops might fix this eventually.)
43
+ dnl #
44
+ dnl # Without adding the user to the root group and having them run as such,
45
+ dnl # we'd see Errno::EACCES "Permission denied @ rb_sysopen" errors, and we'd
46
+ dnl # have to do the hideous, grotesque act of granting permissions to all:
47
+ dnl #
48
+ dnl # RUN /bin/chmod -R go+w /app
49
+ dnl # RUN /bin/chmod 2777 /app
50
+ dnl #
51
+ RUN useradd -m -s /bin/bash --uid 1001 -G root jenkins
52
+
53
+ dnl # (lb): So. Weird. Sometimes the Jenkins Docker Volumes mount with 2755
54
+ dnl # permissions. Othertimes with 2777. In case this happens again, I'll
55
+ dnl # leaving this code here. Give jenkins user power to fix permissions on the
56
+ dnl # mounted Volumes: /app/report and /app/coverage mount as 2755 root:root.
57
+ dnl # NOTE: Skipping `RUN apt-get upgrade -y` to run faster.
58
+ dnl # RUN \
59
+ dnl # echo "deb http://ftp.us.debian.org/debian/ jessie main contrib non-free" \
60
+ dnl # >> /etc/apt/sources.list \
61
+ dnl # && echo "deb-src http://ftp.us.debian.org/debian/ jessie main contrib non-free" \
62
+ dnl # >> /etc/apt/sources.list \
63
+ dnl # && apt-get -qq update \
64
+ dnl # && apt-get install -y sudo
65
+ dnl # #RUN echo "jenkins ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
66
+ dnl # RUN echo "jenkins ALL= NOPASSWD: chmod" >> /etc/sudoers
67
+ dnl #
68
+ dnl # Create the /app directory and give ownership to the new user, otherwise
69
+ dnl # if we switch to the new user first, they cannot create the workdir.
70
+ dnl #
71
+ WORKDIR /app
72
+ COPY . /app
73
+
74
+ RUN /bin/chown -R jenkins /app
75
+
76
+ dnl # Run as the new jenkins user, otherwise Ruby gem permissions are
77
+ dnl # restrictive, and we don't want to have to fudge them, e.g.,
78
+ dnl #
79
+ dnl # # Madness!
80
+ dnl # RUN chmod 2777 /usr/local/bundle
81
+ dnl # RUN chmod 2777 /usr/local/bundle/bin
82
+ dnl # RUN find /usr/local/bundle -type d -exec chmod 2777 {} +
83
+ dnl # RUN find /usr/local/bundle -type f -exec chmod u+rw,g+rw,o+rw {} +
84
+ dnl #
85
+ dnl # Prepare the bundle and rspec Ruby commands, and build Murano CLI.
86
+ dnl #
87
+ USER jenkins
88
+
89
+ RUN cd /app && \
90
+ gem install bundler && \
91
+ gem install rspec && \
92
+ bundler install && \
93
+ rake build
94
+
95
+ dnl # Install Murano CLI.
96
+ dnl #
97
+ RUN gem install \
98
+ pkg/MuranoCLI-$(ruby -e \
99
+ 'require "/app/lib/MrMurano/version.rb"; puts MrMurano::VERSION' \
100
+ ).gem
101
+
102
+ dnl # vim:tw=0:ts=4:sw=4:noet:ft=conf:
103
+ dnl
@@ -0,0 +1,261 @@
1
+ ########################
2
+ Murano CLI Jenkins Notes
3
+ ########################
4
+
5
+ ========================
6
+ Creating the Dockerfiles
7
+ ========================
8
+
9
+ (lb): I tried installing RVM in a bare Ubuntu Docker container, but I ended
10
+ up down a rabbit hole without any success. Fortunately, there are some ready-
11
+ made Ruby images available, albeit just for the latest Rubies (i.e., not for
12
+ Ruby 2.0 or Ruby 2.1). So we'll use these images, and we'll hopefully
13
+ deprecate support for the older Rubies, and then we won't have to make
14
+ RVM (or chruby) work.
15
+
16
+ Generate Dockerfiles from the M4 template:
17
+
18
+ .. code-block:: bash
19
+
20
+ for ruby_vers in \
21
+ "2.5.0" \
22
+ "2.4.3" \
23
+ "2.3.6" \
24
+ "2.2.9" \
25
+ ; do
26
+ m4 \
27
+ --define=RUBY_VERSION="${ruby_vers}" \
28
+ dockers/Dockerfile.m4 \
29
+ > dockers/Dockerfile.${ruby_vers}
30
+ done
31
+
32
+ ===============================================
33
+ Jenkins project configuration: Murano CLI Tests
34
+ ===============================================
35
+
36
+ - Jenkins project:
37
+
38
+ - NEW:
39
+
40
+ https://jenkins.exosite.com/job/MuranoCLI/job/Murano%20CLI%20Tests%20-%20Ruby%202.3/configure
41
+
42
+ - OLD:
43
+
44
+ https://build.exosite.com/view/MuranoCLI/job/MrMurano%20Tests/configure
45
+
46
+ - General configuration
47
+
48
+ - Project name: ``Murano CLI Tests - Ruby 2.3``
49
+
50
+ - Discard old builds ``✓``
51
+
52
+ - Strategy: ``Log Rotation``
53
+
54
+ - Days to keep builds: ``60``
55
+
56
+ - Max # builds to keep: ``5``
57
+
58
+ - GitHub project ``✓``
59
+
60
+ - Project url: https://github.com/exosite/MuranoCLI/
61
+
62
+ - Source Code Management
63
+
64
+ - Git ``✓``
65
+
66
+ - Repositories
67
+
68
+ - Repository URL: https://github.com/exosite/MuranoCLI.git
69
+
70
+ - Credentials: (SSH key. Set Deploy Key in GitHub; Credentials in Jenkins.)
71
+
72
+ - Branches to build
73
+
74
+ - Branch Specifier (blank for 'any') : ````
75
+
76
+ - Build Triggers
77
+
78
+ - GitHub hook trigger for GITScm polling ``✓``
79
+
80
+ - Build Environment
81
+
82
+ - Build inside a Docker container ``✓``
83
+
84
+ - Docker image to use
85
+
86
+ - Build from Dockerfile ``✓``
87
+
88
+ - path to docker context: ``.``
89
+
90
+ - Dockerfile: ``./dockers/Dockerfile.${RUBY_VERS}``
91
+
92
+ - [Click Advanced]
93
+
94
+ - Volumes
95
+
96
+ - Add
97
+
98
+ - Path on host: ``$WORKSPACE/report``
99
+
100
+ - Path inside container: ``/app/report``
101
+
102
+ - Add
103
+
104
+ - Path on host: ``$WORKSPACE/coverage``
105
+
106
+ - Path inside container: ``/app/coverage``
107
+
108
+ - User group: ``root``
109
+
110
+ - Container start command: ``/bin/cat``
111
+
112
+ - Network bridge: ``bridge``
113
+
114
+ - Inject passwords to the build as environment variables ``✓``
115
+
116
+ - Job passwords
117
+
118
+ - Add
119
+
120
+ - Name: ``LANDON_PASSWORD``
121
+
122
+ - Password: ``****************``
123
+
124
+ - Add
125
+
126
+ - Name: ``LANDON_USERNAME``
127
+
128
+ - Password: ``****************``
129
+
130
+ - Build
131
+
132
+ - Execute shell
133
+
134
+ - Command::
135
+
136
+ #!/bin/bash
137
+ /app/dockers/docker-test.sh
138
+
139
+ - Post-build Actions
140
+
141
+ - Publish HTML reports
142
+
143
+ - Reports
144
+
145
+ - Add
146
+
147
+ - HTML directory to archive: ``report``
148
+
149
+ - Index page[s]: ``index-2_2_7.html,index-2_3_4.html,index-2_4_1.html``
150
+
151
+ - Report title: ``RSpec Report``
152
+
153
+ - Add
154
+
155
+ - HTML directory to archive: ``coverage``
156
+
157
+ - Index page[s]: ``index.html``
158
+
159
+ - Report title: ``Coverage Report``
160
+
161
+ - E-mail Notification
162
+
163
+ - Recipients: ``landonbouma@exosite.com``
164
+
165
+ =====================================================
166
+ Jenkins project configuration: Murano CLI Gem Release
167
+ =====================================================
168
+
169
+ - Jenkins project:
170
+
171
+ - NEW:
172
+
173
+ *TBD*
174
+
175
+ - OLD:
176
+
177
+ https://build.exosite.com/view/MuranoCLI/job/MrMurano%20Gem%20Release/configure
178
+
179
+ - General configuration
180
+
181
+ - Project name: ``Murano CLI Gem Release``
182
+
183
+ - Discard old builds ``✓``
184
+
185
+ - Strategy: ``Log Rotation``
186
+
187
+ - Days to keep builds: ``60``
188
+
189
+ - Max # builds to keep: ``5``
190
+
191
+ - GitHub project ``✓``
192
+
193
+ - Project url: https://github.com/exosite/MuranoCLI/
194
+
195
+ - Source Code Management
196
+
197
+ - Git ``✓``
198
+
199
+ - Repositories
200
+
201
+ - Repository URL: https://github.com/exosite/MuranoCLI.git
202
+
203
+ - Credentials: (SSH key. Set Deploy Key in GitHub; Credentials in Jenkins.)
204
+
205
+ - Branches to build
206
+
207
+ - Branch Specifier (blank for 'any') : ``*/tags/*``
208
+
209
+ - Build Triggers
210
+
211
+ - Poll SCM ``✓``
212
+
213
+ - Schedule::
214
+
215
+ H/5 * * * *
216
+
217
+ - Build Environment
218
+
219
+ - Build inside a Docker container ``✓``
220
+
221
+ - Docker image to use
222
+
223
+ - Build from Dockerfile ``✓``
224
+
225
+ - path to docker context: ``.``
226
+
227
+ - Dockerfile: ``./dockers/Dockerfile.GemRelease``
228
+
229
+ - Inject environment variables to the build process ``✓``
230
+
231
+ - Properties Content::
232
+
233
+ GITHUB_REPO=MuranoCLI
234
+ GITHUB_USER=exosite
235
+ PATH=$HOME/bin:$PATH
236
+
237
+ - Inject passwords to the build as environment variables ``✓``
238
+
239
+ - Job passwords
240
+
241
+ - Name: ``GITHUB_TOKEN``
242
+
243
+ - Password: (App token generated on GitHub.)
244
+
245
+ - Mask password parameters ``✓``
246
+
247
+ - Build
248
+
249
+ - Execute shell
250
+
251
+ - Command::
252
+
253
+ #!/bin/bash
254
+ /app/dockers/gem-release.sh
255
+
256
+ - Post-build Actions
257
+
258
+ - Files to archive: ``pkg/MuranoCLI-*.gem``
259
+
260
+ FIXME: Missing GitHub & other notifications. See old job.
261
+
@@ -0,0 +1,97 @@
1
+ #!/bin/bash
2
+
3
+ # This script is called by the Jenkins Build step Execute Shell command,
4
+ # via `docker exec`.
5
+ #
6
+ # This script is run in a Docker container as user 'jenkins'. If Dockerfile
7
+ # did not set up the user first, you'd permissions issues, and you'd see
8
+ # weird behavior, such as:
9
+ #
10
+ # $ whoami
11
+ # sudo: unknown uid 1001: who are you?
12
+ # $ sudo whoami
13
+ # whoami: cannot find name for user ID 1001
14
+ # whoami:
15
+ # $ echo ${USER}
16
+ # jenkins
17
+ # $ users
18
+ # $ groups
19
+ # cannot find name for group ID 1001
20
+ # 1001
21
+ #
22
+ # To work around this, the Dockerfile calls `useradd ... jenkins`,
23
+ # and the Jenkins Build Environment "User group" is set to 'root'.
24
+ # (This
25
+
26
+ # Jenkins runs the Build step Execute Shell command from the
27
+ # ${WORKSPACE} directory, e.g.,
28
+ #
29
+ # /tmp/jenkins-ff750fb5/workspace/MuranoCLI/MrMurano Tests
30
+ #
31
+ # which is actually outside the Docker container (on the host).
32
+ #
33
+ # We use the advanced Docker option, Volumes, to wire our container to
34
+ # the host. Specifically, Dockerfile wires /app/report and /app/coverage
35
+ # to ${WORKSPACE}/report and ${WORKSPACE}/coverage, respectively.
36
+
37
+ # The Dockerfile uses ENV to change the encoding from ASCII, which
38
+ # we cannot do from within the container. You should see UTF-8.
39
+ #
40
+ # $ echo ${LANG}
41
+ # en_US.UTF-8
42
+
43
+ # Jenkins sets a few environs, like ${WORKSPACE}, and we pull in a few
44
+ # more from the Jenkins Environment Injector Plugin.
45
+
46
+ [[ -z ${WORKSPACE} ]] && echo "ERROR: Expected WORKSPACE to be set" && exit 1
47
+
48
+ export MURANO_USERNAME="${LANDON_USERNAME}"
49
+ export MURANO_PASSWORD="${LANDON_PASSWORD}"
50
+
51
+ [[ -z ${MURANO_USERNAME} ]] && echo "ERROR: Please set MURANO_USERNAME" && exit 1
52
+ [[ -z ${MURANO_PASSWORD} ]] && echo "ERROR: Please set MURANO_PASSWORD" && exit 1
53
+
54
+ # Create a basic Murano CLI config indicating the Murano account credentials.
55
+
56
+ cat > "${WORKSPACE}/test.run.muranocfg" <<-EOCFB
57
+ [user]
58
+ name = landonbouma+jenkins-nix@exosite.com
59
+ [business]
60
+ id = hd7opcgbyjfqd7vi
61
+ [net]
62
+ host = bizapi.hosted.exosite.io
63
+ EOCFB
64
+ export MURANO_CONFIGFILE="${WORKSPACE}/test.run.muranocfg"
65
+
66
+ # Switch to the project directory and run tests.
67
+
68
+ cd /app
69
+
70
+ # Instead of `rake test_clean_up -t`, call CLI directly with --no-color.
71
+
72
+ echo "Removing existing solutions from Murano account."
73
+
74
+ ruby -Ilib bin/murano solutions expunge -y --no-progress --no-color --ascii
75
+
76
+ # Fix the PATH to avoid the error:
77
+ #
78
+ # /tmp/jenkins8459777890102160498.sh: line 81: rspec: command not found
79
+ PATH=${PATH}:/usr/local/bundle/bin
80
+
81
+ # (lb): Sometimes the host drive directories mount as root:root with 2755
82
+ # permissions. But sometimes not. If it starts happening again, you'll see
83
+ # Errno::EACCES: Permission denied. Uncomment the sudoers code in Dockerfile.
84
+ # chmod 2777 /app/report
85
+ # chmod 2777 /app/coverage
86
+
87
+ echo "############################################################################################"
88
+ echo "Testing \"$(murano -v)\" on \"$(ruby -v)\""
89
+ echo "############################################################################################"
90
+
91
+ # Hint: Add `--example "<...>"` to limit the test suite.
92
+
93
+ rspec \
94
+ --format html \
95
+ --out /app/report/index-${RVERS}.html \
96
+ --format documentation
97
+
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+ ruby -v
3
+ rake build push:github:gem push:github:copyReleaseNotes
4
+
@@ -43,6 +43,8 @@ program :description, %(
43
43
  # etc., then do not do progress.
44
44
  # TEST/2017-08-23: Does this work on Windows?
45
45
  ARGV.push('--no-progress') unless $stdout.tty? || ARGV.include?('--no-progress')
46
+ ARGV.push('--ascii') unless $stdout.tty? || ARGV.include?('--ascii')
47
+ ARGV.push('--ascii') if ''.encode('ASCII').encoding == __ENCODING__
46
48
 
47
49
  default_command :help
48
50
 
@@ -7,6 +7,7 @@
7
7
 
8
8
  require 'highline'
9
9
  require 'inifile'
10
+ require 'os'
10
11
  require 'pathname'
11
12
  require 'rainbow'
12
13
  require 'MrMurano/verbosing'
@@ -47,7 +48,7 @@ module MrMurano
47
48
  if defined?($cfg) && !$cfg.nil? && $cfg['tool.dry']
48
49
  # $cfg.nil? when run from spec tests that don't load it with:
49
50
  # include_context "CI_CMD"
50
- MrMurano::Verbose.warning('--dry: Not writing config file')
51
+ warning('--dry: Not writing config file')
51
52
  return
52
53
  end
53
54
  self[:path] = Pathname.new(path) unless path.is_a?(Pathname)
@@ -332,13 +333,44 @@ module MrMurano
332
333
  root = nil
333
334
  when :project
334
335
  root = @project_dir + CFG_DIR_NAME
336
+ verbose %(file_at: @project_dir: #{@project_dir} / + #{CFG_DIR_NAME} / #{root})
335
337
  when :user
336
338
  root = Pathname.new(Dir.home) + CFG_DIR_NAME
339
+ verbose %(file_at: Dir.home: #{Dir.home} / + #{CFG_DIR_NAME} / #{root})
337
340
  when :defaults
338
341
  root = nil
339
342
  end
340
343
  return nil if root.nil?
341
- root.mkpath
344
+ begin
345
+ root.mkpath
346
+ rescue StandardError => err
347
+ error %(Failed to "#{root}".mkpath: #{err})
348
+ verbose %(Dir.pwd: #{Dir.pwd})
349
+ if OS.windows?
350
+ # Ref:
351
+ # https://stackoverflow.com/questions/3258518/ruby-get-available-disk-drives
352
+ require 'win32ole'
353
+ file_system = WIN32OLE.new('Scripting.FileSystemObject')
354
+ drives = file_system.Drives
355
+ drives.each do |drive|
356
+ verbose %(Drive "#{drive.DriveLetter}":)
357
+ verbose Dir.entries(drive.Path + '\\')
358
+ end
359
+ if root.to_s[1] == ':'
360
+ # MUR-5081: (lb): I am confused. The user's error is EINVAL:
361
+ # in `mkdir': Invalid argument @ dir_s_mkdir - H: (Errno::EINVAL)
362
+ # Which is very strange. When testing on Windows, I can only generate the
363
+ # error, ENOENT, "No such file or directory @ dir_s_mkdir - H:." when
364
+ # trying, e.g., Pathname.new("H:").mkpath, and related. So I'm confused.
365
+ drive_lr = root.to_s.slice(0, 2)
366
+ path_start = 2
367
+ path_start = 3 if root.to_s[2] == '\\'
368
+ dir_path = root.to_s.slice(path_start, len(root.to_s))
369
+ verbose %(drive_lr: #{drive_lr} / dir_path: #{dir_path})
370
+ end
371
+ end
372
+ raise
373
+ end
342
374
  root + name
343
375
  end
344
376
 
@@ -252,7 +252,7 @@ def solution_delete(name_or_id, use_sol: nil, type: :all, yes: false)
252
252
  MrMurano::Verbose.whirly_start('Deleting solutions...')
253
253
  solz.each do |sol|
254
254
  ret = biz.delete_solution(sol.sid)
255
- if !ret.is_a?(Hash) && !ret.empty?
255
+ if ret.nil? || (!ret.is_a?(Hash) && !ret.empty?)
256
256
  MrMurano::Verbose.error("Delete failed: #{ret}")
257
257
  n_faulted += 1
258
258
  else
@@ -20,7 +20,9 @@ module MrMurano
20
20
  end
21
21
  HighLine.color_scheme = PRETTIES_COLORSCHEME
22
22
 
23
- TERM_WIDTH, _rows = HighLine::SystemExtensions.terminal_size
23
+ TERM_WIDTH, _rows = (
24
+ !$stdout.tty? && [0, 0] || HighLine::SystemExtensions.terminal_size
25
+ )
24
26
 
25
27
  # rubocop:disable Style/MethodName: "Use snake_case for method names."
26
28
  def self.makeJsonPretty(data, options, indent: nil, object_nl: nil)
@@ -92,7 +94,10 @@ module MrMurano
92
94
  inter_spaces = (min_width == 0) && 0 || options.one_line && 1 || 3
93
95
  min_width = text.length + inter_spaces unless options.align
94
96
  if !options.one_line && options.align && min_width == 0
95
- prefix = TERM_WIDTH - raw.length - text.length
97
+ prefix = 0
98
+ if TERM_WIDTH > (raw.length - text.length)
99
+ prefix = TERM_WIDTH - raw.length - text.length
100
+ end
96
101
  out += ' ' * prefix
97
102
  raw += ' ' * prefix
98
103
  end
@@ -26,7 +26,7 @@ module MrMurano
26
26
  # '3.0.0-beta.2' is changed to '3.0.0.pre.beta.2'
27
27
  # which breaks our build (which expects the version to match herein).
28
28
  # So stick to using the '.pre.X' syntax, which ruby/gems knows.
29
- VERSION = '3.1.0.beta.3'
29
+ VERSION = '3.1.0.beta.8'
30
30
  EXE_NAME = File.basename($PROGRAM_NAME)
31
31
  SIGN_UP_URL = 'https://exosite.com/signup/'
32
32
  end
data/spec/cmd_common.rb CHANGED
@@ -250,7 +250,9 @@ RSpec.shared_context 'CI_CMD' do
250
250
  # +Linked ΓÇÿsyncdowntestprd1e8b4034ΓÇÖ to ΓÇÿsyncdowntestapp23d5135bΓÇÖ
251
251
  #
252
252
  # which we can solve with an encode call. (Or but using norm quotes.)
253
- str.encode!('UTF-8', 'UTF-8').tr(%(‘), %(')).tr(%(’), %('))
253
+ str.nil? && "" || str.encode!(
254
+ 'UTF-8', 'UTF-8').tr(%(‘), %(')).tr(%(’), %(')
255
+ )
254
256
  end
255
257
 
256
258
  # *** rb-commander goodies
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: MuranoCLI
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.beta.3
4
+ version: 3.1.0.beta.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Conrad Tadpol Tilstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-12 00:00:00.000000000 Z
11
+ date: 2018-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: certified
@@ -462,6 +462,15 @@ files:
462
462
  - Rakefile
463
463
  - TODO.taskpaper
464
464
  - bin/murano
465
+ - dockers/Dockerfile.2.2.9
466
+ - dockers/Dockerfile.2.3.6
467
+ - dockers/Dockerfile.2.4.3
468
+ - dockers/Dockerfile.2.5.0
469
+ - dockers/Dockerfile.GemRelease
470
+ - dockers/Dockerfile.m4
471
+ - dockers/README.rst
472
+ - dockers/docker-test.sh
473
+ - dockers/gem-release.sh
465
474
  - docs/basic_example.rst
466
475
  - docs/completions/murano_completion-bash
467
476
  - docs/demo.md
@@ -656,7 +665,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
656
665
  version: 1.3.1
657
666
  requirements: []
658
667
  rubyforge_project:
659
- rubygems_version: 2.4.5.2
668
+ rubygems_version: 2.7.4
660
669
  signing_key:
661
670
  specification_version: 4
662
671
  summary: Do more from the command line with Murano