ringo 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 @@
1
+ config
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ringo.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,39 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ringo (0.0.1)
5
+ formatador
6
+ nokogiri
7
+ wrest
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ activesupport (3.2.7)
13
+ i18n (~> 0.6)
14
+ multi_json (~> 1.0)
15
+ builder (3.0.0)
16
+ diff-lcs (1.1.3)
17
+ formatador (0.2.3)
18
+ i18n (0.6.0)
19
+ multi_json (1.3.6)
20
+ nokogiri (1.5.5)
21
+ rspec (2.10.0)
22
+ rspec-core (~> 2.10.0)
23
+ rspec-expectations (~> 2.10.0)
24
+ rspec-mocks (~> 2.10.0)
25
+ rspec-core (2.10.1)
26
+ rspec-expectations (2.10.0)
27
+ diff-lcs (~> 1.1.3)
28
+ rspec-mocks (2.10.1)
29
+ wrest (1.5.0)
30
+ activesupport (~> 3)
31
+ builder (> 2.0)
32
+ multi_json (~> 1.0)
33
+
34
+ PLATFORMS
35
+ ruby
36
+
37
+ DEPENDENCIES
38
+ ringo!
39
+ rspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 shyamvala
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,18 @@
1
+ # Ringo
2
+
3
+ Ringo is a rake plugin that allows you to interact with Mingle from the
4
+ command line.
5
+
6
+ # Commands
7
+
8
+ <pre>
9
+ rake stories
10
+ </pre>
11
+
12
+ This command returns a list of the stories currently in development.
13
+
14
+ <pre>
15
+ rake wall
16
+ </pre>
17
+
18
+ This command returns a formatted story wall from Ready for Dev to In QA.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/lib/ringo.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'ringo/emitter'
2
+ require 'ringo/mingle'
3
+ require 'ringo/property'
4
+ require 'ringo/story_card'
5
+ require 'ringo/version'
6
+ require 'ringo/railtie' if defined?(Rails)
@@ -0,0 +1,17 @@
1
+ require 'formatador'
2
+
3
+ module Ringo
4
+ class Emitter
5
+ class << self
6
+ def emit objects
7
+ objects.each do |object|
8
+ puts object.to_emit
9
+ end
10
+ end
11
+
12
+ def emit_table table, order
13
+ Formatador.display_table table, order
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,55 @@
1
+ require 'nokogiri'
2
+ require 'yaml'
3
+ require 'net/http'
4
+ require 'wrest'
5
+
6
+ module Ringo
7
+ class Mingle
8
+ class << self
9
+ def config
10
+ @@config ||= YAML.load File.open('config/mingle.yml')
11
+ end
12
+
13
+ def user
14
+ config['user']
15
+ end
16
+
17
+ def password
18
+ config['password']
19
+ end
20
+
21
+ def project
22
+ config['project']
23
+ end
24
+
25
+ def host
26
+ config['host']
27
+ end
28
+
29
+ def stories
30
+ filter = {'view' => 'Story Wall'}
31
+ Ringo::StoryCard.from_result get 'cards.xml', filter
32
+ end
33
+
34
+ def wall
35
+ result = {}
36
+
37
+ stories.each do |story|
38
+ next unless STATUSES.include? story.status
39
+ result[story.status] ||= []
40
+ result[story.status] << story
41
+ end
42
+
43
+ result
44
+ end
45
+
46
+ def base
47
+ "https://#{host}/api/v2/projects/#{project}".to_uri(username: user, password: password)
48
+ end
49
+
50
+ def get url, params={}
51
+ Nokogiri::XML base[url].get(params).body
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,15 @@
1
+ module Ringo
2
+ class Property
3
+ def self.from_result node
4
+ Property.new node.at_css('name').text,
5
+ node.at_css('value').text
6
+ end
7
+
8
+ attr_reader :name, :value
9
+
10
+ def initialize name, value
11
+ @name = name
12
+ @value = value
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,7 @@
1
+ module Ringo
2
+ class Railtie < ::Rails::Railtie
3
+ rake_tasks do
4
+ load 'ringo/tasks.rb'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,39 @@
1
+ module Ringo
2
+ class StoryCard
3
+ def self.from_result result
4
+ result.css('card').map do |node|
5
+ properties = node.css('property').map do |property_node|
6
+ Property.from_result property_node
7
+ end
8
+
9
+ StoryCard.new node.at_css('name').text,
10
+ node.at_css('number').text,
11
+ properties
12
+ end
13
+ end
14
+
15
+ attr_reader :name, :number, :properties
16
+
17
+ def initialize name, number, properties
18
+ @name = name
19
+ @number = number
20
+ @properties = properties
21
+ end
22
+
23
+ def status
24
+ properties.detect { |property| property.name == 'Status' }.value
25
+ end
26
+
27
+ def to_emit(max=1000)
28
+ "##{number} - #{name}"[0..max]
29
+ end
30
+
31
+ def to_hash
32
+ {
33
+ name: name[0..30],
34
+ number: number,
35
+ status: status
36
+ }
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,25 @@
1
+ namespace :ringo do
2
+ desc 'Returns a list of the stories currently in development'
3
+ task :stories do
4
+ Ringo::Emitter.emit Ringo::Mingle.stories.select { |story| story.status == 'In Dev' }
5
+ end
6
+
7
+ desc 'Gets the story wall from Ready for Dev to In QA'
8
+ task :wall do
9
+ STATUSES = ['Ready for Dev', 'In Dev', 'UX Review', 'Ready for QA', 'In QA']
10
+ wall = Ringo::Mingle.wall
11
+
12
+ longest = wall.map { |key, value| value.size }.max
13
+ table = []
14
+ (0...longest).each do |index|
15
+ row = {}
16
+ wall.keys.each do |key|
17
+ val = wall[key][index]
18
+ row[key] = val.to_emit(20) if val
19
+ end
20
+ table << row
21
+ end
22
+
23
+ Ringo::Emitter.emit_table table, STATUSES
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ module Ringo
2
+ VERSION = "0.0.1"
3
+ end
Binary file
data/ringo.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/ringo/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Derek Hammer"]
6
+ gem.email = ["derek.r.hammer@gmail.com"]
7
+ gem.description = %q{Ringo is a rails gem that allows you to interact with Mingle from the
8
+ command line.}
9
+ gem.summary = %q{Ringo is a rails gem that allows you to interact with Mingle from the
10
+ command line.}
11
+ gem.homepage = ""
12
+
13
+ gem.files = `git ls-files`.split($\)
14
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
15
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
16
+ gem.name = "ringo"
17
+ gem.require_paths = ["lib"]
18
+ gem.version = Ringo::VERSION
19
+ gem.add_development_dependency "rspec"
20
+ gem.add_dependency 'nokogiri'
21
+ gem.add_dependency 'formatador'
22
+ gem.add_dependency 'wrest'
23
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe Ringo::Property do
4
+ let(:name) { 'Status' }
5
+ let(:value) { 'In Dev' }
6
+
7
+ subject { Ringo::Property.new name, value }
8
+
9
+ its(:name) { should == name }
10
+ its(:value) { should == value }
11
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe Ringo::StoryCard do
4
+ let(:name) { 'Create user' }
5
+ let(:number) { 101 }
6
+ let(:properties) { [Ringo::Property.new('Status', 'In Development')] }
7
+
8
+ subject { Ringo::StoryCard.new name, number, properties }
9
+
10
+ its(:name) { should == name }
11
+ its(:number) { should == number }
12
+ its(:status) { should == 'In Development' }
13
+ its(:to_emit) { should == '#101 - Create user' }
14
+ it { subject.to_emit(5).should == '#101 -' }
15
+ its(:to_hash) { should == Hash[name: name, number: number, status: 'In Development'] }
16
+ end
@@ -0,0 +1 @@
1
+ require 'ringo'
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ringo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Derek Hammer
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-08-06 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &70139542721960 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70139542721960
25
+ - !ruby/object:Gem::Dependency
26
+ name: nokogiri
27
+ requirement: &70139542721540 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70139542721540
36
+ - !ruby/object:Gem::Dependency
37
+ name: formatador
38
+ requirement: &70139542721120 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70139542721120
47
+ - !ruby/object:Gem::Dependency
48
+ name: wrest
49
+ requirement: &70139542720680 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *70139542720680
58
+ description: ! 'Ringo is a rails gem that allows you to interact with Mingle from
59
+ the
60
+
61
+ command line.'
62
+ email:
63
+ - derek.r.hammer@gmail.com
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files: []
67
+ files:
68
+ - .gitignore
69
+ - Gemfile
70
+ - Gemfile.lock
71
+ - LICENSE
72
+ - README.md
73
+ - Rakefile
74
+ - lib/ringo.rb
75
+ - lib/ringo/emitter.rb
76
+ - lib/ringo/mingle.rb
77
+ - lib/ringo/property.rb
78
+ - lib/ringo/railtie.rb
79
+ - lib/ringo/story_card.rb
80
+ - lib/ringo/tasks.rb
81
+ - lib/ringo/version.rb
82
+ - pkg/ringo-0.0.1.gem
83
+ - ringo.gemspec
84
+ - spec/lib/ringo/property_spec.rb
85
+ - spec/lib/ringo/story_card_spec.rb
86
+ - spec/spec_helper.rb
87
+ homepage: ''
88
+ licenses: []
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 1.8.10
108
+ signing_key:
109
+ specification_version: 3
110
+ summary: Ringo is a rails gem that allows you to interact with Mingle from the command
111
+ line.
112
+ test_files:
113
+ - spec/lib/ringo/property_spec.rb
114
+ - spec/lib/ringo/story_card_spec.rb
115
+ - spec/spec_helper.rb
116
+ has_rdoc: