duse 0.0.7 → 0.0.8

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OGVhZjcyNzI1NmQ0YmJmMjQ5OGYyMjNiNWY0NDhjZmNkZGQwYWRmMQ==
4
+ NmJhZWI3MDgxZmFmMTM3MWY0MGI0N2Y2YzY3NjE1Zjg1YTg4ZmMwZA==
5
5
  data.tar.gz: !binary |-
6
- YWNmOWEyNTA2ZjM5MTIwOWU1YTQ0Yjg3ODMyNDhlMTQwNmFhOWI3Zg==
6
+ YTVhNTFhNDZlZTBlM2E2MDQwY2UzNDA3ODZjYTcwZWIwODVjOGNlYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDcxZTEzZWI4MzUyZDcwYzZkN2I2ZDc0NTE3Njk3OTJjOGI2NTZjNTg1OGNh
10
- MzlmYWJhMThjMWNhYzY0N2QyZTNhOTc5MmM0OTBkMzI3NDIwMDQ1ODdjYzZi
11
- NTdhZTFjNDg3YjkzMDEzYjI4NDVjOGRkMDBmYmZhNzgxODZlOTE=
9
+ ZjhlZTcxYzQ0YmU5NjU3ZmJjOTIwOTY1OWNlOTRhZWUxZGI5OTNiOTIzOGM4
10
+ M2U2ODA5ZjNmMTc5YmI5MWQzNzI2NjU0YTRmNzIwODMzYWEzMmQwZThlYjQ0
11
+ YmU1YjgzN2NiNmI1MTVkZWRlZjcyMWFkYzAzNTA3YzU2NjMwMGM=
12
12
  data.tar.gz: !binary |-
13
- M2YyMmZmODhjYTdhNjg4MzgwOWVmZWIyZjdhOTMxMWJlZDkwMmE0ZjFkMDU1
14
- MDhmNGUyMTQ3MjlmMGU3YTk4NjQ4MjQxMGE0MDYwOTk1MjJjOTU1ZjYzYWZk
15
- ZWYzYWM5NDQ3OGVjYTc0ODlhMzVjY2FhYjE4Zjg1MmMyMmJjZmY=
13
+ YzY4ZTQ2ZTcwNDk0OGJhNDk3ZDdlNmZhZDVmZGQ1MGEzOTZmMjIxMDY5MTQx
14
+ MDY3MjM4MjE3ZDZmY2M0MDMwOTg2MzIxNGQ4OTMwODJhMDliYTRmMjliZDQ4
15
+ NGYwODZjODU2YTcwOGQ0YjRlNDY4M2QzOTM3ODkxMzgxYWUzYjk=
data/.gitignore CHANGED
@@ -36,3 +36,6 @@ build/
36
36
 
37
37
  # ignore rubymine
38
38
  .idea
39
+
40
+ # ignore jar built by warbler
41
+ duse.rb.jar
@@ -14,6 +14,9 @@ matrix:
14
14
  jdk: oraclejdk8
15
15
  sudo: false
16
16
  cache: bundler
17
+ addons:
18
+ code_climate:
19
+ repo_token: a2c4df09180c46d851b3e577d882b96f8b3b732bae06440f09f094952c544d39
17
20
  deploy:
18
21
  provider: rubygems
19
22
  api_key:
data/Gemfile CHANGED
@@ -1,13 +1,16 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
+ gem 'jruby-openssl', platforms: :jruby
5
+
4
6
  group :test do
7
+ gem 'bundler'
5
8
  gem 'sinatra'
6
9
  gem 'rack-test'
7
10
  gem 'rake'
8
11
  gem 'rspec'
9
- gem 'fakefs', require: 'fakefs/safe'
12
+ gem 'fakefs', require: 'fakefs/safe'
10
13
  gem 'simplecov', require: false
11
- gem 'coveralls', require: false
14
+ gem 'codeclimate-test-reporter', require: false
12
15
  gem 'webmock'
13
16
  end
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/duse.svg)](http://badge.fury.io/rb/duse)
2
2
  [![Build Status](https://travis-ci.org/duse-io/duse.rb.svg?branch=master)](https://travis-ci.org/duse-io/duse.rb)
3
- [![Coverage Status](https://coveralls.io/repos/duse-io/duse.rb/badge.svg?branch=master)](https://coveralls.io/r/duse-io/duse.rb?branch=master)
3
+ [![Test Coverage](https://codeclimate.com/github/duse-io/duse.rb/badges/coverage.svg)](https://codeclimate.com/github/duse-io/duse.rb/coverage)
4
4
  [![Code Climate](https://codeclimate.com/github/duse-io/duse.rb/badges/gpa.svg)](https://codeclimate.com/github/duse-io/duse.rb)
5
5
 
6
6
  Duse Client & Client Library
@@ -41,6 +41,7 @@ To install the client simply install its ruby gem.
41
41
  * [secret](#secret)
42
42
  * [add](#add)
43
43
  * [list](#list)
44
+ * [tree](#tree)
44
45
  * [get](#get)
45
46
  * [remove](#remove)
46
47
  * [account](#account)
@@ -170,14 +171,22 @@ created
170
171
  List your secrets
171
172
 
172
173
  $ duse secret list
173
- 1: First Secret
174
+ 🔐 1: First Secret
175
+
176
+ ###tree
177
+
178
+ List your secrets in a tree view
179
+
180
+ $ duse secret tree
181
+ 📂 flower-pot
182
+ └── 🔐 1: First Secret
174
183
 
175
184
  ###get
176
185
 
177
186
  Retrieve a secret interactively
178
187
 
179
188
  $ duse secret get
180
- 1: First secret
189
+ 🔐 1: First secret
181
190
 
182
191
  Select the id of the secret to retrieve: 1
183
192
 
data/bin/duse CHANGED
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  Encoding.default_external = Encoding::UTF_8 if defined? Encoding
4
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
5
+ #require 'jruby-openssl' if RUBY_PLATFORM == 'java'
4
6
 
5
- require 'bundler/setup'
6
7
  require 'duse/cli'
7
8
 
8
9
  Duse::CLI.run(ARGV)
@@ -0,0 +1,183 @@
1
+ # Disable Rake-environment-task framework detection by uncommenting/setting to false
2
+ # Warbler.framework_detection = false
3
+
4
+ # Warbler web application assembly configuration file
5
+ Warbler::Config.new do |config|
6
+ # Features: additional options controlling how the jar is built.
7
+ # Currently the following features are supported:
8
+ # - gemjar: package the gem repository in a jar file in WEB-INF/lib
9
+ # - executable: embed a web server and make the war executable
10
+ # - compiled: compile .rb files to .class files
11
+ config.features = %w(gemjar runnable compiled)
12
+
13
+ # Application directories to be included in the webapp.
14
+ # config.dirs = %w(app config db lib log script vendor tmp)
15
+
16
+ # Additional files/directories to include, above those in config.dirs
17
+ # config.includes = FileList["db"]
18
+
19
+ # Additional files/directories to exclude
20
+ # config.excludes = FileList["lib/tasks/*"]
21
+
22
+ # Additional Java .jar files to include. Note that if .jar files are placed
23
+ # in lib (and not otherwise excluded) then they need not be mentioned here.
24
+ # JRuby and JRuby-Rack are pre-loaded in this list. Be sure to include your
25
+ # own versions if you directly set the value
26
+ # config.java_libs += FileList["lib/java/*.jar"]
27
+
28
+ # Loose Java classes and miscellaneous files to be included.
29
+ # config.java_classes = FileList["target/classes/**.*"]
30
+
31
+ # One or more pathmaps defining how the java classes should be copied into
32
+ # the archive. The example pathmap below accompanies the java_classes
33
+ # configuration above. See http://rake.rubyforge.org/classes/String.html#M000017
34
+ # for details of how to specify a pathmap.
35
+ # config.pathmaps.java_classes << "%{target/classes/,}p"
36
+
37
+ # Bundler support is built-in. If Warbler finds a Gemfile in the
38
+ # project directory, it will be used to collect the gems to bundle
39
+ # in your application. If you wish to explicitly disable this
40
+ # functionality, uncomment here.
41
+ config.bundler = false
42
+
43
+ # An array of Bundler groups to avoid including in the war file.
44
+ # Defaults to ["development", "test", "assets"].
45
+ # config.bundle_without = []
46
+
47
+ # Other gems to be included. If you don't use Bundler or a gemspec
48
+ # file, you need to tell Warbler which gems your application needs
49
+ # so that they can be packaged in the archive.
50
+ # For Rails applications, the Rails gems are included by default
51
+ # unless the vendor/rails directory is present.
52
+ # config.gems += ["activerecord-jdbcmysql-adapter", "jruby-openssl"]
53
+ # config.gems << "tzinfo"
54
+
55
+ # Uncomment this if you don't want to package rails gem.
56
+ # config.gems -= ["rails"]
57
+
58
+ # The most recent versions of gems are used.
59
+ # You can specify versions of gems by using a hash assignment:
60
+ # config.gems["rails"] = "2.3.10"
61
+
62
+ # You can also use regexps or Gem::Dependency objects for flexibility or
63
+ # finer-grained control.
64
+ # config.gems << /^merb-/
65
+ # config.gems << Gem::Dependency.new("merb-core", "= 0.9.3")
66
+
67
+ # Include gem dependencies not mentioned specifically. Default is
68
+ # true, uncomment to turn off.
69
+ # config.gem_dependencies = false
70
+
71
+ # Array of regular expressions matching relative paths in gems to be
72
+ # excluded from the war. Defaults to empty, but you can set it like
73
+ # below, which excludes test files.
74
+ # config.gem_excludes = [/^(test|spec)\//]
75
+
76
+ # Pathmaps for controlling how application files are copied into the archive
77
+ # config.pathmaps.application = ["WEB-INF/%p"]
78
+
79
+ # Name of the archive (without the extension). Defaults to the basename
80
+ # of the project directory.
81
+ # config.jar_name = "mywar"
82
+
83
+ # File extension for the archive. Defaults to either 'jar' or 'war'.
84
+ # config.jar_extension = "jar"
85
+
86
+ # Destionation for the created archive. Defaults to project's root directory.
87
+ config.autodeploy_dir = "pkg/dist/"
88
+
89
+ # Name of the MANIFEST.MF template for the war file. Defaults to a simple
90
+ # MANIFEST.MF that contains the version of Warbler used to create the war file.
91
+ # config.manifest_file = "config/MANIFEST.MF"
92
+
93
+ # When using the 'compiled' feature and specified, only these Ruby
94
+ # files will be compiled. Default is to compile all \.rb files in
95
+ # the application.
96
+ # config.compiled_ruby_files = FileList['app/**/*.rb']
97
+
98
+ # Determines if ruby files in supporting gems will be compiled.
99
+ # Ignored unless compile feature is used.
100
+ # config.compile_gems = false
101
+
102
+ # When set it specify the bytecode version for compiled class files
103
+ # config.bytecode_version = "1.6"
104
+
105
+ # When set to true, Warbler will override the value of ENV['GEM_HOME'] even it
106
+ # has already been set. When set to false it will use any existing value of
107
+ # GEM_HOME if it is set.
108
+ # config.override_gem_home = true
109
+
110
+ # Allows for specifing custom executables
111
+ # config.executable = ["rake", "bin/rake"]
112
+
113
+ # Sets default (prefixed) parameters for the executables
114
+ # config.executable_params = "do:something"
115
+
116
+ # If set to true, moves jar files into WEB-INF/lib. Prior to version 1.4.2 of Warbler this was done
117
+ # by default. But since 1.4.2 this config defaults to false. It may need to be set to true for
118
+ # web servers that do not explode the WAR file.
119
+ # Alternatively, this option can be set to a regular expression, which will
120
+ # act as a jar selector -- only jar files that match the pattern will be
121
+ # included in the archive.
122
+ # config.move_jars_to_webinf_lib = false
123
+
124
+ # === War files only below here ===
125
+
126
+ # Path to the pre-bundled gem directory inside the war file. Default
127
+ # is 'WEB-INF/gems'. Specify path if gems are already bundled
128
+ # before running Warbler. This also sets 'gem.path' inside web.xml.
129
+ # config.gem_path = "WEB-INF/vendor/bundler_gems"
130
+
131
+ # Files for WEB-INF directory (next to web.xml). This contains
132
+ # web.xml by default. If there is an .erb-File it will be processed
133
+ # with webxml-config. You may want to exclude this file via
134
+ # config.excludes.
135
+ # config.webinf_files += FileList["jboss-web.xml"]
136
+
137
+ # Files to be included in the root of the webapp. Note that files in public
138
+ # will have the leading 'public/' part of the path stripped during staging.
139
+ # config.public_html = FileList["public/**/*", "doc/**/*"]
140
+
141
+ # Pathmaps for controlling how public HTML files are copied into the .war
142
+ # config.pathmaps.public_html = ["%{public/,}p"]
143
+
144
+ # Embedded webserver to use with the 'executable' feature. Currently supported
145
+ # webservers are:
146
+ # * <tt>winstone</tt> (default) - Winstone 0.9.10 from sourceforge
147
+ # * <tt>jenkins-ci.winstone</tt> - Improved Winstone from Jenkins CI
148
+ # * <tt>jetty</tt> - Embedded Jetty from Eclipse
149
+ # config.webserver = 'jetty'
150
+
151
+ # Value of RAILS_ENV for the webapp -- default as shown below
152
+ # config.webxml.rails.env = ENV['RAILS_ENV'] || 'production'
153
+
154
+ # Application booter to use, one of :rack, :rails, or :merb (autodetected by default)
155
+ # config.webxml.booter = :rails
156
+
157
+ # Set JRuby to run in 1.9 mode.
158
+ # config.webxml.jruby.compat.version = "1.9"
159
+
160
+ # When using the :rack booter, "Rackup" script to use.
161
+ # - For 'rackup.path', the value points to the location of the rackup
162
+ # script in the web archive file. You need to make sure this file
163
+ # gets included in the war, possibly by adding it to config.includes
164
+ # or config.webinf_files above.
165
+ # - For 'rackup', the rackup script you provide as an inline string
166
+ # is simply embedded in web.xml.
167
+ # The script is evaluated in a Rack::Builder to load the application.
168
+ # Examples:
169
+ # config.webxml.rackup.path = 'WEB-INF/hello.ru'
170
+ # config.webxml.rackup = %{require './lib/demo'; run Rack::Adapter::Camping.new(Demo)}
171
+ # config.webxml.rackup = require 'cgi' && CGI::escapeHTML(File.read("config.ru"))
172
+
173
+ # Control the pool of Rails runtimes. Leaving unspecified means
174
+ # the pool will grow as needed to service requests. It is recommended
175
+ # that you fix these values when running a production server!
176
+ # If you're using threadsafe! mode, you probably don't want to set these values,
177
+ # since 1 runtime(default for threadsafe mode) will be enough.
178
+ # config.webxml.jruby.min.runtimes = 2
179
+ # config.webxml.jruby.max.runtimes = 4
180
+
181
+ # JNDI data source name
182
+ # config.webxml.jndi = 'jdbc/rails'
183
+ end
@@ -19,4 +19,6 @@ Gem::Specification.new do |s|
19
19
  s.add_runtime_dependency 'secret_sharing', '>= 0.0.5'
20
20
  s.add_runtime_dependency 'faraday'
21
21
  s.add_runtime_dependency 'faraday_middleware'
22
+ s.add_runtime_dependency 'tree_outline'
22
23
  end
24
+
@@ -2,6 +2,7 @@ require 'duse/version'
2
2
  require 'duse/client/entity'
3
3
  require 'duse/client/secret'
4
4
  require 'duse/client/user'
5
+ require 'duse/client/folder'
5
6
  require 'duse/client/session'
6
7
  require 'duse/client/namespace'
7
8
 
@@ -12,6 +12,7 @@ module Duse
12
12
  autoload :MetaCommand,'duse/cli/meta_command'
13
13
  autoload :Register, 'duse/cli/register'
14
14
  autoload :Secret, 'duse/cli/secret'
15
+ autoload :Folder, 'duse/cli/folder'
15
16
  autoload :Account, 'duse/cli/account'
16
17
  autoload :Version, 'duse/cli/version'
17
18
 
@@ -1,5 +1,7 @@
1
1
  require 'yaml'
2
2
  require 'duse/client/config'
3
+ require 'fileutils'
4
+ require 'openssl'
3
5
 
4
6
  module Duse
5
7
  class PrivateKeyMissing < StandardError; end
@@ -0,0 +1,18 @@
1
+ require 'duse/cli/folder_list'
2
+ require 'duse/cli/folder_add'
3
+ require 'duse/cli/folder_remove'
4
+ require 'duse/cli/folder_update'
5
+
6
+ module Duse
7
+ module CLI
8
+ class Folder < MetaCommand
9
+ subcommand FolderList
10
+ subcommand FolderAdd
11
+ subcommand FolderRemove
12
+ subcommand FolderUpdate
13
+
14
+ description 'Manage your folders'
15
+ end
16
+ end
17
+ end
18
+
@@ -0,0 +1,24 @@
1
+ require 'duse/cli'
2
+
3
+ module Duse
4
+ module CLI
5
+ class FolderAdd < ApiCommand
6
+ description 'Add a new folder'
7
+
8
+ on('-n', '--name [name]', 'The folders name')
9
+ on('-p', '--parent [parent]', 'The parent folder')
10
+
11
+ def run
12
+ self.name ||= terminal.ask 'What to you want to call the new folder? '
13
+ self.parent ||= terminal.ask 'What folder do you want this folder to be under? (provide the id) [root] '
14
+
15
+ Duse::Folder.create(
16
+ name: name,
17
+ parent_id: parent
18
+ )
19
+
20
+ success 'Folder successfully created!'
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,17 @@
1
+ require 'duse/cli'
2
+ require 'duse/cli/folder_add'
3
+ require 'tree_outline'
4
+
5
+ module Duse
6
+ module CLI
7
+ class FolderList < ApiCommand
8
+ description 'Print all your folders'
9
+
10
+ def run
11
+ root_folders = Duse::Folder.all
12
+ say TreeOutline.new(root_folders.first).children_method(:subfolders).label_method(:id_name).to_s
13
+ say "\nAdd a new folder with `#{FolderAdd.full_command}`"
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ require 'duse/cli'
2
+
3
+ module Duse
4
+ module CLI
5
+ class FolderRemove < ApiCommand
6
+ description 'Delete a folder (does not delete the children)'
7
+
8
+ def run(folder_id = nil)
9
+ secret_id ||= terminal.ask('Folder to delete: ').to_i
10
+
11
+ Duse::Folder.delete secret_id
12
+
13
+ success 'Successfully deleted'
14
+ rescue Duse::Client::Error => e
15
+ error e.message
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ require 'duse/cli'
2
+
3
+ module Duse
4
+ module CLI
5
+ class FolderUpdate < ApiCommand
6
+ description 'update a folder'
7
+
8
+ def run(folder_id)
9
+ user = Duse::Folder.find(folder_id)
10
+ terminal.say 'Leave blank if you do not wish to change'
11
+ Duse::User.update(folder_id, {
12
+ name: terminal.ask('New folder name: ') { |q| q.default = folder.name }
13
+ })
14
+ success 'Successfully updated!'
15
+ end
16
+ end
17
+ end
18
+ end
@@ -18,7 +18,7 @@ module Duse
18
18
  username: @username,
19
19
  email: @email,
20
20
  password: @password,
21
- public_key: @key.public_key.to_pem
21
+ public_key: @key.public_key.to_pem.gsub('RSA PUBLIC KEY', 'PUBLIC KEY')
22
22
  )
23
23
  Duse::CLIConfig.new.save_private_key_for user, @key.to_pem
24
24
  success 'Successfully created your account! An email to confirm it has been sent. Once confirmed you can login with "duse login"'