hackathon_drone 0.0.3 → 0.0.4

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.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YTBiMzM2NjJjZjc3NzliN2Y0MmE0Mzk2ZDAwYTc3MjQ1NTZiMGU0NQ==
5
+ data.tar.gz: !binary |-
6
+ ZWFkNWE5OTU1MmZiOGRmMjcwNjFmMGI3NmI2ZjI5NzM4MmZlZWJkNA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ OWFmNmZmOGU1Y2RiNTZkMjBjMjFmZjU0NDk2NDFjM2NmNjUyNjZmM2M4MDcx
10
+ YWY4Mzk0MzUwMWZmNTFkYWQ4ZTg0YWVjMDRkMTQwNmRkY2JmZjQ4NDRjZjMw
11
+ ZWYwMmI5NTg4OTE0MWJjZjYyZjdiYWVkNTYxMzVhNDhjNGJlYTY=
12
+ data.tar.gz: !binary |-
13
+ NWU5MTlkMjNjOGRhN2ZmMTVkN2I2MjcwNGVmNDhiYzNhMmY5YjU5N2RkNTRl
14
+ OWRlYzVlYmJiMjQyYzUxOTE5ZGI2YjBjMGZmYzJlY2NmYWJmMGVmMmUxZGY2
15
+ MDZiMGViMDc3N2I1MTk4ZWI0OTZlOGU2Y2Y5ZmM0MTQ3NTVhMDc=
metadata CHANGED
@@ -1,91 +1,84 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hackathon_drone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 0.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - François-Pierre Bouchard
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-06 00:00:00.000000000 Z
11
+ date: 2014-06-06 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: git-branch_stats
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: 0.0.3
19
+ version: '0.0'
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 0.0.4
22
23
  type: :runtime
23
24
  prerelease: false
24
25
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 0.0.3
29
+ version: '0.0'
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 0.0.4
30
33
  - !ruby/object:Gem::Dependency
31
34
  name: thor
32
35
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
36
  requirements:
35
37
  - - ~>
38
+ - !ruby/object:Gem::Version
39
+ version: '0.18'
40
+ - - ! '>='
36
41
  - !ruby/object:Gem::Version
37
42
  version: 0.18.1
38
43
  type: :runtime
39
44
  prerelease: false
40
45
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
46
  requirements:
43
47
  - - ~>
48
+ - !ruby/object:Gem::Version
49
+ version: '0.18'
50
+ - - ! '>='
44
51
  - !ruby/object:Gem::Version
45
52
  version: 0.18.1
46
53
  description: Script that runs in the background, analyzing your branch and uploading
47
54
  stats to a hackathon-dashboard backend.
48
55
  email:
49
56
  - fpbouchard@gmail.com
50
- executables:
51
- - hackathon_drone
57
+ executables: []
52
58
  extensions: []
53
59
  extra_rdoc_files: []
54
- files:
55
- - .gitignore
56
- - Gemfile
57
- - LICENSE.txt
58
- - README.md
59
- - Rakefile
60
- - bin/hackathon_drone
61
- - hackathon_drone.gemspec
62
- - lib/hackathon_drone.rb
63
- - lib/hackathon_drone/cli.rb
64
- - lib/hackathon_drone/configuration.rb
65
- - lib/hackathon_drone/rest.rb
66
- - lib/hackathon_drone/version.rb
60
+ files: []
67
61
  homepage: ''
68
62
  licenses: []
63
+ metadata: {}
69
64
  post_install_message:
70
65
  rdoc_options: []
71
66
  require_paths:
72
67
  - lib
73
68
  required_ruby_version: !ruby/object:Gem::Requirement
74
- none: false
75
69
  requirements:
76
70
  - - ! '>='
77
71
  - !ruby/object:Gem::Version
78
72
  version: '0'
79
73
  required_rubygems_version: !ruby/object:Gem::Requirement
80
- none: false
81
74
  requirements:
82
75
  - - ! '>='
83
76
  - !ruby/object:Gem::Version
84
77
  version: '0'
85
78
  requirements: []
86
79
  rubyforge_project:
87
- rubygems_version: 1.8.25
80
+ rubygems_version: 2.2.2
88
81
  signing_key:
89
- specification_version: 3
82
+ specification_version: 4
90
83
  summary: Follow your hackathon!
91
84
  test_files: []
data/.gitignore DELETED
@@ -1,17 +0,0 @@
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 DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in hackathon_drone.gemspec
4
- gemspec
data/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2013 François-Pierre Bouchard
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 DELETED
@@ -1,29 +0,0 @@
1
- # HackathonDrone
2
-
3
- TODO: Write a gem description
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'hackathon_drone'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself as:
16
-
17
- $ gem install hackathon_drone
18
-
19
- ## Usage
20
-
21
- TODO: Write usage instructions here
22
-
23
- ## Contributing
24
-
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
data/Rakefile DELETED
@@ -1 +0,0 @@
1
- require "bundler/gem_tasks"
data/bin/hackathon_drone DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # Trap interrupts to quit cleanly. See
4
- # https://twitter.com/mitchellh/status/283014103189053442
5
- Signal.trap("INT") { exit 1 }
6
-
7
- require 'hackathon_drone/cli'
8
- HackathonDrone::CLI.start
@@ -1,22 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'hackathon_drone/version'
5
-
6
- Gem::Specification.new do |gem|
7
- gem.name = "hackathon_drone"
8
- gem.version = HackathonDrone::VERSION
9
- gem.authors = ["François-Pierre Bouchard"]
10
- gem.email = ["fpbouchard@gmail.com"]
11
- gem.description = %q{Script that runs in the background, analyzing your branch and uploading stats to a hackathon-dashboard backend.}
12
- gem.summary = %q{Follow your hackathon!}
13
- gem.homepage = ""
14
-
15
- gem.add_dependency "git-branch_stats", '~>0.0.3'
16
- gem.add_dependency "thor", '~>0.18.1'
17
-
18
- gem.files = `git ls-files`.split($/)
19
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
20
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
21
- gem.require_paths = ["lib"]
22
- end
@@ -1 +0,0 @@
1
- require "hackathon_drone/version"
@@ -1,143 +0,0 @@
1
- require 'thor'
2
- require 'curses'
3
- require 'git-branch_stats'
4
- require 'yaml'
5
-
6
- require 'hackathon_drone/configuration'
7
- require 'hackathon_drone/rest'
8
-
9
- VENUES_PATH = "/venues.json"
10
- TEAMS_PATH = "/venues/:venue_id/teams.json"
11
- VENUE_PATH = "/venues/:id.json"
12
- TEAM_PATH = "/venues/:venue_id/teams/:id.json"
13
-
14
- module HackathonDrone
15
-
16
- class CLI < Thor
17
-
18
- def initialize(*)
19
- super
20
-
21
- project = `git rev-parse --show-toplevel`.strip.split('/').last
22
- @config = HackathonDrone::Configuration.new(project)
23
- end
24
-
25
- desc "subscribe TEAM_NAME [HOST] [PORT]", "Subscribe the team named TEAM_NAME for the currently active venue and current working tree."
26
- def subscribe(team_name, host = "hackathon-dashboard.herokuapp.com", port = 80)
27
- if @config.get('team')
28
- puts "Already subscribed as #{@config.get('team')['name']}"
29
- exit
30
- end
31
-
32
- # 1. Get the venues
33
- venues = HackathonDrone::REST.get(host, port, VENUES_PATH)
34
- # 2. Find the first open venue
35
- open_venue = venues.find {|venue| venue['state'] == 'open'}
36
- # 3. Bail out if no open venue is found
37
- unless open_venue
38
- puts "No open venue yet, wait until the organizer opens the venue!"
39
- exit
40
- end
41
-
42
- team = HackathonDrone::REST.post(host, port, TEAMS_PATH.gsub(/:venue_id/, open_venue['id'].to_s), {:name => team_name})
43
-
44
- if team
45
- @config.set('team', team)
46
- @config.set('host', host)
47
- @config.set('port', port)
48
-
49
- puts "Your team has been subscribed!"
50
- end
51
- end
52
-
53
- desc "monitor", "Start monitoring the current repository"
54
- def monitor
55
- unless team = @config.get('team')
56
- puts "You first need to subscribe!"
57
- exit
58
- end
59
-
60
- Curses.noecho
61
- Curses.curs_set(0)
62
- Curses.init_screen
63
- begin
64
- Curses.setpos(0,0)
65
- Curses.addstr "Monitoring #{@config.project}"
66
- Curses.refresh
67
- Curses.setpos(2,0)
68
- while true
69
- # Validate that the venue is in progress
70
- venue = HackathonDrone::REST.get(@config.get('host'), @config.get('port'), VENUE_PATH.gsub(/:id/, team['venue_id'].to_s))
71
- if venue and venue['state'] == 'started'
72
- team_stats = Git::BranchStats.analyze
73
- team = @config.set('team', HackathonDrone::REST.put(@config.get('host'), @config.get('port'), TEAM_PATH.gsub(/:id/, team['id'].to_s).gsub(/:venue_id/, team['venue_id'].to_s), team_stats))
74
-
75
- report(team, team_stats)
76
- else
77
- if venue
78
- if venue['state'] == "open"
79
- Curses.addstr 'Venue is still open, waiting for venue to start...'
80
- else
81
- puts "This venue is '#{venue['state']}'! It is not in progress."
82
- exit
83
- end
84
- else
85
- puts "Venue #{team['venue_id']} was not found"
86
- exit
87
- end
88
- end
89
-
90
- Curses.refresh
91
-
92
- # Re-analyze in x seconds
93
- sleep 10
94
- end
95
- ensure
96
- Curses.close_screen
97
- end
98
-
99
- end
100
-
101
- desc "reset", "Reset your settings for this repository"
102
- def reset
103
- @config.reset
104
- end
105
-
106
- desc "analyze", "Just show the stats of your repository without sending anything"
107
- def analyze
108
- puts Git::BranchStats.analyze
109
- end
110
-
111
-
112
- no_commands do
113
- def report(team, team_stats)
114
- y = 2
115
- Curses.setpos(y,0)
116
- Curses.addstr("Team: #{team['name']}")
117
- y += 2
118
- Curses.setpos(y,0)
119
- Curses.addstr("+#{team['additions']} lines")
120
- Curses.setpos(y,20)
121
- Curses.addstr("-#{team['deletions']} lines")
122
- y += 2
123
- Curses.setpos(y,0)
124
- Curses.addstr("#{team['files_changed']} files")
125
- Curses.setpos(y,20)
126
- Curses.addstr("#{team['commits']} commits")
127
-
128
- y += 1
129
- team['language_stats'].each do |stats|
130
- y += 1
131
- Curses.setpos(y,0)
132
- Curses.addstr("#{stats[0]}: #{stats[1]} bytes")
133
- end
134
-
135
- y += 2
136
- Curses.setpos(y,0)
137
- team_stats[:warnings].each {|warning| Curses.addstr(warning)} if team_stats[:warnings]
138
- end
139
- end
140
-
141
- end
142
-
143
- end
@@ -1,39 +0,0 @@
1
- require 'yaml'
2
-
3
- module HackathonDrone
4
-
5
- class Configuration
6
-
7
- CONFIG_FILE = File.expand_path('~/.hackathon_drone')
8
-
9
- attr_reader :project
10
-
11
- # ----- Configuration file management -----
12
- def initialize(project)
13
- @project = project
14
- @config = File.exists?(CONFIG_FILE) ? YAML.load_file(CONFIG_FILE) : {}
15
- @config[@project] ||= {}
16
- end
17
-
18
- def reset
19
- @config.delete(@project)
20
- save
21
- end
22
-
23
- def save
24
- File.open(CONFIG_FILE, 'w+') {|f| f.write(@config.to_yaml) }
25
- end
26
-
27
- def get(key)
28
- @config[@project][key]
29
- end
30
-
31
- def set(key, value)
32
- @config[@project][key] = value
33
- save
34
- value
35
- end
36
-
37
- end
38
-
39
- end
@@ -1,38 +0,0 @@
1
- require 'net/http'
2
- require 'json'
3
-
4
- module HackathonDrone
5
-
6
- module REST
7
-
8
- def self.do_request(host, port, request)
9
- response = Net::HTTP.new(host, port).start {|http| http.request(request)}
10
- if response.is_a?(Net::HTTPSuccess)
11
- response.body ? JSON.parse(response.body) : nil
12
- else
13
- puts "Error: #{response.code} #{response.message}: #{response.body}"
14
- exit
15
- end
16
- end
17
-
18
- def self.post(host, port, path, payload = nil)
19
- request = Net::HTTP::Post.new(path, {"Content-Type" => "application/json"})
20
- request.body = payload.to_json if payload
21
- self.do_request(host, port, request)
22
- end
23
-
24
- def self.get(host, port, path)
25
- request = Net::HTTP::Get.new(path, {"Content-Type" => "application/json"})
26
- self.do_request(host, port, request)
27
- end
28
-
29
- def self.put(host, port, path, payload = nil)
30
- request = Net::HTTP::Put.new(path, {"Content-Type" => "application/json"})
31
- request.body = payload.to_json if payload
32
- self.do_request(host, port, request)
33
- end
34
-
35
-
36
- end
37
-
38
- end
@@ -1,3 +0,0 @@
1
- module HackathonDrone
2
- VERSION = "0.0.3"
3
- end