conjur-asset-ui 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -1
  3. data/.jshintrc +41 -0
  4. data/Gemfile +3 -1
  5. data/README.md +34 -0
  6. data/Rakefile +69 -1
  7. data/bower.json +93 -0
  8. data/conjur-asset-ui.gemspec +1 -1
  9. data/features/navigation_bar.feature +31 -0
  10. data/features/step_definitions/custom_step.rb +32 -0
  11. data/features/support/env.rb +38 -0
  12. data/features/support/hooks.rb +30 -0
  13. data/features/support/world.rb +17 -0
  14. data/gulpfile.js +140 -0
  15. data/lib/conjur/command/ui.rb +1 -1
  16. data/lib/conjur/webserver/server.rb +14 -9
  17. data/lib/conjur-asset-ui-version.rb +1 -1
  18. data/package.json +47 -0
  19. data/preprocessor.js +7 -0
  20. data/public/_client_libs.html +2 -15
  21. data/public/css/styles.less +170 -4
  22. data/public/index.html.erb +5 -7
  23. data/public/js/init.js +183 -97
  24. data/public/js/lib/sorted-set.no-require.js +3 -28
  25. data/public/js/models/groupRecord.js +12 -11
  26. data/public/js/models/hostRecord.js +6 -7
  27. data/public/js/models/layerRecord.js +12 -11
  28. data/public/js/models/namespace.js +2 -0
  29. data/public/js/models/policyList.js +3 -1
  30. data/public/js/models/policyRecord.js +6 -7
  31. data/public/js/models/record.js +24 -23
  32. data/public/js/models/resourceList.js +28 -10
  33. data/public/js/models/userList.js +7 -2
  34. data/public/js/models/userRecord.js +7 -8
  35. data/public/js/models/variableList.js +18 -7
  36. data/public/js/models/variableRecord.js +13 -12
  37. data/public/js/routers.js +72 -26
  38. data/public/js/views/annotations.js +38 -27
  39. data/public/js/views/audit.js +23 -17
  40. data/public/js/views/chart.js +471 -0
  41. data/public/js/views/dashboard.js +94 -58
  42. data/public/js/views/generic.js +16 -9
  43. data/public/js/views/group.js +94 -55
  44. data/public/js/views/groups.js +3 -7
  45. data/public/js/views/host.js +75 -44
  46. data/public/js/views/hosts.js +2 -6
  47. data/public/js/views/layer.js +127 -82
  48. data/public/js/views/layers.js +2 -6
  49. data/public/js/views/mixins/search.js +12 -5
  50. data/public/js/views/mixins/tabs.js +95 -55
  51. data/public/js/views/navSearch.js +16 -5
  52. data/public/js/views/owned.js +14 -8
  53. data/public/js/views/permissions.js +244 -178
  54. data/public/js/views/policies.js +2 -4
  55. data/public/js/views/policy.js +65 -38
  56. data/public/js/views/resource.js +49 -34
  57. data/public/js/views/role.js +52 -37
  58. data/public/js/views/searchResults.js +205 -138
  59. data/public/js/views/time.js +26 -13
  60. data/public/js/views/user.js +178 -55
  61. data/public/js/views/users.js +2 -7
  62. data/public/js/views/variable.js +226 -45
  63. data/public/js/views/variables.js +4 -8
  64. metadata +20 -20
  65. data/public/_client_code.html +0 -42
  66. data/public/css/bootstrap.css +0 -7
  67. data/public/fonts/glyphicons-halflings-regular.eot +0 -0
  68. data/public/fonts/glyphicons-halflings-regular.svg +0 -229
  69. data/public/fonts/glyphicons-halflings-regular.ttf +0 -0
  70. data/public/fonts/glyphicons-halflings-regular.woff +0 -0
  71. data/public/js/lib/JSXTransformer.js +0 -10862
  72. data/public/js/lib/async.js +0 -958
  73. data/public/js/lib/backbone.js +0 -2
  74. data/public/js/lib/bootstrap.js +0 -6
  75. data/public/js/lib/less.js +0 -16
  76. data/public/js/lib/moment.js +0 -7768
  77. data/public/js/lib/react-bootstrap.js +0 -5346
  78. data/public/js/lib/react-bootstrap.min.js +0 -4
  79. data/public/js/lib/underscore-min.js +0 -6
  80. data/public/js/lib/underscore.string.min.js +0 -1
  81. data/public/js/main.js +0 -57
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 797e36ccfd5fb14495ce552972ae5f3cc2cc8047
4
- data.tar.gz: aa0c926a8d45522ff5d373053c8fda223193fdd5
3
+ metadata.gz: 920fae5bec5f5fb7db777ce8d62f8757c899d46f
4
+ data.tar.gz: 901a548a419973aa082def5ca02a1f686575f363
5
5
  SHA512:
6
- metadata.gz: 046312f295fe2b3da327bc129f02ca90dd57d781e2e9805dacf42eebcc12a4a127c62b4d87510a46f5c773aabda54524e097f1059c6f932c84eceaa5d93cd02c
7
- data.tar.gz: 082f28dad66cc39ea27b14b8846320a23375400affea0bfe32c9081f1999c7c425c2ddf3cdefde80e79f362012e1c69dd2853937bf5911dae0af980a93a01067
6
+ metadata.gz: 61d7902bcfc38bd17b99ba8ddab248329892e41f9cef1849953703aead6a418fe3502b87d7ca86dadfee6216c2fca2a7a8cc45f9dab9f3a84e327f11116c90a3
7
+ data.tar.gz: 59b390672aecf91d10b0b0886a1efd3638b680ac736c6a8554d63d3fe38f7c8f6e3316015a49b594fbcb4ca635a3c53a69f40271771f653ea381c28c332062df
data/.gitignore CHANGED
@@ -17,4 +17,6 @@ test/version_tmp
17
17
  tmp
18
18
  .idea
19
19
  .DS_Store
20
-
20
+ bower_components/
21
+ node_modules/
22
+ public/build/
data/.jshintrc ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "bitwise": true,
3
+ "camelcase": true,
4
+ "curly": true,
5
+ "eqeqeq": true,
6
+ "es3": true,
7
+ "forin": true,
8
+ "freeze": true,
9
+ "immed": false,
10
+ "indent": 4,
11
+ "latedef": true,
12
+ "newcap": false,
13
+ "noarg": true,
14
+ "noempty": true,
15
+ "nonbsp": true,
16
+ "nonew": true,
17
+ "plusplus": false,
18
+ // "quotmark": "single",
19
+ "undef": true,
20
+ "unused": true,
21
+ "strict": true,
22
+ "maxparams": 8,
23
+ "maxdepth": 4,
24
+ "maxstatements": 20,
25
+ "maxcomplexity": 20,
26
+ "maxlen": 100,
27
+ "browser": true,
28
+ "couch": false,
29
+ "devel": true,
30
+ "dojo": false,
31
+ "jquery": true,
32
+ "mootools": false,
33
+ "node": false,
34
+ "nonstandard": true,
35
+ "phantom": false,
36
+ "prototypejs": false,
37
+ "rhino": false,
38
+ "worker": false,
39
+ "wsh": false,
40
+ "yui": false
41
+ }
data/Gemfile CHANGED
@@ -5,4 +5,6 @@ gemspec
5
5
 
6
6
  group :development do
7
7
  gem 'pry'
8
- end
8
+ gem 'selenium-cucumber'
9
+ gem 'background_process'
10
+ end
data/README.md CHANGED
@@ -39,3 +39,37 @@ And run the UI:
39
39
  ```
40
40
  conjur ui
41
41
  ```
42
+
43
+ ## Development
44
+
45
+ ### System Dependencies
46
+
47
+ * rvm with installed Ruby
48
+ * npm
49
+
50
+ ### Setup
51
+
52
+ Create a gemset with [rvm](http://rvm.io):
53
+
54
+ ```sh-session
55
+ $ rvm gemset use conjur-asset-ui --create
56
+ $ bundle install
57
+ ```
58
+
59
+ Run `rake prepare:deps`, and `rake assets:build` to build js and css assets.
60
+
61
+ ### Running the project
62
+
63
+ Open 2 terminal tabs.
64
+
65
+ In one, run `rake assets:watch`. In the other run `conjur ui`.
66
+
67
+ gulp will rebuild assets as needed when files change.
68
+
69
+ ### Testing
70
+
71
+ ```sh-session
72
+ $ rake features
73
+ # or run only features marked with wip tag
74
+ $ rake features:wip
75
+ ```
data/Rakefile CHANGED
@@ -1,3 +1,71 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
+
2
3
  require 'jasmine'
3
4
  load 'jasmine/tasks/jasmine.rake'
5
+
6
+ begin
7
+ require 'cucumber'
8
+ require 'cucumber/rake/task'
9
+
10
+ Cucumber::Rake::Task.new(:features) do |t|
11
+ t.cucumber_opts = '--format pretty'
12
+ end
13
+
14
+ Cucumber::Rake::Task.new('features:wip') do |t|
15
+ t.cucumber_opts = '--format pretty --tags @wip'
16
+ end
17
+
18
+ rescue LoadError
19
+ desc 'Cucumber rake task not available'
20
+
21
+ task :features do
22
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
23
+ end
24
+ end
25
+
26
+ namespace :deps do
27
+ desc 'Installs non-ruby dependencies like gulp, bower and nodejs packages'
28
+ task :install do
29
+ sh 'sudo npm install -g gulp bower'
30
+ sh 'npm install'
31
+ sh 'bower install'
32
+ end
33
+
34
+ desc 'Updates npm and bower packages'
35
+ task :update do
36
+ sh 'npm update'
37
+ sh 'bower update'
38
+ end
39
+
40
+ desc 'Removes npm and bower packages from filesystem'
41
+ task :clean do
42
+ sh 'rm -rf node_modules'
43
+ sh 'rm -rf bower_components'
44
+ end
45
+ end
46
+
47
+ namespace :assets do
48
+ desc 'Build js and css'
49
+ task :build do
50
+ sh 'gulp build'
51
+ end
52
+
53
+ desc 'Watch the assets files and rebuild when one of them changes'
54
+ task :watch => :build do
55
+ sh 'gulp watch'
56
+ end
57
+
58
+ desc 'Clean builded assets'
59
+ task :clean do
60
+ sh 'gulp clean'
61
+ end
62
+ end
63
+
64
+ task :build => %w(deps:install assets:build)
65
+
66
+ namespace :git do
67
+ desc 'Executes git clean'
68
+ task :clean do
69
+ sh 'git clean -dfX'
70
+ end
71
+ end
data/bower.json ADDED
@@ -0,0 +1,93 @@
1
+ {
2
+ "name": "conjur-asset-ui",
3
+ "private": true,
4
+ "version": "1.2.0",
5
+ "homepage": "https://github.com/conjurinc/conjur-asset-ui",
6
+ "authors": [
7
+ "Nikolai Sevostjanov <nikolai.sevostjanov@gmail.com>"
8
+ ],
9
+ "license": "MIT",
10
+ "ignore": [
11
+ "**/.*",
12
+ "node_modules",
13
+ "bower_components",
14
+ "test",
15
+ "tests"
16
+ ],
17
+ "dependencies": {
18
+ "jquery": "~2.1.1",
19
+ "async": "~0.9.0",
20
+ "backbone": "~1.1.2",
21
+ "moment": "~2.8.3",
22
+ "underscore": "~1.7.0",
23
+ "underscore.string": "~2.3.3",
24
+ "react": "~0.11.2",
25
+ "bootstrap": "~3.2.0",
26
+ "react-bootstrap": "~0.12.0",
27
+ "d3": "~3.4.13",
28
+ "underscore-deep-extend": "~0.0.5"
29
+ },
30
+ "overrides": {
31
+ "jquery": {
32
+ "main": [
33
+ "dist/jquery.min.js",
34
+ "dist/jquery.min.map"
35
+ ]
36
+ },
37
+ "async": {
38
+ "main": [
39
+ "lib/async.js"
40
+ ]
41
+ },
42
+ "backbone": {
43
+ "main": [
44
+ "backbone.js"
45
+ ]
46
+ },
47
+ "moment": {
48
+ "main": [
49
+ "min/moment-with-locales.min.js"
50
+ ]
51
+ },
52
+ "underscore": {
53
+ "main": [
54
+ "underscore-min.js"
55
+ ]
56
+ },
57
+ "underscore.string": {
58
+ "main": [
59
+ "lib/underscore.string.js"
60
+ ]
61
+ },
62
+ "react": {
63
+ "main": [
64
+ "react-with-addons.min.js"
65
+ ]
66
+ },
67
+ "react-bootstrap": {
68
+ "main": [
69
+ "react-bootstrap.min.js"
70
+ ]
71
+ },
72
+ "bootstrap": {
73
+ "main": [
74
+ "dist/js/bootstrap.min.js",
75
+ "dist/css/bootstrap.min.css",
76
+ "dist/fonts/*.eot",
77
+ "dist/fonts/*.svg",
78
+ "dist/fonts/*.ttf",
79
+ "dist/fonts/*.woff"
80
+ ]
81
+ },
82
+ "d3": {
83
+ "main": [
84
+ "d3.min.js"
85
+ ]
86
+ },
87
+ "underscore-deep-extend": {
88
+ "main": [
89
+ "index.js"
90
+ ]
91
+ }
92
+ }
93
+ }
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = ""
14
14
  spec.license = "MIT"
15
15
 
16
- spec.files = `git ls-files`.split($/)
16
+ spec.files = `git ls-files`.split($/) + `find public/build`.split($/)
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
@@ -0,0 +1,31 @@
1
+ Feature: Navigation menu
2
+ Scenario: Open Dashboard page
3
+ Given I should logged in
4
+ When I click on the button Dashboard of the navigation menu
5
+ Then element having css "#content .dashboard" should be present
6
+
7
+ Scenario Outline: Open page using navigation bar
8
+ Given I should logged in
9
+ When I click on the button <btn> of the navigation menu
10
+ Then the <box> list should be present
11
+ And the <btn> button of the navigation menu should be active
12
+ And other button except the <btn> button of the navigation menu should be not active
13
+
14
+ Examples:
15
+ | btn | box |
16
+ | Users | User |
17
+ | Groups | Group |
18
+ | Hosts | Host |
19
+ | Layers | Layer |
20
+ | Variables | Variable |
21
+ | Policies | Policy |
22
+
23
+ Scenario: Open Audit page
24
+ Given I should logged in
25
+ When I click on the button Audit of the navigation menu
26
+ Then element having css "#content .audit h3" should be present
27
+ And the Audit button of the navigation menu should be active
28
+ And other button except the Audit button of the navigation menu should be not active
29
+
30
+ Scenario: Close the browser
31
+ Then I close browser
@@ -0,0 +1,32 @@
1
+ require 'selenium-cucumber'
2
+
3
+ Given(/^I should logged in$/) do
4
+ step %[I navigate to "#{login_url}"]
5
+ end
6
+
7
+ When(/^I click on the button (.*) of the navigation menu$/) do |btn|
8
+ id = navigation_btn_to_id(btn)
9
+
10
+ step %[I click on element having css ".navbar .dropdown a"]
11
+ step %[element having css "#{id} a" should be present]
12
+ step %[I click on element having css "#{id} a"]
13
+ end
14
+
15
+ Then(/^the (.*) button of the navigation menu should be active$/) do |btn|
16
+ id = navigation_btn_to_id(btn)
17
+
18
+ step %[I click on element having css ".navbar .dropdown a"]
19
+ step %[element having css "#{id}.active a" should be present]
20
+ end
21
+
22
+ Then(/^the (.*) list should be present$/) do |btn|
23
+ btn = btn.downcase
24
+
25
+ step %[element having css "#content .#{btn}Box .#{btn}List h2" should be present]
26
+ end
27
+
28
+ Then(/^other button except the (.*) button of the navigation menu should be not active$/) do |btn|
29
+ id = navigation_btn_to_id(btn)
30
+
31
+ WAIT.until { $driver.find_elements(:css => '.navbar li.active').count } == 1
32
+ end
@@ -0,0 +1,38 @@
1
+ require 'rubygems'
2
+ require 'selenium-webdriver'
3
+
4
+ def print_error
5
+ puts "\nInappropraite browser \"#{ENV['BROWSER']}\""
6
+ puts "\nUsage : cucumber BROWSER=browser_name"
7
+ puts "\nbrowser_name can be one of following :"
8
+ puts "1.ie\n2.chrome\n3.ff\n4.safari\n5.opera"
9
+ puts "\nNow using default browser \"Firefox\""
10
+ end
11
+
12
+ case ENV['BROWSER']
13
+ when 'ie'
14
+ browser_type = :ie
15
+ when 'ff'
16
+ browser_type = :ff
17
+ when 'chrome'
18
+ browser_type = :chrome
19
+ when 'opera'
20
+ browser_type = :opera
21
+ when 'safari'
22
+ browser_type = :safari
23
+ else
24
+ if ENV['BROWSER']
25
+ print_error
26
+ end
27
+
28
+ browser_type = :ff
29
+ end
30
+
31
+
32
+ begin
33
+ $driver = Selenium::WebDriver.for(browser_type)
34
+ $driver.manage().window().maximize()
35
+
36
+ rescue Exception => e
37
+ puts e.message
38
+ end
@@ -0,0 +1,30 @@
1
+ Before do
2
+ require 'background_process'
3
+ command = 'conjur ui'
4
+
5
+ ENV['DONT_OPEN_IN_BROWSER'] = 'true'
6
+
7
+ @process = PTYBackgroundProcess.run command
8
+
9
+ exit = false
10
+
11
+ until exit do
12
+ raw_line = @process.stdout.gets
13
+
14
+ unless (match = /^If your browser did not opened the UI automatically, point it to (.*)$/.match(raw_line)).nil?
15
+ @login_url = match[1]
16
+ exit = true
17
+ end
18
+ end
19
+
20
+ raise "Can't run #{command}" unless @process.running?
21
+
22
+ @process_thread = Thread.new do
23
+ # pass
24
+ end
25
+ end
26
+
27
+ After do
28
+ @process_thread.kill
29
+ @process.kill('TERM')
30
+ end
@@ -0,0 +1,17 @@
1
+ module UIWorld
2
+ def login_url
3
+ @login_url
4
+ end
5
+
6
+ def navigation_btn_to_id(btn)
7
+ id = "#nav-#{btn.downcase}"
8
+
9
+ if btn == 'Dashboard'
10
+ id = '#nav-home'
11
+ end
12
+
13
+ id
14
+ end
15
+ end
16
+
17
+ World(UIWorld)
data/gulpfile.js ADDED
@@ -0,0 +1,140 @@
1
+ var gulp = require('gulp'),
2
+ autoprefixer = require('gulp-autoprefixer'),
3
+ flatten = require('gulp-flatten'),
4
+ cache = require('gulp-cached'),
5
+ concat = require('gulp-concat'),
6
+ uglify = require('gulp-uglify'),
7
+ plumber = require('gulp-plumber'),
8
+ react = require('gulp-react'),
9
+ remember = require('gulp-remember'),
10
+ jshint = require('gulp-jshint'),
11
+ stylish = require('jshint-stylish'),
12
+ less = require('gulp-less'),
13
+ sourcemaps = require('gulp-sourcemaps'),
14
+ mainBowerFiles = require('main-bower-files'),
15
+ minifyCSS = require('gulp-minify-css'),
16
+ filter = require('gulp-filter'),
17
+ del = require('del');
18
+
19
+ var paths = {
20
+ bower: 'bower_components',
21
+ styles: 'public/css/*.less',
22
+ scripts: [
23
+ 'public/js/init.js',
24
+ 'public/js/models/record.js',
25
+ 'public/js/models/*.js',
26
+ 'public/js/views/owned.js',
27
+ 'public/js/views/chart.js',
28
+ 'public/js/views/resource.js',
29
+ 'public/js/views/role.js',
30
+ 'public/js/views/role.js',
31
+ 'public/js/views/permissions.js',
32
+ 'public/js/views/time.js',
33
+ 'public/js/views/mixins/search.js',
34
+ 'public/js/views/mixins/tabs.js',
35
+ 'public/js/views/**/*.js',
36
+ 'public/js/routers.js'
37
+ ]
38
+ };
39
+
40
+ gulp.task('clean', function(cb) {
41
+ del(['public/build'], cb);
42
+ });
43
+
44
+ gulp.task('bower', function() {
45
+ var jsFilter = filter(function(file) {
46
+ return /\.js$/.test(file.path) && !/\.min\.js$/.test(file.path);
47
+ });
48
+
49
+ var jsMinFilter = filter(['*.min.js']),
50
+ cssFilter = filter(['*.min.css']),
51
+ fontFilter = filter(['*.eot', '*.woff', '*.svg', '*.ttf']);
52
+
53
+ return gulp
54
+ .src(mainBowerFiles())
55
+ .pipe(fontFilter)
56
+ .pipe(flatten())
57
+ .pipe(gulp.dest('public/build/fonts'))
58
+ .pipe(fontFilter.restore())
59
+
60
+ .pipe(jsFilter)
61
+ .pipe(concat('vendor.min.js'))
62
+ .pipe(uglify())
63
+ .pipe(jsFilter.restore())
64
+
65
+ .pipe(jsMinFilter)
66
+ .pipe(concat('vendor.min.js'))
67
+ .pipe(gulp.dest('public/build/js'))
68
+ .pipe(jsFilter.restore())
69
+
70
+ .pipe(cssFilter)
71
+ .pipe(concat('vendor.css'))
72
+ .pipe(gulp.dest('public/build/css'))
73
+ .pipe(cssFilter.restore());
74
+ });
75
+
76
+ gulp.task('scripts', function() {
77
+ return gulp.src(paths.scripts)
78
+ .pipe(cache('scripts'))
79
+ .pipe(plumber())
80
+ .pipe(react())
81
+ .pipe(plumber.stop())
82
+ .pipe(remember('scripts'))
83
+ .pipe(sourcemaps.init())
84
+ .pipe(concat('app.min.js'))
85
+ .pipe(uglify())
86
+ .pipe(sourcemaps.write('../maps'))
87
+ .pipe(gulp.dest('public/build/js'));
88
+ });
89
+
90
+ gulp.task('jshint', function() {
91
+ var stream = gulp.src(paths.scripts)
92
+ .pipe(cache('linting'))
93
+ .pipe(plumber())
94
+ .pipe(react())
95
+ .pipe(plumber.stop())
96
+ .pipe(jshint())
97
+ .pipe(jshint.reporter(stylish));
98
+
99
+ if (process.env.CI) {
100
+ stream = stream.pipe(jshint.reporter('fail'));
101
+ }
102
+
103
+ return stream;
104
+ });
105
+
106
+ gulp.task('styles', function() {
107
+ return gulp.src(paths.styles)
108
+ // https://github.com/plus3network/gulp-less/pull/85
109
+ // .pipe(sourcemaps.init())
110
+ .pipe(less())
111
+ .pipe(autoprefixer({
112
+ browsers: ['> 1%', 'last 2 versions', 'Firefox ESR'],
113
+ cascade: false
114
+ }))
115
+ .pipe(minifyCSS({keepBreaks: true}))
116
+ // .pipe(sourcemaps.write('../maps'))
117
+ .pipe(gulp.dest('public/build/css'));
118
+ });
119
+
120
+ gulp.task('watch', function(cb) {
121
+ gulp.watch(paths.bower, ['bower']);
122
+ gulp.watch(paths.styles, ['styles']);
123
+
124
+ var watcher = gulp.watch(paths.scripts, ['jshint', 'scripts']);
125
+
126
+ watcher.on('change', function (event) {
127
+ if (event.type === 'deleted') {
128
+ delete cache.caches['scripts'][event.path];
129
+ remember.forget('scripts', event.path);
130
+ }
131
+ });
132
+
133
+ cb();
134
+
135
+ console.log('Watching files for changes...');
136
+ });
137
+
138
+ gulp.task('build', ['bower', 'styles', 'jshint', 'scripts']);
139
+
140
+ gulp.task('default', ['build']);
@@ -27,7 +27,7 @@ class Conjur::Command::UI < Conjur::Command
27
27
 
28
28
  #TODO: login page
29
29
  api # just initialize API so if user is not logged in it will be asked for credentials *before* server is launched
30
- @@api=nil # reset to avoid conflicts on server launch
30
+ @@api=nil # reset to avoid conflicts on server launch
31
31
 
32
32
  # ugly hack to override Configuration.env issues which are not working any more
33
33
  # after removal of sticky configurations support
@@ -30,7 +30,12 @@ module Conjur
30
30
  require 'conjur/webserver/api_proxy'
31
31
  require 'conjur/webserver/home'
32
32
  require 'conjur/webserver/conjur_info'
33
- require 'pry'
33
+
34
+ # Pry is optional
35
+ begin
36
+ require 'pry'
37
+ rescue LoadError
38
+ end
34
39
 
35
40
  sessionid = self.sessionid
36
41
  cookie_options = {
@@ -53,7 +58,7 @@ module Conjur
53
58
  api_stack.each{|args| use *args}
54
59
  run Conjur::WebServer::APIProxy.new
55
60
  end
56
- %w(js css fonts images).each do |path|
61
+ %w(build js css fonts images).each do |path|
57
62
  map "/#{path}" do
58
63
  run Rack::File.new(File.join(root, path), 'Cache-Control' => 'max-age=0')
59
64
  end
@@ -78,23 +83,23 @@ module Conjur
78
83
 
79
84
  Rack::Server.start(options)
80
85
  end
81
-
86
+
82
87
  def open
83
88
  require 'launchy'
84
89
  url = "http://localhost:#{port}/login?sessionid=#{sessionid}"
85
90
  # as launchy sometimes silently fails, we need human-friendly failover
86
- $stderr.puts "If your browser did not opened the UI automatically, point it to #{url}"
87
- Launchy.open(url)
91
+ $stderr.puts "If your browser did not opened the UI automatically, point it to #{url}"
92
+ Launchy.open(url) unless ENV['DONT_OPEN_IN_BROWSER']
88
93
  end
89
-
94
+
90
95
  protected
91
-
96
+
92
97
  def port
93
98
  @port ||= find_available_port
94
99
  end
95
100
 
96
101
  DEFAULT_PORT = 42_289
97
-
102
+
98
103
  def find_available_port
99
104
  begin
100
105
  server = TCPServer.new('127.0.0.1', 0)
@@ -103,7 +108,7 @@ module Conjur
103
108
  server.close if server
104
109
  end
105
110
  end
106
-
111
+
107
112
  def sessionid
108
113
  require 'securerandom'
109
114
  @sessionid ||= SecureRandom.hex(32)
@@ -1,7 +1,7 @@
1
1
  module Conjur
2
2
  module Asset
3
3
  module UI
4
- VERSION="1.3.0"
4
+ VERSION="1.3.1"
5
5
  end
6
6
  end
7
7
  end