secret_console 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/secret_console +6 -0
- data/bin/setup +8 -0
- data/exe/secret_console +3 -0
- data/lib/secret_console.rb +5 -0
- data/lib/secret_console/app.rb +69 -0
- data/lib/secret_console/version.rb +3 -0
- data/lib/secret_console/views/index.haml +18 -0
- data/lib/secret_console/views/layout.haml +3 -0
- data/lib/secret_console/views/new.haml +5 -0
- data/lib/secret_console/views/show.haml +9 -0
- data/secret_console.gemspec +29 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3b6b66cbc6cf88e488665068e9dbc6d8b4da63b2
|
4
|
+
data.tar.gz: 098ab78ff99461705486e9cae79cb450a2a595cb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0c06294531dfee4b66b91e66129344182ed8754b6144f54205b72c0a3c1b927f4ad2d5dcc9261985067adadb7f0be30f90a6b0955982a2c9f1d76aec469b20c5
|
7
|
+
data.tar.gz: afbe3686d5baeef39a4f9d59d56b7911f8aaebe87daa06736dea739696af07382d533952dcafc420062301de865b2ef5c244d4ff909764038c40ebbf3591b704
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Takamichi Yoshikawa
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# SecretConsole
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/secret_console`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'secret_console'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install secret_console
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/secret_console.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "secret_console"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/secret_console
ADDED
data/bin/setup
ADDED
data/exe/secret_console
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
require "sinatra"
|
2
|
+
require "rcredstash"
|
3
|
+
|
4
|
+
module SecretConsole
|
5
|
+
class App < Sinatra::Base
|
6
|
+
DELIMITER = '.'
|
7
|
+
|
8
|
+
set :views, File.expand_path('../views', __FILE__)
|
9
|
+
enable :method_override
|
10
|
+
|
11
|
+
Record = Struct.new(:path, :value)
|
12
|
+
|
13
|
+
get '/*' do
|
14
|
+
path = params['splat'].first.gsub("/", DELIMITER)
|
15
|
+
|
16
|
+
keys = CredStash.list.map { |k, v| k }
|
17
|
+
|
18
|
+
if keys.include?(path)
|
19
|
+
return haml :show, locals: { value: CredStash.get(path), path: request.path_info }
|
20
|
+
end
|
21
|
+
|
22
|
+
unless path == ""
|
23
|
+
keys = keys.grep(Regexp.new("\\A#{path}\\#{DELIMITER}#{DELIMITER}*"))
|
24
|
+
end
|
25
|
+
|
26
|
+
if keys.size == 0
|
27
|
+
return haml :new, locals: { path: request.path_info }
|
28
|
+
end
|
29
|
+
|
30
|
+
values = {}
|
31
|
+
links = {}
|
32
|
+
|
33
|
+
keys.each do |key|
|
34
|
+
child_path = key.gsub(path, '')
|
35
|
+
child_path = child_path[1..-1] if child_path.start_with?(DELIMITER)
|
36
|
+
childs = child_path.split(DELIMITER)
|
37
|
+
|
38
|
+
if childs.size == 1
|
39
|
+
link = (request.path_info.split('/') + [childs.first]).join('/')
|
40
|
+
values[childs.first] = Record.new(link, CredStash.get(key))
|
41
|
+
else
|
42
|
+
link = (request.path_info.split('/') + [childs.first]).join('/')
|
43
|
+
links[childs.first] = link
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
haml :index, locals: { values: values, links: links }
|
48
|
+
end
|
49
|
+
|
50
|
+
post '/*' do
|
51
|
+
path = params['splat'].first.gsub("/", DELIMITER)
|
52
|
+
value = params['value']
|
53
|
+
|
54
|
+
|
55
|
+
CredStash.put(path, value)
|
56
|
+
|
57
|
+
# TODO Set flash message
|
58
|
+
redirect to(request.path_info)
|
59
|
+
end
|
60
|
+
|
61
|
+
delete '/*' do
|
62
|
+
path = params['splat'].first.gsub("/", DELIMITER)
|
63
|
+
|
64
|
+
CredStash.delete(path)
|
65
|
+
|
66
|
+
redirect to(request.path_info.split("/")[0..-2].join("/"))
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
- if values.size > 0
|
2
|
+
%h1 Values
|
3
|
+
%table
|
4
|
+
%tr
|
5
|
+
%th Key
|
6
|
+
%th Value
|
7
|
+
- values.each do |key, record|
|
8
|
+
%tr
|
9
|
+
%td
|
10
|
+
%a{href: record.path}= key
|
11
|
+
%td= record.value
|
12
|
+
|
13
|
+
- if links.size > 0
|
14
|
+
%h1 Children
|
15
|
+
%ul
|
16
|
+
- links.each do |key, value|
|
17
|
+
%li
|
18
|
+
%a{href: value}= key
|
@@ -0,0 +1,9 @@
|
|
1
|
+
%h1 Value
|
2
|
+
%p
|
3
|
+
%form{action: path, method: "post"}
|
4
|
+
%textarea{name: "value", rows: 2, cols: 40}= value
|
5
|
+
%input{type: "submit", value: "Save"}
|
6
|
+
%p
|
7
|
+
%form{action: path, method: "post"}
|
8
|
+
%input{type: "hidden", name: "_method", value: "DELETE"}
|
9
|
+
%input{type: "submit", value: "Delete"}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'secret_console/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "secret_console"
|
8
|
+
spec.version = SecretConsole::VERSION
|
9
|
+
spec.authors = ["adorechic"]
|
10
|
+
spec.email = ["adorechic@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Secret console}
|
13
|
+
spec.description = %q{Secret console}
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
|
22
|
+
spec.add_dependency "sinatra"
|
23
|
+
spec.add_dependency "haml"
|
24
|
+
spec.add_dependency "rcredstash", "~> 0.2.0"
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: secret_console
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- adorechic
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-06-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sinatra
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: haml
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rcredstash
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.2.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.2.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.12'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.12'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
description: Secret console
|
98
|
+
email:
|
99
|
+
- adorechic@gmail.com
|
100
|
+
executables:
|
101
|
+
- secret_console
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rspec"
|
107
|
+
- ".travis.yml"
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- bin/console
|
113
|
+
- bin/secret_console
|
114
|
+
- bin/setup
|
115
|
+
- exe/secret_console
|
116
|
+
- lib/secret_console.rb
|
117
|
+
- lib/secret_console/app.rb
|
118
|
+
- lib/secret_console/version.rb
|
119
|
+
- lib/secret_console/views/index.haml
|
120
|
+
- lib/secret_console/views/layout.haml
|
121
|
+
- lib/secret_console/views/new.haml
|
122
|
+
- lib/secret_console/views/show.haml
|
123
|
+
- secret_console.gemspec
|
124
|
+
homepage:
|
125
|
+
licenses:
|
126
|
+
- MIT
|
127
|
+
metadata: {}
|
128
|
+
post_install_message:
|
129
|
+
rdoc_options: []
|
130
|
+
require_paths:
|
131
|
+
- lib
|
132
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
requirements: []
|
143
|
+
rubyforge_project:
|
144
|
+
rubygems_version: 2.6.4
|
145
|
+
signing_key:
|
146
|
+
specification_version: 4
|
147
|
+
summary: Secret console
|
148
|
+
test_files: []
|
149
|
+
has_rdoc:
|