tissues 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +21 -0
- data/README.markdown +10 -0
- data/Rakefile +160 -0
- data/bin/tissues +48 -0
- data/bin/tissues-post-merge +86 -0
- data/lib/tissues.rb +3 -0
- data/tissues.gemspec +70 -0
- metadata +96 -0
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) Zach Holman
|
2
|
+
- rakegem gem tasks by Tom Preston-Werner under similar license
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
#############################################################################
|
6
|
+
#
|
7
|
+
# Helper functions
|
8
|
+
#
|
9
|
+
#############################################################################
|
10
|
+
|
11
|
+
def name
|
12
|
+
@name ||= Dir['*.gemspec'].first.split('.').first
|
13
|
+
end
|
14
|
+
|
15
|
+
def version
|
16
|
+
line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
|
17
|
+
line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
|
18
|
+
end
|
19
|
+
|
20
|
+
def date
|
21
|
+
Date.today.to_s
|
22
|
+
end
|
23
|
+
|
24
|
+
def rubyforge_project
|
25
|
+
name
|
26
|
+
end
|
27
|
+
|
28
|
+
def gemspec_file
|
29
|
+
"#{name}.gemspec"
|
30
|
+
end
|
31
|
+
|
32
|
+
def gem_file
|
33
|
+
"#{name}-#{version}.gem"
|
34
|
+
end
|
35
|
+
|
36
|
+
def replace_header(head, header_name)
|
37
|
+
head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
|
38
|
+
end
|
39
|
+
|
40
|
+
#############################################################################
|
41
|
+
#
|
42
|
+
# Standard tasks
|
43
|
+
#
|
44
|
+
#############################################################################
|
45
|
+
|
46
|
+
# task :default => :test
|
47
|
+
#
|
48
|
+
# require 'rake/testtask'
|
49
|
+
# Rake::TestTask.new(:test) do |test|
|
50
|
+
# test.libs << 'lib' << 'test'
|
51
|
+
# test.pattern = 'test/**/test_*.rb'
|
52
|
+
# test.verbose = true
|
53
|
+
# end
|
54
|
+
|
55
|
+
# desc "Generate RCov test coverage and open in your browser"
|
56
|
+
# task :coverage do
|
57
|
+
# require 'rcov'
|
58
|
+
# sh "rm -fr coverage"
|
59
|
+
# sh "rcov test/test_*.rb"
|
60
|
+
# sh "open coverage/index.html"
|
61
|
+
# end
|
62
|
+
|
63
|
+
# require 'rake/rdoctask'
|
64
|
+
# Rake::RDocTask.new do |rdoc|
|
65
|
+
# rdoc.rdoc_dir = 'rdoc'
|
66
|
+
# rdoc.title = "#{name} #{version}"
|
67
|
+
# rdoc.rdoc_files.include('README*')
|
68
|
+
# rdoc.rdoc_files.include('lib/**/*.rb')
|
69
|
+
# end
|
70
|
+
|
71
|
+
desc "Open an irb session preloaded with this library"
|
72
|
+
task :console do
|
73
|
+
sh "irb -rubygems -r ./lib/#{name}.rb"
|
74
|
+
end
|
75
|
+
|
76
|
+
#############################################################################
|
77
|
+
#
|
78
|
+
# Custom tasks (add your own tasks here)
|
79
|
+
#
|
80
|
+
#############################################################################
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
#############################################################################
|
85
|
+
#
|
86
|
+
# Packaging tasks
|
87
|
+
#
|
88
|
+
#############################################################################
|
89
|
+
|
90
|
+
desc "release #{name} version #{version} (after updating and building)"
|
91
|
+
task :release => 'release:default'
|
92
|
+
namespace :release do
|
93
|
+
task :default => :build do
|
94
|
+
unless `git branch` =~ /^\* master$/
|
95
|
+
puts "You must be on the master branch to release!"
|
96
|
+
exit!
|
97
|
+
end
|
98
|
+
sh "git commit --allow-empty -a -m 'Release #{version}'"
|
99
|
+
# sh "git tag v#{version}"
|
100
|
+
sh "git push origin master"
|
101
|
+
sh "git push origin v#{version}"
|
102
|
+
sh "gem push pkg/#{name}-#{version}.gem"
|
103
|
+
end
|
104
|
+
|
105
|
+
desc "build #{name} version #{version} (after updating)"
|
106
|
+
task :build => :gemspec do
|
107
|
+
sh "mkdir -p pkg"
|
108
|
+
sh "gem build #{gemspec_file}"
|
109
|
+
sh "mv #{gem_file} pkg"
|
110
|
+
end
|
111
|
+
|
112
|
+
desc "build and install #{name} version #{version} locally"
|
113
|
+
task :install => :build do
|
114
|
+
sh "gem install pkg/#{gem_file}"
|
115
|
+
end
|
116
|
+
|
117
|
+
desc "update #{name}.gemspec"
|
118
|
+
task :gemspec => 'release:gemspec:generate'
|
119
|
+
namespace :gemspec do
|
120
|
+
task :generate => :validate do
|
121
|
+
# read spec file and split out manifest section
|
122
|
+
spec = File.read(gemspec_file)
|
123
|
+
head, manifest, tail = spec.split(" # = MANIFEST =\n")
|
124
|
+
|
125
|
+
# replace name version and date
|
126
|
+
replace_header(head, :name)
|
127
|
+
replace_header(head, :version)
|
128
|
+
replace_header(head, :date)
|
129
|
+
#comment this out if your rubyforge_project has a different name
|
130
|
+
replace_header(head, :rubyforge_project)
|
131
|
+
|
132
|
+
# determine file list from git ls-files
|
133
|
+
files = `git ls-files`.
|
134
|
+
split("\n").
|
135
|
+
sort.
|
136
|
+
reject { |file| file =~ /^\./ }.
|
137
|
+
reject { |file| file =~ /^(rdoc|pkg)/ }.
|
138
|
+
map { |file| " #{file}" }.
|
139
|
+
join("\n")
|
140
|
+
|
141
|
+
# piece file back together and write
|
142
|
+
manifest = " s.files = %w[\n#{files}\n ]\n"
|
143
|
+
spec = [head, manifest, tail].join(" # = MANIFEST =\n")
|
144
|
+
File.open(gemspec_file, 'w') { |io| io.write(spec) }
|
145
|
+
puts "Updated #{gemspec_file}"
|
146
|
+
end
|
147
|
+
|
148
|
+
task :validate do
|
149
|
+
libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}"]
|
150
|
+
unless libfiles.empty?
|
151
|
+
puts "Directory `lib` should only contain a `#{name}.rb` file and `#{name}` dir."
|
152
|
+
exit!
|
153
|
+
end
|
154
|
+
unless Dir['VERSION*'].empty?
|
155
|
+
puts "A `VERSION` file at root level violates Gem best practices."
|
156
|
+
exit!
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
data/bin/tissues
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'ftools'
|
3
|
+
|
4
|
+
def instructional_text
|
5
|
+
puts "Run `tissues install` to add Things + Issues integration to your project"
|
6
|
+
exit 1
|
7
|
+
end
|
8
|
+
|
9
|
+
def hook_file
|
10
|
+
File.join('.git','hooks','post-merge')
|
11
|
+
end
|
12
|
+
|
13
|
+
def check_existing_hook
|
14
|
+
if File.exist?(hook_file)
|
15
|
+
puts "You already have a post-merge hook. I ain't touchin' that. So instead, try running"+
|
16
|
+
"`tissues view_hook` to view the entire hook and manually install it yourself."
|
17
|
+
exit 1
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def install_hook
|
22
|
+
hook = File.join(File.dirname(__FILE__),'tissues-post-merge')
|
23
|
+
File.copy(hook,hook_file,true)
|
24
|
+
File.chmod 0755, hook_file
|
25
|
+
end
|
26
|
+
|
27
|
+
def run_hook
|
28
|
+
system File.join(File.dirname(__FILE__),'tissues-post-merge')
|
29
|
+
end
|
30
|
+
|
31
|
+
def change_origin(new_origin)
|
32
|
+
origin = File.new(File.join('.git','hooks','tissues_origin'), "w+")
|
33
|
+
origin.puts(new_origin)
|
34
|
+
end
|
35
|
+
|
36
|
+
case ARGV[0]
|
37
|
+
when 'install'
|
38
|
+
check_existing_hook
|
39
|
+
install_hook
|
40
|
+
when 'update'
|
41
|
+
install_hook
|
42
|
+
when 'origin'
|
43
|
+
change_origin(ARGV[1])
|
44
|
+
when 'help'
|
45
|
+
instructional_text
|
46
|
+
else
|
47
|
+
run_hook
|
48
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'things'
|
5
|
+
require 'octopi'
|
6
|
+
include Octopi
|
7
|
+
|
8
|
+
class String
|
9
|
+
def to_state
|
10
|
+
to_s == 'open' ? :open : :closed
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_status
|
14
|
+
to_s == 'open' ? :open : :completed
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class Things::Todo
|
19
|
+
def number
|
20
|
+
name.scan(/\[\#([0-9]+)\]/).first
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def origin_path
|
25
|
+
origin = File.join('.git','hooks','tissues_origin')
|
26
|
+
if File.exist?(origin)
|
27
|
+
File.open(origin).readline
|
28
|
+
else
|
29
|
+
`git remote -v | grep fetch`.split(':').last.split('.git ').first
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def name_with_id(issue)
|
34
|
+
"[##{issue.number}] #{issue.title}"
|
35
|
+
end
|
36
|
+
|
37
|
+
authenticated do
|
38
|
+
@origin_path = origin_path
|
39
|
+
area = Things::Area.find(@origin_path)
|
40
|
+
area ||= Things::Area.create(:name => @origin_path)
|
41
|
+
local_todos = area.todos
|
42
|
+
sync_back_to_github = []
|
43
|
+
|
44
|
+
repository = Repository.find(:name => @origin_path.split('/').last,
|
45
|
+
:user => @origin_path.split('/').first)
|
46
|
+
repository.all_issues.each do |issue|
|
47
|
+
if todo = Things::Todo.find(name_with_id(issue))
|
48
|
+
todo.area = area
|
49
|
+
unless todo.completed?
|
50
|
+
todo.status = issue.state.to_status
|
51
|
+
else
|
52
|
+
sync_back_to_github << todo
|
53
|
+
end
|
54
|
+
todo.notes = issue.body
|
55
|
+
todo.save
|
56
|
+
todo.reference.area.set(area.reference)
|
57
|
+
else
|
58
|
+
todo = Things::Todo.create(
|
59
|
+
:name => name_with_id(issue),
|
60
|
+
:status => issue.state.to_status,
|
61
|
+
:notes => issue.body,
|
62
|
+
:area => area
|
63
|
+
)
|
64
|
+
end
|
65
|
+
local_todos.reject!{|todo| todo.name == name_with_id(issue)}
|
66
|
+
end
|
67
|
+
|
68
|
+
local_todos.each do |todo|
|
69
|
+
issue = Issue.open(
|
70
|
+
:params => {
|
71
|
+
:title => todo.name,
|
72
|
+
:state => todo.status.to_s.to_state,
|
73
|
+
:body => todo.notes
|
74
|
+
},
|
75
|
+
:repository => repository
|
76
|
+
)
|
77
|
+
todo.name = name_with_id(issue)
|
78
|
+
todo.save
|
79
|
+
todo.reference.area.set(area.reference) # resave area association
|
80
|
+
end
|
81
|
+
|
82
|
+
sync_back_to_github.each do |todo|
|
83
|
+
issue = Issue.find(:repository => repository, :number => todo.number)
|
84
|
+
(todo.status == 'open') ? issue.reopen! : issue.close!
|
85
|
+
end
|
86
|
+
end
|
data/lib/tissues.rb
ADDED
data/tissues.gemspec
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.specification_version = 2 if s.respond_to? :specification_version=
|
3
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
4
|
+
s.rubygems_version = '1.3.5'
|
5
|
+
|
6
|
+
## Leave these as is they will be modified for you by the rake gemspec task.
|
7
|
+
## If your rubyforge_project name is different, then edit it and comment out
|
8
|
+
## the sub! line in the Rakefile
|
9
|
+
s.name = 'tissues'
|
10
|
+
s.version = '0.0.1'
|
11
|
+
s.date = '2010-04-21'
|
12
|
+
s.rubyforge_project = 'tissues'
|
13
|
+
|
14
|
+
## Make sure your summary is short. The description may be as long
|
15
|
+
## as you like.
|
16
|
+
s.summary = "things.app + github issues"
|
17
|
+
s.description = "Tissues hooks up the GitHub Issues for your project to Things.app."
|
18
|
+
|
19
|
+
## List the primary authors. If there are a bunch of authors, it's probably
|
20
|
+
## better to set the email to an email list or something. If you don't have
|
21
|
+
## a custom homepage, consider using your GitHub URL or the like.
|
22
|
+
s.authors = ["Zach Holman"]
|
23
|
+
s.email = '@zachholman.com'
|
24
|
+
s.homepage = 'http://github.com/holman/tissues'
|
25
|
+
|
26
|
+
## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
|
27
|
+
## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
|
28
|
+
s.require_paths = %w[lib]
|
29
|
+
|
30
|
+
## This sections is only necessary if you have C extensions.
|
31
|
+
# s.require_paths << 'ext'
|
32
|
+
# s.extensions = %w[ext/extconf.rb]
|
33
|
+
|
34
|
+
## If your gem includes any executables, list them here.
|
35
|
+
s.executables = ["tissues", "tissues-post-merge"]
|
36
|
+
s.default_executable = 'tissues'
|
37
|
+
|
38
|
+
## Specify any RDoc options here. You'll want to add your README and
|
39
|
+
## LICENSE files to the extra_rdoc_files list.
|
40
|
+
# s.rdoc_options = ["--charset=UTF-8"]
|
41
|
+
# s.extra_rdoc_files = %w[README.markdown LICENSE]
|
42
|
+
|
43
|
+
## List your runtime dependencies here. Runtime dependencies are those
|
44
|
+
## that are needed for an end user to actually USE your code.
|
45
|
+
s.add_dependency('things-client', [">= 0.2.2"])
|
46
|
+
s.add_dependency('octopi', [">= 0.2.8"])
|
47
|
+
|
48
|
+
## List your development dependencies here. Development dependencies are
|
49
|
+
## those that are only needed during development
|
50
|
+
# s.add_development_dependency('DEVDEPNAME', [">= 1.1.0", "< 2.0.0"])
|
51
|
+
|
52
|
+
## Leave this section as-is. It will be automatically generated from the
|
53
|
+
## contents of your Git repository via the gemspec task. DO NOT REMOVE
|
54
|
+
## THE MANIFEST COMMENTS, they are used as delimiters by the task.
|
55
|
+
# = MANIFEST =
|
56
|
+
s.files = %w[
|
57
|
+
LICENSE
|
58
|
+
README.markdown
|
59
|
+
Rakefile
|
60
|
+
bin/tissues
|
61
|
+
bin/tissues-post-merge
|
62
|
+
lib/tissues.rb
|
63
|
+
tissues.gemspec
|
64
|
+
]
|
65
|
+
# = MANIFEST =
|
66
|
+
|
67
|
+
## Test files will be grabbed from the file list. Make sure the path glob
|
68
|
+
## matches what you actually use.
|
69
|
+
# s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
|
70
|
+
end
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tissues
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Zach Holman
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-04-21 00:00:00 -07:00
|
18
|
+
default_executable: tissues
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: things-client
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 2
|
30
|
+
- 2
|
31
|
+
version: 0.2.2
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: octopi
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
43
|
+
- 2
|
44
|
+
- 8
|
45
|
+
version: 0.2.8
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
48
|
+
description: Tissues hooks up the GitHub Issues for your project to Things.app.
|
49
|
+
email: "@zachholman.com"
|
50
|
+
executables:
|
51
|
+
- tissues
|
52
|
+
- tissues-post-merge
|
53
|
+
extensions: []
|
54
|
+
|
55
|
+
extra_rdoc_files: []
|
56
|
+
|
57
|
+
files:
|
58
|
+
- LICENSE
|
59
|
+
- README.markdown
|
60
|
+
- Rakefile
|
61
|
+
- bin/tissues
|
62
|
+
- bin/tissues-post-merge
|
63
|
+
- lib/tissues.rb
|
64
|
+
- tissues.gemspec
|
65
|
+
has_rdoc: true
|
66
|
+
homepage: http://github.com/holman/tissues
|
67
|
+
licenses: []
|
68
|
+
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
segments:
|
79
|
+
- 0
|
80
|
+
version: "0"
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
version: "0"
|
88
|
+
requirements: []
|
89
|
+
|
90
|
+
rubyforge_project: tissues
|
91
|
+
rubygems_version: 1.3.6
|
92
|
+
signing_key:
|
93
|
+
specification_version: 2
|
94
|
+
summary: things.app + github issues
|
95
|
+
test_files: []
|
96
|
+
|