runcoderun-gem 0.1.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/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Rob Sanheim
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.markdown ADDED
@@ -0,0 +1,36 @@
1
+ _
2
+ _ __ _ _ _ __ ___ ___ __| | ___ _ __ _ _ _ __
3
+ | '__| | | | '_ \ / __/ _ \ / _` |/ _ \ '__| | | | '_ \
4
+ | | | |_| | | | | (_| (_) | (_| | __/ | | |_| | | | |
5
+ |_| \__,_|_| |_|\___\___/ \__,_|\___|_| \__,_|_| |_|
6
+
7
+
8
+
9
+ RunCodeRun Gem
10
+ ==============
11
+
12
+ Hook up [RunCodeRun](http://runcoderun.com) builds from your command line.
13
+
14
+ ## Note on Patches/Pull Requests
15
+
16
+ * Fork the project.
17
+ * Make your feature addition or bug fix.
18
+ * Add tests for it. This is important so I don't break it in a
19
+ future version unintentionally.
20
+ * Commit, do not mess with rakefile, version, or history.
21
+ (if you want to have your own version, that is fine but
22
+ bump version in a commit by itself I can ignore when I pull)
23
+ * Send me a pull request. Bonus points for topic branches.
24
+
25
+ ## Todos
26
+
27
+ lots and lots - patches welcome!
28
+
29
+ * project status
30
+ * build status
31
+ * rebuild
32
+ * grabbing latest build output
33
+
34
+ ## Copyright
35
+
36
+ Copyright (c) 2009 Rob Sanheim. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,53 @@
1
+ require 'rake'
2
+
3
+ begin
4
+ require 'jeweler'
5
+ Jeweler::Tasks.new do |gem|
6
+ gem.name = "runcoderun-gem"
7
+ gem.summary = %Q{runcoderun command line gem}
8
+ gem.description = %Q{runcoderun command line gem}
9
+ gem.email = "rsanheim@gmail.com"
10
+ gem.homepage = "http://github.com/rsanheim/runcoderun-gem"
11
+ gem.authors = ["Rob Sanheim"]
12
+ end
13
+
14
+ rescue LoadError
15
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
16
+ end
17
+
18
+ require 'micronaut/rake_task'
19
+ Micronaut::RakeTask.new(:examples) do |examples|
20
+ examples.pattern = 'examples/**/*_example.rb'
21
+ examples.ruby_opts << '-Ilib -Iexamples'
22
+ end
23
+
24
+ Micronaut::RakeTask.new(:rcov) do |examples|
25
+ examples.pattern = 'examples/**/*_example.rb'
26
+ examples.rcov_opts = '-Ilib -Iexamples'
27
+ examples.rcov = true
28
+ end
29
+
30
+ begin
31
+ require 'cucumber/rake/task'
32
+ Cucumber::Rake::Task.new(:features)
33
+ rescue LoadError
34
+ task :features do
35
+ abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
36
+ end
37
+ end
38
+
39
+ task :default => :examples
40
+
41
+ require 'rake/rdoctask'
42
+ Rake::RDocTask.new do |rdoc|
43
+ if File.exist?('VERSION')
44
+ version = File.read('VERSION')
45
+ else
46
+ version = ""
47
+ end
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "runcoderun-gem #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/bin/rcr ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ lib_dir = File.join(File.dirname(__FILE__), '..', 'lib')
4
+ $LOAD_PATH.unshift lib_dir if File.directory?(lib_dir)
5
+
6
+ require 'runcoderun'
7
+
8
+ RunCodeRun.activate ARGV
data/bin/runcoderun ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ lib_dir = File.join(File.dirname(__FILE__), '..', 'lib')
4
+ $LOAD_PATH.unshift lib_dir if File.directory?(lib_dir)
5
+
6
+ require 'runcoderun'
7
+
8
+ RunCodeRun.activate ARGV
@@ -0,0 +1,18 @@
1
+ require 'micronaut'
2
+ require 'mocha'
3
+
4
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+
7
+ require 'runcoderun'
8
+
9
+ def not_in_editor?
10
+ !(ENV.has_key?('TM_MODE') || ENV.has_key?('EMACS') || ENV.has_key?('VIM'))
11
+ end
12
+
13
+ Micronaut.configure do |c|
14
+ c.color_enabled = not_in_editor?
15
+ c.filter_run :focused => true
16
+ c.mock_with :mocha
17
+ end
18
+
@@ -0,0 +1,51 @@
1
+ require File.join(File.dirname(__FILE__), *%w[example_helper])
2
+
3
+ describe RunCodeRun do
4
+
5
+ describe "activate" do
6
+ it "defaults to help if no command" do
7
+ RunCodeRun::Commands.expects(:help)
8
+ RunCodeRun.activate([])
9
+ end
10
+ end
11
+
12
+ describe "invoke" do
13
+ it "calls public method on in commands module" do
14
+ RunCodeRun::Commands.expects(:open)
15
+ RunCodeRun.invoke("open")
16
+ end
17
+
18
+ it "calls public method commands module with args" do
19
+ RunCodeRun::Commands.expects(:open).with("foo", "baz")
20
+ RunCodeRun.invoke("open", "foo", "baz")
21
+ end
22
+
23
+
24
+ it "fails fast if public method does not exist" do
25
+ RunCodeRun.stubs(:ui).returns(stub_everything)
26
+ lambda {
27
+ RunCodeRun.invoke("good_day_good_sir")
28
+ }.should raise_error(SystemExit) #, /The command 'good_day_good_sir' does not exist/)
29
+ end
30
+ end
31
+
32
+ describe "guess owner" do
33
+ it "should grab owner for private repos" do
34
+ output =<<EOL
35
+ origin git@github.com:relevance/runcoderun.git (fetch)
36
+ origin git@github.com:relevance/runcoderun.git (push)
37
+ EOL
38
+ RunCodeRun.stubs(:run).returns(output)
39
+ RunCodeRun.guess_owner.should == "relevance"
40
+ end
41
+
42
+ it "should grab owner for public repos" do
43
+ output =<<EOL
44
+ origin git://github.com/defunkt/github.git (fetch)
45
+ origin git://github.com/defunkt/github.git (push)
46
+ EOL
47
+ RunCodeRun.stubs(:run).returns(output)
48
+ RunCodeRun.guess_owner.should == "defunkt"
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,9 @@
1
+ Feature: something something
2
+ In order to something something
3
+ A user something something
4
+ something something something
5
+
6
+ Scenario: something something
7
+ Given inspiration
8
+ When I create a sweet new gem
9
+ Then everyone should see how awesome I am
File without changes
@@ -0,0 +1,6 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
2
+ require 'runcoderun'
3
+
4
+ require 'micronaut/expectations'
5
+
6
+ World(Micronaut::Matchers)
@@ -0,0 +1,29 @@
1
+ module RunCodeRun
2
+ module Commands
3
+ extend self
4
+
5
+ def help
6
+ help =<<EOL
7
+ Usage: runcoderun command <options>
8
+
9
+ Available commands:
10
+
11
+ EOL
12
+ help << RunCodeRun.all_commands.map {|c| " #{c}"}.join("\n")
13
+ ui.puts help
14
+ end
15
+
16
+ def open(*args)
17
+ current_dir = Pathname.getwd.basename
18
+ current_owner = RunCodeRun.guess_owner
19
+ url = %[http://runcoderun.com/#{current_owner}/#{current_dir}]
20
+ Launchy.open(url)
21
+ end
22
+
23
+ private
24
+
25
+ def ui
26
+ RunCodeRun.ui
27
+ end
28
+ end
29
+ end
data/lib/runcoderun.rb ADDED
@@ -0,0 +1,49 @@
1
+ require 'pathname'
2
+ lib_dir = Pathname(__FILE__).expand_path.dirname.to_s
3
+ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
4
+
5
+ require 'launchy'
6
+ require 'commands/commands'
7
+
8
+ module RunCodeRun
9
+ extend self
10
+ def activate(args)
11
+ if args.empty? || args.nil?
12
+ invoke("help")
13
+ else
14
+ invoke(args.shift, *args)
15
+ end
16
+ end
17
+
18
+ def all_commands
19
+ Commands.public_instance_methods(true).sort
20
+ end
21
+
22
+ def invoke(command, *args)
23
+ debug "Invoking command: #{command}, args: #{args.inspect}"
24
+ if all_commands.include?(command)
25
+ Commands.send(command, *args)
26
+ else
27
+ ui.puts %[The command '#{command}' does not exist; currently supported commands are '#{all_commands.join(", ")}']
28
+ abort
29
+ end
30
+ end
31
+
32
+ def ui
33
+ $stdout
34
+ end
35
+
36
+ def debug(msg)
37
+ puts(msg) if $DEBUG
38
+ end
39
+
40
+ def guess_owner
41
+ output = run("git remote -v")
42
+ output.match(%r{github.com[:/](\w+)})[1]
43
+ end
44
+
45
+ def run(cmd)
46
+ `#{cmd}`
47
+ end
48
+
49
+ end
@@ -0,0 +1,57 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{runcoderun-gem}
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Rob Sanheim"]
12
+ s.date = %q{2009-09-28}
13
+ s.description = %q{runcoderun command line gem}
14
+ s.email = %q{rsanheim@gmail.com}
15
+ s.executables = ["rcr", "runcoderun"]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE",
18
+ "README.markdown"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ ".gitignore",
23
+ "LICENSE",
24
+ "README.markdown",
25
+ "Rakefile",
26
+ "bin/rcr",
27
+ "bin/runcoderun",
28
+ "examples/example_helper.rb",
29
+ "examples/runcoderun_example.rb",
30
+ "features/runcoderun.feature",
31
+ "features/step_definitions/runcoderun_steps.rb",
32
+ "features/support/env.rb",
33
+ "lib/commands/commands.rb",
34
+ "lib/runcoderun.rb",
35
+ "runcoderun-gem.gemspec",
36
+ "version.yml"
37
+ ]
38
+ s.homepage = %q{http://github.com/rsanheim/runcoderun-gem}
39
+ s.rdoc_options = ["--charset=UTF-8"]
40
+ s.require_paths = ["lib"]
41
+ s.rubygems_version = %q{1.3.5}
42
+ s.summary = %q{runcoderun command line gem}
43
+ s.test_files = [
44
+ "examples/example_helper.rb",
45
+ "examples/runcoderun_example.rb"
46
+ ]
47
+
48
+ if s.respond_to? :specification_version then
49
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
50
+ s.specification_version = 3
51
+
52
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
53
+ else
54
+ end
55
+ else
56
+ end
57
+ end
data/version.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :minor: 1
3
+ :patch: 1
4
+ :major: 0
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: runcoderun-gem
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Rob Sanheim
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-09-28 00:00:00 -04:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: runcoderun command line gem
17
+ email: rsanheim@gmail.com
18
+ executables:
19
+ - rcr
20
+ - runcoderun
21
+ extensions: []
22
+
23
+ extra_rdoc_files:
24
+ - LICENSE
25
+ - README.markdown
26
+ files:
27
+ - .document
28
+ - .gitignore
29
+ - LICENSE
30
+ - README.markdown
31
+ - Rakefile
32
+ - bin/rcr
33
+ - bin/runcoderun
34
+ - examples/example_helper.rb
35
+ - examples/runcoderun_example.rb
36
+ - features/runcoderun.feature
37
+ - features/step_definitions/runcoderun_steps.rb
38
+ - features/support/env.rb
39
+ - lib/commands/commands.rb
40
+ - lib/runcoderun.rb
41
+ - runcoderun-gem.gemspec
42
+ - version.yml
43
+ has_rdoc: true
44
+ homepage: http://github.com/rsanheim/runcoderun-gem
45
+ licenses: []
46
+
47
+ post_install_message:
48
+ rdoc_options:
49
+ - --charset=UTF-8
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ version:
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: "0"
63
+ version:
64
+ requirements: []
65
+
66
+ rubyforge_project:
67
+ rubygems_version: 1.3.5
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: runcoderun command line gem
71
+ test_files:
72
+ - examples/example_helper.rb
73
+ - examples/runcoderun_example.rb