runcoderun 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
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,43 @@
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
+ Right now we just support open:
15
+
16
+ $ git clone it://github.com/floehopper/mocha.git
17
+ $ cd mocha
18
+ $ rcr open # opens http://runcoderun.com/floehopper/mocha in your default browser
19
+ $ runcoderun open # if you like to type more
20
+
21
+ ## Note on Patches/Pull Requests
22
+
23
+ * Fork the project.
24
+ * Make your feature addition or bug fix.
25
+ * Add tests for it. This is important so I don't break it in a
26
+ future version unintentionally.
27
+ * Commit, do not mess with rakefile, version, or history.
28
+ (if you want to have your own version, that is fine but
29
+ bump version in a commit by itself I can ignore when I pull)
30
+ * Send me a pull request. Bonus points for topic branches.
31
+
32
+ ## Todos
33
+
34
+ lots and lots - patches welcome!
35
+
36
+ * project status
37
+ * build status
38
+ * rebuild
39
+ * grabbing latest build output
40
+
41
+ ## Copyright
42
+
43
+ Copyright (c) 2009 Rob Sanheim. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,58 @@
1
+ require 'rake'
2
+
3
+ begin
4
+ require 'jeweler'
5
+ Jeweler::Tasks.new do |gem|
6
+ gem.name = "runcoderun"
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
+ gem.rubyforge_project = 'thinkrelevance'
13
+ end
14
+ Jeweler::RubyforgeTasks.new do |rubyforge|
15
+ rubyforge.doc_task = "rdoc"
16
+ end
17
+ rescue LoadError
18
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
19
+ end
20
+
21
+ require 'micronaut/rake_task'
22
+ Micronaut::RakeTask.new(:examples) do |examples|
23
+ examples.pattern = 'examples/**/*_example.rb'
24
+ examples.ruby_opts << '-Ilib -Iexamples'
25
+ end
26
+
27
+ Micronaut::RakeTask.new(:rcov) do |examples|
28
+ examples.pattern = 'examples/**/*_example.rb'
29
+ examples.rcov_opts = '-Ilib -Iexamples'
30
+ examples.rcov = true
31
+ end
32
+
33
+ begin
34
+ require 'cucumber/rake/task'
35
+ Cucumber::Rake::Task.new(:features)
36
+ rescue LoadError
37
+ task :features do
38
+ abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
39
+ end
40
+ end
41
+
42
+ task :default => :examples
43
+
44
+ task :release => ["examples", "rubyforge:release"]
45
+
46
+ require 'rake/rdoctask'
47
+ Rake::RDocTask.new do |rdoc|
48
+ if File.exist?('VERSION')
49
+ version = File.read('VERSION')
50
+ else
51
+ version = ""
52
+ end
53
+
54
+ rdoc.rdoc_dir = 'rdoc'
55
+ rdoc.title = "runcoderun-gem #{version}"
56
+ rdoc.rdoc_files.include('README*')
57
+ rdoc.rdoc_files.include('lib/**/*.rb')
58
+ 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,50 @@
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.map {|m| m.intern }
20
+ end
21
+
22
+ def invoke(command, *args)
23
+ command = command.intern
24
+ debug "Invoking command: #{command}, args: #{args.inspect}"
25
+ if all_commands.include?(command)
26
+ Commands.send(command, *args)
27
+ else
28
+ ui.puts %[The command '#{command}' does not exist; currently supported commands are '#{all_commands.join(", ")}']
29
+ abort
30
+ end
31
+ end
32
+
33
+ def ui
34
+ $stdout
35
+ end
36
+
37
+ def debug(msg)
38
+ puts(msg) if $DEBUG
39
+ end
40
+
41
+ def guess_owner
42
+ output = run("git remote -v")
43
+ output.match(%r{github.com[:/](\w+)})[1]
44
+ end
45
+
46
+ def run(cmd)
47
+ `#{cmd}`
48
+ end
49
+
50
+ end
@@ -0,0 +1,58 @@
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}
8
+ s.version = "0.2.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-29}
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.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.rubyforge_project = %q{thinkrelevance}
42
+ s.rubygems_version = %q{1.3.5}
43
+ s.summary = %q{runcoderun command line gem}
44
+ s.test_files = [
45
+ "examples/example_helper.rb",
46
+ "examples/runcoderun_example.rb"
47
+ ]
48
+
49
+ if s.respond_to? :specification_version then
50
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
51
+ s.specification_version = 3
52
+
53
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
54
+ else
55
+ end
56
+ else
57
+ end
58
+ end
data/version.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :major: 0
3
+ :minor: 2
4
+ :patch: 1
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: runcoderun
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
+ platform: ruby
6
+ authors:
7
+ - Rob Sanheim
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-09-29 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.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: thinkrelevance
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