rubysteps 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2fd7c82511f0cd8b372bcc42ec36930c7f723255
4
+ data.tar.gz: 56b0ed9d20e3413ee81cd65eddf07adc382ac960
5
+ SHA512:
6
+ metadata.gz: d7d0e3d6c7ede71dcdc8edbdaacd1b15978a215d53c84cceee049d7be252d75432a9362fde3b16c07dd7d3d52d4d1ff37d369f24e266fdf3d8485dc857b571b6
7
+ data.tar.gz: 41f4dce36cdb3a843530b07bcda3b25cac7c441ac3c89edcc8bc95466714bd9c1e76477a1e9174a2d13a041f0dce4f46dca095b35163d86af2150ca3114df159
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rubysteps.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Pat Maddox
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,11 @@
1
+ # Rubysteps
2
+
3
+ ## Installation
4
+
5
+ ```
6
+ gem install rubysteps
7
+ ```
8
+
9
+ ## Usage
10
+
11
+ ```rubysteps```
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/rubysteps ADDED
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env ruby
2
+ require 'thor'
3
+ require 'active_rest_client'
4
+
5
+ filename = File.expand_path('~/.rubysteps-login')
6
+ unless File.exist?(filename)
7
+ $stderr.puts "Missing ~/.rubysteps-login - please contact pat for your credentials"
8
+ exit 1
9
+ end
10
+
11
+ USERNAME, TOKEN = File.read(filename).strip.split(":")
12
+
13
+ class MobResource < ActiveRestClient::Base
14
+ if ENV['dev']
15
+ base_url "http://#{USERNAME}:#{TOKEN}@localhost:3000/"
16
+ else
17
+ base_url "https://#{USERNAME}:#{TOKEN}@mob-lobby.herokuapp.com/"
18
+ end
19
+
20
+ get :all, "/mobs"
21
+ get :find, "/mobs/:id"
22
+ put :join, "/mobs/:id/join"
23
+
24
+ def to_s
25
+ parts = [
26
+ "Name: #{name}",
27
+ "Slug: #{slug}",
28
+ "Status: #{status}",
29
+ "Users: #{users_count}/#{max_users}"
30
+ ]
31
+ if started_at
32
+ parts << "Started at: #{started_at}"
33
+ elsif starts_at
34
+ parts << "Starts at: #{starts_at}"
35
+ end
36
+
37
+ parts.join("\n")
38
+ end
39
+ end
40
+
41
+ class RubyStepsClient
42
+ def self.mobs
43
+ MobResource.all[:mobs]
44
+ end
45
+
46
+ def self.join_mob(slug)
47
+ begin
48
+ mob = MobResource.join(slug)[:mob]
49
+ puts "Joining #{slug}..."
50
+ puts "Connect with: ssh #{USERNAME}@mob1.patmaddox.com"
51
+ rescue ActiveRestClient::HTTPNotFoundClientException
52
+ $stderr.puts "Cannot find #{slug}"
53
+ rescue ActiveRestClient::HTTPUnauthorisedClientException => e
54
+ $stderr.puts "Unauthorized. #{e.result}"
55
+ end
56
+ end
57
+ end
58
+
59
+ class RubySteps < Thor
60
+ desc "list", "List mobs waiting to start"
61
+ def list
62
+ mobs = RubyStepsClient.mobs
63
+ if mobs.any?
64
+ mobs.each do |m|
65
+ puts m
66
+ puts
67
+ puts "Join: rubysteps join #{m.slug}"
68
+
69
+ puts
70
+ puts "========="
71
+ puts
72
+ end
73
+
74
+ puts "Jump in!"
75
+
76
+ else
77
+ $stderr.puts "No mobs in progress or upcoming. Check back later"
78
+ end
79
+ end
80
+
81
+ desc "join SLUG", "Join the mob SLUG"
82
+ def join(slug)
83
+ RubyStepsClient.join_mob(slug)
84
+ end
85
+
86
+ desc "create", "Create a new mob"
87
+ def create
88
+ puts "Not ready to create new mobs yet"
89
+ end
90
+
91
+ desc "chicken", "Does the funky chicken"
92
+ def chicken
93
+ puts "cluck cluck!"
94
+ end
95
+ end
96
+
97
+ RubySteps.start
@@ -0,0 +1,3 @@
1
+ module Rubysteps
2
+ VERSION = "0.0.1"
3
+ end
data/lib/rubysteps.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "rubysteps/version"
2
+
3
+ module Rubysteps
4
+ # Your code goes here...
5
+ end
data/rubysteps.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rubysteps/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rubysteps"
8
+ spec.version = Rubysteps::VERSION
9
+ spec.authors = ["Pat Maddox"]
10
+ spec.email = ["pat@patmaddox.com"]
11
+ spec.summary = %q{RubySteps client application http://patmaddox.com/rubysteps}
12
+ spec.description = %q{RubySteps client application - yeah buddy! - http://patmaddox.com/rubysteps}
13
+ spec.homepage = "http://patmaddox.com/rubysteps"
14
+ spec.license = "https://github.com/RubySteps/rubysteps/blob/free/LICENSE.md"
15
+
16
+ spec.post_install_message = "*****\n\nYeah buddy! You have a nifty new `rubysteps` command - check it out!\n\n*****\n\n"
17
+
18
+ spec.files = `git ls-files -z`.split("\x0")
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_dependency "thor", "~> 0.19.1", ">= 0.19.1"
24
+ spec.add_dependency "active_rest_client", "~> 1.0.3", ">= 1.0.3"
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.6"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ end
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubysteps
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Pat Maddox
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.19.1
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.19.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: 0.19.1
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.19.1
33
+ - !ruby/object:Gem::Dependency
34
+ name: active_rest_client
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 1.0.3
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.0.3
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: 1.0.3
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 1.0.3
53
+ - !ruby/object:Gem::Dependency
54
+ name: bundler
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '1.6'
60
+ type: :development
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '1.6'
67
+ - !ruby/object:Gem::Dependency
68
+ name: rake
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: '10.0'
74
+ type: :development
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '10.0'
81
+ description: RubySteps client application - yeah buddy! - http://patmaddox.com/rubysteps
82
+ email:
83
+ - pat@patmaddox.com
84
+ executables:
85
+ - rubysteps
86
+ extensions: []
87
+ extra_rdoc_files: []
88
+ files:
89
+ - ".gitignore"
90
+ - Gemfile
91
+ - LICENSE.txt
92
+ - README.md
93
+ - Rakefile
94
+ - bin/rubysteps
95
+ - lib/rubysteps.rb
96
+ - lib/rubysteps/version.rb
97
+ - rubysteps.gemspec
98
+ homepage: http://patmaddox.com/rubysteps
99
+ licenses:
100
+ - https://github.com/RubySteps/rubysteps/blob/free/LICENSE.md
101
+ metadata: {}
102
+ post_install_message: |+
103
+ *****
104
+
105
+ Yeah buddy! You have a nifty new `rubysteps` command - check it out!
106
+
107
+ *****
108
+
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ requirements: []
123
+ rubyforge_project:
124
+ rubygems_version: 2.2.2
125
+ signing_key:
126
+ specification_version: 4
127
+ summary: RubySteps client application http://patmaddox.com/rubysteps
128
+ test_files: []