adn-cli 0.0.1

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/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in adn.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Justin Balthrop
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # ADN CLI
2
+
3
+ App.net command line client
4
+
5
+ ## Installation
6
+
7
+ $ gem install adn-cli
8
+
9
+ ## Usage
10
+
11
+ TODO: Write usage instructions here
12
+
13
+ ## Contributing
14
+
15
+ 1. Fork it
16
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
17
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
18
+ 4. Push to the branch (`git push origin my-new-feature`)
19
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/adn-cli.gemspec ADDED
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/adn/cli/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Justin Balthrop", "Peter Hellberg"]
6
+ gem.email = ["git@justinbalthrop.com", "peter@c7.se"]
7
+ gem.description = %q{App.net command line}
8
+ gem.summary = %q{Command line client for App.net}
9
+ gem.homepage = "https://github.com/adn-rb/adn-cli"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "adn-cli"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = ADN::CLI::VERSION
17
+
18
+ gem.add_runtime_dependency('adn', '~> 0.3')
19
+ end
data/bin/adn ADDED
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env ruby
2
+ require 'webrick'
3
+ require 'pp'
4
+
5
+ TOKEN_FILE = File.expand_path("~/.adn-token")
6
+ AUTH_URL = "https://alpha.app.net/oauth/authenticate?client_id=AWqdakvYjCn5vkcRtBzBLQxgkXGY4HSf&response_type=token&redirect_uri=http://localhost:9229/authorize/&scope=stream"
7
+ PUBLIC = File.expand_path(File.dirname(__FILE__)) + "/../public"
8
+
9
+ class TokenSaver < WEBrick::HTTPServlet::AbstractServlet
10
+ def do_GET(request, response)
11
+ Auth.save_token(request.query['access_token'])
12
+ Auth.server.stop
13
+ end
14
+ end
15
+
16
+ module Auth
17
+ def self.server
18
+ if @server.nil?
19
+ @server = WEBrick::HTTPServer.new(:Port => 9229)
20
+ @server.mount "/authorize", WEBrick::HTTPServlet::FileHandler, PUBLIC
21
+ @server.mount "/save-token", TokenSaver
22
+ end
23
+ @server
24
+ end
25
+
26
+ def self.save_token(token)
27
+ File.open(TOKEN_FILE, 'w') {|f| f.write(token) }
28
+ @token = token
29
+ end
30
+
31
+ def self.token
32
+ @token ||= IO.read(TOKEN_FILE) if File.exists?(TOKEN_FILE)
33
+ if @token.nil?
34
+ system("open \"#{AUTH_URL}\"")
35
+ server.start
36
+ end
37
+ @token
38
+ end
39
+ end
40
+
41
+ pp Auth.token
data/lib/adn.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "adn/cli/version"
2
+
3
+ module ADN
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,5 @@
1
+ module ADN
2
+ class CLI
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
data/public/index.html ADDED
@@ -0,0 +1,15 @@
1
+ <html>
2
+ <head>
3
+
4
+ <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
5
+ <script type="text/javascript">
6
+
7
+ $.get("/save-token?" + window.location.hash.substring(1))
8
+
9
+ </script>
10
+
11
+ </head>
12
+
13
+ <body>
14
+ Thank you for authorizing.
15
+ </body>
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: adn-cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Justin Balthrop
9
+ - Peter Hellberg
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2012-09-09 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: adn
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: '0.3'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: '0.3'
31
+ description: App.net command line
32
+ email:
33
+ - git@justinbalthrop.com
34
+ - peter@c7.se
35
+ executables:
36
+ - adn
37
+ extensions: []
38
+ extra_rdoc_files: []
39
+ files:
40
+ - .gitignore
41
+ - Gemfile
42
+ - LICENSE
43
+ - README.md
44
+ - Rakefile
45
+ - adn-cli.gemspec
46
+ - bin/adn
47
+ - lib/adn.rb
48
+ - lib/adn/cli/version.rb
49
+ - public/index.html
50
+ homepage: https://github.com/adn-rb/adn-cli
51
+ licenses: []
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirements: []
69
+ rubyforge_project:
70
+ rubygems_version: 1.8.24
71
+ signing_key:
72
+ specification_version: 3
73
+ summary: Command line client for App.net
74
+ test_files: []
75
+ has_rdoc: