pitcgi 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/CHANGELOG.md +21 -0
- data/Gemfile +0 -3
- data/README.md +10 -6
- data/Rakefile +3 -0
- data/bin/pitcgi +67 -14
- data/lib/pitcgi.rb +103 -36
- data/lib/pitcgi/version.rb +2 -1
- data/pitcgi.gemspec +7 -1
- data/test/pitcgi_test.rb +73 -12
- metadata +51 -9
- data/ChangeLog +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7b37c7cc8dd2c2bfd1a7d5e470e230be23bc659
|
4
|
+
data.tar.gz: fb7287af965c1230632784218d4a8b60cdbc8bc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 616943693dca028505dc31b9b8caff623921cdc80b55539d24b830ade8ea2a75dd022fed38f856963ea9f60e43d2bc8a80a5e6b8e0ceedfab25021542309af03
|
7
|
+
data.tar.gz: 5429aedb0c2fe688f8549121546f2f31ee369a9bd1cea79f159b2646bd7f6cd5a14a3ba835457ab8ac1c702076bf16eeff6d62f067b4e753bafa52f929b2e5c8
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
### 0.1.0 / 2015-02-23 sanadan <jecy00@gmail.com>
|
2
|
+
|
3
|
+
* Enhance error messages
|
4
|
+
* Add scramble and descramble commands
|
5
|
+
|
6
|
+
|
7
|
+
### 0.0.3 / 2015-01-28 sanadan <jecy00@gmail.com>
|
8
|
+
|
9
|
+
* Add init command
|
10
|
+
|
11
|
+
|
12
|
+
### 0.0.2 / 2015-01-13 sanadan <jecy00@gmail.com>
|
13
|
+
|
14
|
+
* Fixed error using value "false"
|
15
|
+
|
16
|
+
|
17
|
+
### 0.0.1 / 2014-12-18 sanadan <jecy00@gmail.com>
|
18
|
+
|
19
|
+
* Change pit 0.0.7 for cgi only.
|
20
|
+
* Rename to pitcgi.
|
21
|
+
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -48,14 +48,14 @@ ruby lib.
|
|
48
48
|
require "pitcgi"
|
49
49
|
|
50
50
|
config = Pitcgi.get("twitter.com", :require => {
|
51
|
-
"username" => "
|
52
|
-
"password" => "
|
51
|
+
"username" => "Number, mail address or username",
|
52
|
+
"password" => "Password"
|
53
53
|
})
|
54
54
|
|
55
55
|
Pitcgi.get("vox.com", :require => {
|
56
|
-
"username" => "
|
57
|
-
"password" => "
|
58
|
-
"nickname" => "
|
56
|
+
"username" => "Username",
|
57
|
+
"password" => "Password"
|
58
|
+
"nickname" => "Nickname"
|
59
59
|
})
|
60
60
|
```
|
61
61
|
Pitcgi.get open $EDITOR with `require` hash if the setting does not have
|
@@ -65,11 +65,15 @@ required keys.
|
|
65
65
|
## Copyright
|
66
66
|
|
67
67
|
Author:
|
68
|
+
|
68
69
|
* sanadan <jecy00@gmail.com>
|
69
70
|
|
70
71
|
Copyright:
|
72
|
+
|
71
73
|
* Copyright (c) 2008 cho45
|
72
|
-
* Copyright (c) 2014 sanadan
|
74
|
+
* Copyright (c) 2014-2015 sanadan
|
73
75
|
|
74
76
|
License:
|
77
|
+
|
75
78
|
* Ruby's
|
79
|
+
|
data/Rakefile
CHANGED
data/bin/pitcgi
CHANGED
@@ -57,6 +57,22 @@ class PitcgiCommand
|
|
57
57
|
Initialize #{NAME} environment.
|
58
58
|
EOB
|
59
59
|
},
|
60
|
+
|
61
|
+
"scramble" => OptionParser.new { |opts|
|
62
|
+
opts.banner = <<-EOB.gsub(/^\t+/, "")
|
63
|
+
Usage: #{NAME} scramble
|
64
|
+
|
65
|
+
Enable scramble mode.
|
66
|
+
EOB
|
67
|
+
},
|
68
|
+
|
69
|
+
"descramble" => OptionParser.new { |opts|
|
70
|
+
opts.banner = <<-EOB.gsub(/^\t+/, "")
|
71
|
+
Usage: #{NAME} descramble
|
72
|
+
|
73
|
+
Disable scramble mode.
|
74
|
+
EOB
|
75
|
+
},
|
60
76
|
}
|
61
77
|
|
62
78
|
@parser = OptionParser.new do |parser|
|
@@ -92,7 +108,11 @@ class PitcgiCommand
|
|
92
108
|
method_name = "cmd_#{@subcommand}"
|
93
109
|
if self.respond_to?(method_name)
|
94
110
|
@subparsers[@subcommand].parse!(@argv)
|
95
|
-
|
111
|
+
begin
|
112
|
+
self.send(method_name)
|
113
|
+
rescue Errno::EACCES
|
114
|
+
warn( $! )
|
115
|
+
end
|
96
116
|
else
|
97
117
|
puts "Not implemented subcommand: `#{@subcommand}'."
|
98
118
|
puts
|
@@ -103,9 +123,12 @@ class PitcgiCommand
|
|
103
123
|
|
104
124
|
def cmd_get
|
105
125
|
name, = @argv
|
106
|
-
|
126
|
+
if name.nil?
|
127
|
+
warn( '<name> is not specified.' )
|
128
|
+
exit
|
129
|
+
end
|
107
130
|
if $stdout.tty?
|
108
|
-
warn "
|
131
|
+
warn "Do not output to tty."
|
109
132
|
else
|
110
133
|
puts Pitcgi.get(name).to_yaml
|
111
134
|
end
|
@@ -113,16 +136,24 @@ class PitcgiCommand
|
|
113
136
|
|
114
137
|
def cmd_set
|
115
138
|
name, = @argv
|
116
|
-
|
117
|
-
|
139
|
+
if name.nil?
|
140
|
+
warn( '<name> is not specified.' )
|
141
|
+
exit
|
142
|
+
end
|
143
|
+
Pitcgi.set(name)
|
118
144
|
end
|
119
145
|
|
120
146
|
def cmd_switch
|
121
147
|
profile, = @argv
|
122
148
|
profile = "default" if profile.nil?
|
123
149
|
profile.gsub(/[^a-z0-9.-]/i, "")
|
124
|
-
|
125
|
-
|
150
|
+
begin
|
151
|
+
Pitcgi.switch( profile )
|
152
|
+
rescue
|
153
|
+
warn( $! )
|
154
|
+
exit
|
155
|
+
end
|
156
|
+
warn( "Switch profile to #{profile}." )
|
126
157
|
end
|
127
158
|
|
128
159
|
def cmd_help
|
@@ -131,7 +162,7 @@ class PitcgiCommand
|
|
131
162
|
if @subparsers.key? subcommand
|
132
163
|
puts @subparsers[subcommand].help
|
133
164
|
else
|
134
|
-
puts "No such subcommand `#{subcommand}'"
|
165
|
+
puts "No such subcommand `#{subcommand}'."
|
135
166
|
puts @parser.help
|
136
167
|
end
|
137
168
|
else
|
@@ -140,14 +171,36 @@ class PitcgiCommand
|
|
140
171
|
end
|
141
172
|
|
142
173
|
def cmd_init
|
143
|
-
|
144
|
-
system( "sudo
|
145
|
-
|
146
|
-
|
147
|
-
|
174
|
+
warn( 'Initialize environment.' )
|
175
|
+
exit unless system( "sudo -v" )
|
176
|
+
ws( "sudo mkdir #{Pitcgi::Directory}" )
|
177
|
+
ws( "sudo chmod 770 #{Pitcgi::Directory}" )
|
178
|
+
ws( "sudo chgrp www-data #{Pitcgi::Directory}" )
|
179
|
+
ws( "sudo adduser #{ENV[ 'USER' ]} www-data" )
|
180
|
+
end
|
181
|
+
|
182
|
+
def cmd_scramble
|
183
|
+
begin
|
184
|
+
Pitcgi.scramble
|
185
|
+
rescue
|
186
|
+
warn( $! )
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
def cmd_descramble
|
191
|
+
begin
|
192
|
+
Pitcgi.descramble
|
193
|
+
rescue
|
194
|
+
warn( $! )
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
protected
|
199
|
+
def ws( command )
|
200
|
+
warn( command )
|
201
|
+
system( command )
|
148
202
|
end
|
149
203
|
end
|
150
204
|
|
151
205
|
PitcgiCommand.run(ARGV)
|
152
206
|
|
153
|
-
|
data/lib/pitcgi.rb
CHANGED
@@ -2,18 +2,22 @@ require 'pitcgi/version'
|
|
2
2
|
require "yaml"
|
3
3
|
require "pathname"
|
4
4
|
require "tempfile"
|
5
|
+
require 'scrambled_eggs'
|
5
6
|
|
6
7
|
module Pitcgi
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
NOT_TO_BE_INITIALIZED = "It is likely not to be initialized. Use '#{NAME} init'."
|
9
|
+
ALREADY_SCRAMBLED = 'Already scrambled.'
|
10
|
+
NOT_SCRAMBLED = 'Not scrambled.'
|
11
|
+
CAN_NOT_USE_PROFILE_NAME = 'Can not use it for profile name.'
|
12
|
+
Directory = Pathname.new("/etc/pitcgi").expand_path
|
13
|
+
@@config_path = Directory + "pitcgi.yaml"
|
14
|
+
@@profile_path = Directory + "default.yaml"
|
11
15
|
|
12
16
|
# Set _name_ setting to current profile.
|
13
17
|
# If not _opts_ specified, this opens $EDITOR with current profile setting.
|
14
18
|
# If `data` specified, this just sets it to current profile.
|
15
|
-
# If `config` specified, this opens $EDITOR with merged hash with specified
|
16
|
-
|
19
|
+
# If `config` specified, this opens $EDITOR with merged hash with specified
|
20
|
+
# hash and current profile.
|
17
21
|
def self.set(name, opts={})
|
18
22
|
profile = self.load
|
19
23
|
if opts.key?(:data)
|
@@ -36,11 +40,11 @@ module Pitcgi
|
|
36
40
|
result = YAML.load(result)
|
37
41
|
end
|
38
42
|
profile[name] = result
|
39
|
-
|
40
|
-
|
43
|
+
self.save( profile )
|
44
|
+
result
|
41
45
|
end
|
42
46
|
|
43
|
-
|
47
|
+
# Get _name_ setting from current profile.
|
44
48
|
# If not _opts_ specified, this just returns setting from current profile.
|
45
49
|
# If _require_ specified, check keys on setting and open $EDITOR.
|
46
50
|
def self.get(name, opts={})
|
@@ -57,13 +61,53 @@ module Pitcgi
|
|
57
61
|
# Switch to current profile to _name_.
|
58
62
|
# Profile is set of settings. You can switch some settings using profile.
|
59
63
|
def self.switch(name, opts={})
|
60
|
-
@@
|
61
|
-
|
62
|
-
|
64
|
+
@@profile_path = Directory + "#{name}.yaml"
|
65
|
+
if @@profile_path == @@config_path
|
66
|
+
raise( CAN_NOT_USE_PROFILE_NAME )
|
67
|
+
end
|
68
|
+
begin
|
69
|
+
config = self.load_config
|
70
|
+
ret = config["profile"]
|
71
|
+
rescue Errno::ENOENT
|
72
|
+
config = {}
|
73
|
+
ret = ""
|
74
|
+
end
|
63
75
|
config["profile"] = name
|
64
|
-
|
65
|
-
|
76
|
+
begin
|
77
|
+
self.save_config( config )
|
78
|
+
rescue Errno::ENOENT => e
|
79
|
+
raise e, NOT_TO_BE_INITIALIZED
|
80
|
+
end
|
81
|
+
ret
|
66
82
|
end
|
83
|
+
|
84
|
+
# Scramble profile.
|
85
|
+
def self.scramble
|
86
|
+
config = self.load_config
|
87
|
+
config_scrambled = self.get_profile_config( config )
|
88
|
+
if config_scrambled[ 'scrambled' ]
|
89
|
+
raise( ALREADY_SCRAMBLED )
|
90
|
+
end
|
91
|
+
ScrambledEggs.new.scramble_file( @@profile_path )
|
92
|
+
config_scrambled[ 'scrambled' ] = true
|
93
|
+
config[ get_profile_config_name( config ) ] = config_scrambled
|
94
|
+
self.save_config( config )
|
95
|
+
return
|
96
|
+
end
|
97
|
+
|
98
|
+
# Descramble profile.
|
99
|
+
def self.descramble
|
100
|
+
config = self.load_config
|
101
|
+
config_scrambled = self.get_profile_config( config )
|
102
|
+
if !config_scrambled[ 'scrambled' ]
|
103
|
+
raise( NOT_SCRAMBLED )
|
104
|
+
end
|
105
|
+
ScrambledEggs.new.descramble_file( @@profile_path )
|
106
|
+
config_scrambled[ 'scrambled' ] = false
|
107
|
+
config[ get_profile_config_name( config ) ] = config_scrambled
|
108
|
+
self.save_config( config )
|
109
|
+
return
|
110
|
+
end
|
67
111
|
|
68
112
|
protected
|
69
113
|
def self.load
|
@@ -73,34 +117,57 @@ module Pitcgi
|
|
73
117
|
Directory.chmod 0770
|
74
118
|
Directory.chown(nil, 33) # www-data
|
75
119
|
rescue Errno::EACCES => e
|
76
|
-
raise e,
|
120
|
+
raise e, NOT_TO_BE_INITIALIZED
|
77
121
|
end
|
78
122
|
end
|
79
|
-
unless @@
|
80
|
-
@@
|
81
|
-
@@
|
82
|
-
@@
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
@@
|
88
|
-
|
123
|
+
unless @@config_path.exist?
|
124
|
+
@@config_path.open("w") {|f| f << {"profile"=>"default"}.to_yaml }
|
125
|
+
@@config_path.chmod(0660)
|
126
|
+
@@config_path.chown(nil, 33) # www-data
|
127
|
+
end
|
128
|
+
config = self.load_config
|
129
|
+
self.switch( config[ 'profile' ] )
|
130
|
+
unless @@profile_path.exist?
|
131
|
+
@@profile_path.open("w") {|f| f << {}.to_yaml }
|
132
|
+
@@profile_path.chmod(0660)
|
133
|
+
@@profile_path.chown(nil, 33) # www-data
|
89
134
|
end
|
90
|
-
|
135
|
+
data = @@profile_path.binread
|
136
|
+
if self.get_profile_config( config )[ 'scrambled' ]
|
137
|
+
data = ScrambledEggs.new.descramble( data )
|
138
|
+
end
|
139
|
+
YAML.load( data ) || {}
|
91
140
|
end
|
92
141
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
142
|
+
def self.save( profile )
|
143
|
+
data = profile.to_yaml
|
144
|
+
config = self.load_config
|
145
|
+
self.switch( config[ 'profile' ] )
|
146
|
+
if self.get_profile_config( config )[ 'scrambled' ]
|
147
|
+
data = ScrambledEggs.new.scramble( data )
|
148
|
+
end
|
149
|
+
# Not exist Pathname#write on Ruby 2.0.0.
|
150
|
+
#@@profile.binwrite( data )
|
151
|
+
IO.binwrite( @@profile_path, data )
|
152
|
+
end
|
97
153
|
|
154
|
+
def self.load_config
|
155
|
+
YAML.load( @@config_path.read )
|
156
|
+
end
|
98
157
|
|
99
|
-
|
100
|
-
|
101
|
-
|
158
|
+
def self.save_config( config )
|
159
|
+
# Not exist Pathname#write on Ruby 2.0.0.
|
160
|
+
#@@config.write( config.to_yaml )
|
161
|
+
IO.write( @@config_path, config.to_yaml )
|
162
|
+
end
|
102
163
|
|
103
|
-
|
104
|
-
|
105
|
-
|
164
|
+
def self.get_profile_config( config )
|
165
|
+
name = get_profile_config_name( config )
|
166
|
+
return config[ name ] ? config[ name ] : {}
|
167
|
+
end
|
168
|
+
|
169
|
+
def self.get_profile_config_name( config )
|
170
|
+
return config[ 'profile' ] + '_config'
|
171
|
+
end
|
172
|
+
end
|
106
173
|
|
data/lib/pitcgi/version.rb
CHANGED
data/pitcgi.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'pitcgi/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
|
-
gem.name =
|
7
|
+
gem.name = Pitcgi::NAME
|
8
8
|
gem.version = Pitcgi::VERSION
|
9
9
|
gem.authors = ["sanadan"]
|
10
10
|
gem.licenses = ['Ruby']
|
@@ -17,4 +17,10 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ["lib"]
|
20
|
+
|
21
|
+
gem.required_ruby_version = '>= 2.0.0'
|
22
|
+
gem.add_development_dependency( 'rake' )
|
23
|
+
gem.add_development_dependency( 'test-unit' )
|
24
|
+
gem.add_dependency( 'scrambled_eggs' )
|
20
25
|
end
|
26
|
+
|
data/test/pitcgi_test.rb
CHANGED
@@ -17,22 +17,23 @@ require File.dirname(__FILE__) + '/test_helper.rb'
|
|
17
17
|
require "test/unit"
|
18
18
|
ORG_DIR = Pitcgi::Directory.to_s.sub( /\/$/, '' ) + '.org'
|
19
19
|
|
20
|
+
def ps( command = nil )
|
21
|
+
puts( command )
|
22
|
+
system( command ) if command
|
23
|
+
end
|
24
|
+
|
20
25
|
class PitcgiTest < Test::Unit::TestCase
|
21
|
-
|
22
|
-
def ps( command )
|
23
|
-
puts( command )
|
24
|
-
system( command )
|
25
|
-
end
|
26
|
+
self.test_order = :defined
|
26
27
|
|
28
|
+
class << self
|
27
29
|
def startup
|
28
30
|
# Rename /etc/pitcgi if exist
|
29
31
|
ps( "sudo mv #{Pitcgi::Directory} #{ORG_DIR}" )
|
30
|
-
ps( "pitcgi init" )
|
31
32
|
end
|
32
33
|
|
33
34
|
def shutdown
|
34
35
|
# Rename /etc/pitcgi.org if exist
|
35
|
-
|
36
|
+
ps()
|
36
37
|
ps( "sudo rm -rf #{Pitcgi::Directory}" )
|
37
38
|
ps( "sudo mv #{ORG_DIR} #{Pitcgi::Directory}" )
|
38
39
|
end
|
@@ -43,6 +44,8 @@ class PitcgiTest < Test::Unit::TestCase
|
|
43
44
|
end
|
44
45
|
|
45
46
|
def test_set_get
|
47
|
+
ps( "pitcgi init" )
|
48
|
+
|
46
49
|
Pitcgi.set("test", :data => {"username"=>"foo","password"=>"bar"})
|
47
50
|
assert_equal "foo", Pitcgi.get("test")["username"]
|
48
51
|
assert_equal "bar", Pitcgi.get("test")["password"]
|
@@ -75,7 +78,7 @@ class PitcgiTest < Test::Unit::TestCase
|
|
75
78
|
tst = Pathname.tempname
|
76
79
|
exe = Pathname.tempname
|
77
80
|
exe.open("w") do |f|
|
78
|
-
f.puts <<-EOF.gsub(
|
81
|
+
f.puts <<-EOF.gsub(/^[\t ]+/, "")
|
79
82
|
#!/usr/bin/env ruby
|
80
83
|
|
81
84
|
File.open(ENV["TEST_FILE"], "w") do |f|
|
@@ -124,14 +127,16 @@ class PitcgiTest < Test::Unit::TestCase
|
|
124
127
|
|
125
128
|
r = Pitcgi.switch("profile2")
|
126
129
|
assert_equal "default", r
|
127
|
-
assert_equal "profile2", Pitcgi.
|
130
|
+
assert_equal( "profile2", Pitcgi.load_config[ "profile" ] )
|
128
131
|
Pitcgi.set("test", :data => {"username"=>"foo2","password"=>"bar2"})
|
129
132
|
assert_equal "foo2", Pitcgi.get("test")["username"]
|
130
133
|
assert_equal "bar2", Pitcgi.get("test")["password"]
|
131
134
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
+
assert_raise do
|
136
|
+
Pitcgi.switch( 'pitcgi' )
|
137
|
+
end
|
138
|
+
assert_equal( 'foo2', Pitcgi.get( 'test' )[ 'username' ] )
|
139
|
+
|
135
140
|
Pitcgi.switch("default")
|
136
141
|
Pitcgi.set("test", :data => {"username"=>"foo6","password"=>"bar6"})
|
137
142
|
assert_equal "foo6", Pitcgi.get("test")["username"]
|
@@ -140,4 +145,60 @@ class PitcgiTest < Test::Unit::TestCase
|
|
140
145
|
# Clear
|
141
146
|
Pitcgi.set("test", :data => {})
|
142
147
|
end
|
148
|
+
|
149
|
+
def test_scramble
|
150
|
+
Pitcgi.set( 'test', :data => { 'username' => 'foo7', 'password' => 'bar7' } )
|
151
|
+
path = Pathname( '/etc/pitcgi/default.yaml' )
|
152
|
+
src = path.binread
|
153
|
+
Pitcgi.scramble
|
154
|
+
scrambled = path.binread
|
155
|
+
assert_not_equal( src, scrambled )
|
156
|
+
assert_raise do
|
157
|
+
Pitcgi.scramble
|
158
|
+
end
|
159
|
+
Pitcgi.descramble
|
160
|
+
descrambled = path.binread
|
161
|
+
assert_equal( src, descrambled )
|
162
|
+
assert_raise do
|
163
|
+
Pitcgi.descramble
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def test_access_scrambled
|
168
|
+
username = 'foo8'
|
169
|
+
password = 'bar8'
|
170
|
+
Pitcgi.set( 'test', :data => { 'username' => username, 'password' => password } )
|
171
|
+
Pitcgi.scramble
|
172
|
+
assert_equal( Pitcgi.get( 'test' )[ 'username' ], username )
|
173
|
+
assert_equal( Pitcgi.get( 'test' )[ 'password' ], password )
|
174
|
+
Pitcgi.descramble
|
175
|
+
end
|
176
|
+
|
177
|
+
def test_access_mix_scrambled
|
178
|
+
username = 'foo9'
|
179
|
+
password = 'bar9'
|
180
|
+
Pitcgi.set( 'test', :data => { 'username' => username, 'password' => password } )
|
181
|
+
Pitcgi.scramble
|
182
|
+
Pitcgi.switch( 'profile2' )
|
183
|
+
username2 = 'foo10'
|
184
|
+
password2 = 'bar10'
|
185
|
+
Pitcgi.set( 'test2', :data => { 'username2' => username2, 'password2' => password2 } )
|
186
|
+
|
187
|
+
Pitcgi.switch( 'default' )
|
188
|
+
assert_equal( Pitcgi.get( 'test' )[ 'username' ], username )
|
189
|
+
assert_equal( Pitcgi.get( 'test' )[ 'password' ], password )
|
190
|
+
|
191
|
+
Pitcgi.switch( 'profile2' )
|
192
|
+
assert_equal( Pitcgi.get( 'test2' )[ 'username2' ], username2 )
|
193
|
+
assert_equal( Pitcgi.get( 'test2' )[ 'password2' ], password2 )
|
194
|
+
Pitcgi.scramble
|
195
|
+
assert_equal( Pitcgi.get( 'test2' )[ 'username2' ], username2 )
|
196
|
+
assert_equal( Pitcgi.get( 'test2' )[ 'password2' ], password2 )
|
197
|
+
|
198
|
+
Pitcgi.switch( 'default' )
|
199
|
+
Pitcgi.descramble
|
200
|
+
assert_equal( Pitcgi.get( 'test' )[ 'username' ], username )
|
201
|
+
assert_equal( Pitcgi.get( 'test' )[ 'password' ], password )
|
202
|
+
end
|
143
203
|
end
|
204
|
+
|
metadata
CHANGED
@@ -1,15 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pitcgi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sanadan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
12
|
-
dependencies:
|
11
|
+
date: 2015-02-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
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: test-unit
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
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: scrambled_eggs
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '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'
|
13
55
|
description: 'pitcgi: account management tool for cgi'
|
14
56
|
email:
|
15
57
|
- jecy00@gmail.com
|
@@ -18,8 +60,8 @@ executables:
|
|
18
60
|
extensions: []
|
19
61
|
extra_rdoc_files: []
|
20
62
|
files:
|
21
|
-
-
|
22
|
-
-
|
63
|
+
- .gitignore
|
64
|
+
- CHANGELOG.md
|
23
65
|
- Gemfile
|
24
66
|
- README.md
|
25
67
|
- Rakefile
|
@@ -39,17 +81,17 @@ require_paths:
|
|
39
81
|
- lib
|
40
82
|
required_ruby_version: !ruby/object:Gem::Requirement
|
41
83
|
requirements:
|
42
|
-
- -
|
84
|
+
- - '>='
|
43
85
|
- !ruby/object:Gem::Version
|
44
|
-
version:
|
86
|
+
version: 2.0.0
|
45
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
88
|
requirements:
|
47
|
-
- -
|
89
|
+
- - '>='
|
48
90
|
- !ruby/object:Gem::Version
|
49
91
|
version: '0'
|
50
92
|
requirements: []
|
51
93
|
rubyforge_project:
|
52
|
-
rubygems_version: 2.
|
94
|
+
rubygems_version: 2.0.14
|
53
95
|
signing_key:
|
54
96
|
specification_version: 4
|
55
97
|
summary: 'pitcgi: account management tool for cgi'
|
data/ChangeLog
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
2015-01-28 sanadan <jecy00@gmail.com>
|
2
|
-
|
3
|
-
* Add init command
|
4
|
-
|
5
|
-
|
6
|
-
2015-01-13 sanadan <jecy00@gmail.com>
|
7
|
-
|
8
|
-
* Fixed error using value "false"
|
9
|
-
|
10
|
-
|
11
|
-
2014-12-18 sanadan <jecy00@gmail.com>
|
12
|
-
|
13
|
-
* Change pit 0.0.7 for cgi only.
|
14
|
-
* Rename to pitcgi.
|
15
|
-
|