pry-parsecom 0.0.4 → 0.0.5
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.
- data/lib/pry-parsecom/commands/show_applications.rb +1 -0
- data/lib/pry-parsecom/commands/show_classes.rb +1 -0
- data/lib/pry-parsecom/commands/show_credentials.rb +1 -0
- data/lib/pry-parsecom/commands/show_schema.rb +1 -0
- data/lib/pry-parsecom/setting.rb +24 -4
- data/lib/pry-parsecom/version.rb +1 -1
- metadata +2 -2
data/lib/pry-parsecom/setting.rb
CHANGED
@@ -29,6 +29,8 @@ module PryParsecom
|
|
29
29
|
|
30
30
|
def current_app= app
|
31
31
|
@@current_app = app
|
32
|
+
store_setting
|
33
|
+
app
|
32
34
|
end
|
33
35
|
|
34
36
|
def current_setting
|
@@ -37,7 +39,7 @@ module PryParsecom
|
|
37
39
|
|
38
40
|
def setup_if_needed
|
39
41
|
if @@apps.empty?
|
40
|
-
unless
|
42
|
+
unless restore
|
41
43
|
login *PryParsecom.ask_email_and_password
|
42
44
|
end
|
43
45
|
end
|
@@ -54,7 +56,7 @@ module PryParsecom
|
|
54
56
|
end
|
55
57
|
end
|
56
58
|
|
57
|
-
def
|
59
|
+
def restore
|
58
60
|
if File.exist? DOT_DIRNAME
|
59
61
|
settings = read_setting_file SETTINGS_FILENAME
|
60
62
|
ignores = read_setting_file IGNORES_FILENAME
|
@@ -69,13 +71,17 @@ module PryParsecom
|
|
69
71
|
@@apps[app_name] = Setting.new app_name, key['app_id'], key['api_key'],
|
70
72
|
key['master_key'], schemas[app_name]
|
71
73
|
end
|
74
|
+
unless settings.empty?
|
75
|
+
settings = YAML.load settings
|
76
|
+
@@current_app = settings['current_app']
|
77
|
+
end
|
72
78
|
return true
|
73
79
|
end
|
74
80
|
end
|
75
81
|
false
|
76
82
|
end
|
77
83
|
|
78
|
-
def
|
84
|
+
def store_cache
|
79
85
|
keys = {}
|
80
86
|
schemas = {}
|
81
87
|
@@apps.each do |app_name, setting|
|
@@ -91,6 +97,12 @@ module PryParsecom
|
|
91
97
|
write_setting_file SCHEMAS_FILENAME, schemas
|
92
98
|
end
|
93
99
|
|
100
|
+
def store_setting
|
101
|
+
if @@current_app
|
102
|
+
write_setting_file SETTINGS_FILENAME, 'current_app' => @@current_app
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
94
106
|
def login email, password
|
95
107
|
@@apps = {}
|
96
108
|
|
@@ -121,7 +133,7 @@ module PryParsecom
|
|
121
133
|
@@apps[app_name] = Setting.new app_name, app_id, api_key, master_key, schema
|
122
134
|
end
|
123
135
|
|
124
|
-
|
136
|
+
store_cache
|
125
137
|
end
|
126
138
|
|
127
139
|
def logout
|
@@ -131,6 +143,14 @@ module PryParsecom
|
|
131
143
|
@@current_app = nil
|
132
144
|
end
|
133
145
|
|
146
|
+
def cache_time
|
147
|
+
if File.exist? DOT_DIRNAME
|
148
|
+
File.mtime "#{DOT_DIRNAME}/#{SCHEMAS_FILENAME}"
|
149
|
+
else
|
150
|
+
nil
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
134
154
|
def app_names
|
135
155
|
@@apps.keys
|
136
156
|
end
|
data/lib/pry-parsecom/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-parsecom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-11-
|
12
|
+
date: 2013-11-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pry
|