-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ee74abd
Showing
15 changed files
with
451 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
*.swp | ||
*.gem | ||
*.rbc | ||
.bundle | ||
.config | ||
.yardoc | ||
Gemfile.lock | ||
InstalledFiles | ||
_yardoc | ||
coverage | ||
doc/ | ||
lib/bundler/man | ||
pkg | ||
rdoc | ||
spec/reports | ||
test/tmp | ||
test/version_tmp | ||
tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source 'https://rubygems.org' | ||
|
||
# Specify your gem's dependencies in pry-parsecom.gemspec | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Copyright (c) 2013 Ando Yasushi | ||
|
||
MIT License | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Pry::Parsecom | ||
|
||
TODO: Write a gem description | ||
|
||
## Installation | ||
|
||
Add this line to your application's Gemfile: | ||
|
||
gem 'pry-parsecom' | ||
|
||
And then execute: | ||
|
||
$ bundle | ||
|
||
Or install it yourself as: | ||
|
||
$ gem install pry-parsecom | ||
|
||
## Usage | ||
|
||
TODO: Write usage instructions here | ||
|
||
## Contributing | ||
|
||
1. Fork it | ||
2. Create your feature branch (`git checkout -b my-new-feature`) | ||
3. Commit your changes (`git commit -am 'Add some feature'`) | ||
4. Push to the branch (`git push origin my-new-feature`) | ||
5. Create new Pull Request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require "bundler/gem_tasks" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env ruby | ||
|
||
begin | ||
require 'parse/console' | ||
rescue LoadError | ||
require 'rubygems' | ||
require 'parse/console' | ||
end | ||
|
||
Parse::Console.start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require 'pry' | ||
require 'pry-parsecom/version' | ||
|
||
unless ENV['DISABLE_PRY_PARSECOM'] | ||
require 'io/console' | ||
require 'parsecom' | ||
require 'mechanize' | ||
require 'json' | ||
require 'yaml' | ||
require 'pry-parsecom/setting' | ||
require 'pry-parsecom/commands' | ||
# require 'pry-parsecom/model_formatter' | ||
|
||
module Parsecom | ||
module_function | ||
|
||
def ask_email_and_password | ||
print 'Input parse.com email: ' | ||
email = gets | ||
print 'Input parse.com password: ' | ||
password = STDIN.noecho(&:gets) | ||
puts | ||
[email.strip, password.strip] | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# encoding: UTF-8 | ||
|
||
PryParsecom::Commands = Pry::CommandSet.new | ||
|
||
command_glob = File.expand_path('../commands/*.rb', __FILE__) | ||
|
||
Dir[command_glob].each do |command| | ||
require command | ||
end | ||
|
||
Pry.commands.import PryParsecom::Commands |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# encoding: UTF-8 | ||
|
||
PryParsecom::Commands.create_command "refresh-schemas" do | ||
group 'Parse.com' | ||
description 'Refresh parse.com schemas' | ||
|
||
def options opt | ||
opt.banner <<-EOS.gsub(/^\s+/, '') | ||
Usage: refresh-schemas | ||
Refresh parse.com schemas | ||
EOS | ||
end | ||
|
||
def process | ||
PryParsecom::Setting.refresh *PryParsecom.ask_email_and_password | ||
puts PryParsecom::Setting.app_names | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# encoding: UTF-8 | ||
|
||
PryParsecom::Commands.create_command "show-applications" do | ||
group 'Parse.com' | ||
description 'Show all parse applications' | ||
|
||
def options opt | ||
opt.banner unindent <<-EOS | ||
Usage: show-applications | ||
Show all parse applications | ||
EOS | ||
end | ||
|
||
def process | ||
PryParsecom::Setting.app_names.each do |app| | ||
output.puts app | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# encoding: UTF-8 | ||
|
||
PryParsecom::Commands.create_command 'show-classes' do | ||
group 'Parse.com' | ||
description 'Show all parse classes' | ||
|
||
def options opt | ||
opt.banner unindent <<-EOS | ||
Usage: show-classes [app_name] | ||
Show all parse classes | ||
EOS | ||
end | ||
|
||
def process | ||
if 1 < args.size | ||
output.puts opt | ||
return | ||
end | ||
|
||
setting = PryParsecom::Setting.current_setting | ||
unless setting | ||
output.puts 'Now using no app' | ||
end | ||
|
||
setting.classes.each do |klass| | ||
output.puts klass | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# encoding: UTF-8 | ||
|
||
PryParsecom::Commands.create_command "show-credentials" do | ||
group 'Parse.com' | ||
description 'Show credentials for parse.com' | ||
|
||
def options opt | ||
opt.banner unindent <<-EOS | ||
Usage: show-credentials | ||
Show parse.com credentials: application_id, rest_api_key and master_key. | ||
EOS | ||
end | ||
|
||
def process | ||
output.puts unindent <<-EOS | ||
APPLICATION_ID: #{Parse.application_id} | ||
REST_API_KEY : #{Parse.api_key} | ||
MASTER_KEY : #{(Parse.master_key || '').sub(/.{30}$/, '*' * 30)} | ||
EOS | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# encoding: UTF-8 | ||
|
||
PryParsecom::Commands.create_command "use" do | ||
group 'Parse.com' | ||
description 'Set the current parse.com application' | ||
|
||
def options opt | ||
opt.banner <<-EOS.gsub(/^\s+/, '') | ||
Usage: use your-app-name | ||
Set the current parse.com application | ||
EOS | ||
end | ||
|
||
def process | ||
unless args.size == 1 | ||
output.puts opt | ||
return | ||
end | ||
|
||
app_name = args.first.to_s | ||
unless PryParsecom::Setting.has_app? app_name | ||
output.puts "#{app_name} does not exist." | ||
return | ||
end | ||
|
||
if PryParsecom.current_app | ||
prev_setting = PryParsecom::Setting.current_setting | ||
prev_setting.reset Parse::Client.default if prev_setting | ||
end | ||
|
||
setting = PryParsecom::Setting.by_name app_name | ||
setting.set Parse::Client.default | ||
PryParsecom.current_app = app_name | ||
output.puts "The current app is #{app_name}." | ||
end | ||
end |
Oops, something went wrong.