grem 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,4 @@
1
+ === 0.0.1 2010-04-08
2
+
3
+ * 1 major enhancement:
4
+ * Initial release
data/Manifest.txt ADDED
@@ -0,0 +1,14 @@
1
+ History.txt
2
+ Manifest.txt
3
+ PostInstall.txt
4
+ bin/grem
5
+ lib/grem/cli.rb
6
+ lib/grem.rb
7
+ Rakefile
8
+ README.rdoc
9
+ script/console
10
+ script/destroy
11
+ script/generate
12
+ test/test_grem.rb
13
+ test/test_grem_cli.rb
14
+ test/test_helper.rb
data/PostInstall.txt ADDED
@@ -0,0 +1,7 @@
1
+
2
+ For more information on grem, see http://grem.rubyforge.org
3
+
4
+ NOTE: Change this information in PostInstall.txt
5
+ You can also delete it if you don't want it.
6
+
7
+
data/README.rdoc ADDED
@@ -0,0 +1,43 @@
1
+ = grem
2
+
3
+ * http://github.com/benatkin/grem
4
+
5
+ == DESCRIPTION:
6
+
7
+ The (GitHub) REpo Manager grabs repos and stores them according to
8
+ my conventions.
9
+
10
+ == SYNOPSIS:
11
+
12
+ grem benatkin grem
13
+
14
+ clones this repo into ~/github/benatkin/grem
15
+
16
+ == INSTALL:
17
+
18
+ * Once this is on Gemcutter, sudo gem install grem
19
+
20
+ == LICENSE:
21
+
22
+ (The MIT License)
23
+
24
+ Copyright (c) 2010 FIXME full name
25
+
26
+ Permission is hereby granted, free of charge, to any person obtaining
27
+ a copy of this software and associated documentation files (the
28
+ 'Software'), to deal in the Software without restriction, including
29
+ without limitation the rights to use, copy, modify, merge, publish,
30
+ distribute, sublicense, and/or sell copies of the Software, and to
31
+ permit persons to whom the Software is furnished to do so, subject to
32
+ the following conditions:
33
+
34
+ The above copyright notice and this permission notice shall be
35
+ included in all copies or substantial portions of the Software.
36
+
37
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
38
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
39
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
40
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
41
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
42
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
43
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,25 @@
1
+ require 'rubygems'
2
+ gem 'hoe', '>= 2.1.0'
3
+ require 'hoe'
4
+ require 'fileutils'
5
+ require './lib/grem'
6
+
7
+ Hoe.plugin :newgem
8
+ # Hoe.plugin :website
9
+ # Hoe.plugin :cucumberfeatures
10
+
11
+ # Generate all the Rake tasks
12
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
13
+ $hoe = Hoe.spec 'grem' do
14
+ self.developer 'Ben Atkin', 'ben@benatkin.com'
15
+ self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
16
+ self.rubyforge_name = self.name # TODO this is default value
17
+ # self.extra_deps = [['activesupport','>= 2.0.2']]
18
+ end
19
+
20
+ require 'newgem/tasks'
21
+ Dir['tasks/**/*.rake'].each { |t| load t }
22
+
23
+ # TODO - want other tests/tasks run by default? Add them to the list
24
+ # remove_task :default
25
+ # task :default => [:spec, :features]
data/bin/grem ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Created on 2010-4-8.
4
+ # Copyright (c) 2010. All rights reserved.
5
+
6
+ require 'rubygems'
7
+ require File.expand_path(File.dirname(__FILE__) + "/../lib/grem")
8
+ require "grem/cli"
9
+
10
+ Grem::CLI.execute(STDOUT, ARGV)
data/lib/grem/cli.rb ADDED
@@ -0,0 +1,51 @@
1
+ require 'optparse'
2
+
3
+ module Grem
4
+ class CLI
5
+ def self.execute(stdout, arguments=[])
6
+
7
+ options = {
8
+ }
9
+ mandatory_options = %w()
10
+
11
+ parser = OptionParser.new do |opts|
12
+ opts.banner = <<-BANNER.gsub(/^ /,'')
13
+ The (GitHub) REpo Manager (grem) clones a github repo into ~/github/username/reponame.
14
+
15
+ Usage: #{File.basename($0)} github_username repo_name
16
+
17
+ Options are:
18
+ BANNER
19
+ opts.separator ""
20
+ opts.on("-h", "--help",
21
+ "Show this help message.") { stdout.puts opts; exit }
22
+ opts.parse!(arguments)
23
+
24
+ if mandatory_options && mandatory_options.find { |option| options[option.to_sym].nil? }
25
+ stdout.puts opts; exit
26
+ end
27
+
28
+ if arguments.length != 2
29
+ stdout.puts opts; exit
30
+ end
31
+ end
32
+
33
+ username = arguments[0]
34
+ reponame = arguments[1]
35
+
36
+ #FileUtils.mkdir_p
37
+ user_path = File.join(File.expand_path('~/github'), username)
38
+ repo_path = File.join(user_path, reponame)
39
+ if File.exist?(repo_path)
40
+ stdout.puts "A file already exists at #{repo_path}. Exiting."; exit
41
+ end
42
+
43
+ remote_path = "git://github.com/#{username}/#{reponame}.git"
44
+
45
+ FileUtils.mkdir_p(user_path)
46
+ FileUtils.chdir(user_path) do
47
+ system('git', 'clone', remote_path)
48
+ end
49
+ end
50
+ end
51
+ end
data/lib/grem.rb ADDED
@@ -0,0 +1,6 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ module Grem
5
+ VERSION = '0.0.1'
6
+ end
data/script/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/grem.rb'}"
9
+ puts "Loading grem gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
data/script/destroy ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
data/test/test_grem.rb ADDED
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestGrem < Test::Unit::TestCase
4
+
5
+ def setup
6
+ end
7
+
8
+ def test_truth
9
+ assert true
10
+ end
11
+ end
@@ -0,0 +1,18 @@
1
+ require File.join(File.dirname(__FILE__), "test_helper.rb")
2
+ require 'grem/cli'
3
+
4
+ class TestGremCli < Test::Unit::TestCase
5
+ def setup
6
+ @example_path = File.join(File.expand_path('~/github'), 'benatkin', 'example')
7
+ exit unless @example_path.include?('example') # sanity check
8
+ FileUtils.rm_rf(@example_path)
9
+ Grem::CLI.execute(@stdout_io = StringIO.new, ['benatkin', 'example'])
10
+ @stdout_io.rewind
11
+ @stdout = @stdout_io.read
12
+ end
13
+
14
+ def test_repo_cloned
15
+ readme_path = File.join(@example_path, 'README')
16
+ assert_match(/You have reached this example repo/, File.read(readme_path))
17
+ end
18
+ end
@@ -0,0 +1,3 @@
1
+ require 'stringio'
2
+ require 'test/unit'
3
+ require File.dirname(__FILE__) + '/../lib/grem'
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: grem
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ben Atkin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-04-08 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rubyforge
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.0.3
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: gemcutter
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.0
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: hoe
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 2.5.0
44
+ version:
45
+ description: |-
46
+ The (GitHub) REpo Manager grabs repos and stores them according to
47
+ my conventions.
48
+ email:
49
+ - ben@benatkin.com
50
+ executables:
51
+ - grem
52
+ extensions: []
53
+
54
+ extra_rdoc_files:
55
+ - History.txt
56
+ - Manifest.txt
57
+ - PostInstall.txt
58
+ files:
59
+ - History.txt
60
+ - Manifest.txt
61
+ - PostInstall.txt
62
+ - bin/grem
63
+ - lib/grem/cli.rb
64
+ - lib/grem.rb
65
+ - Rakefile
66
+ - README.rdoc
67
+ - script/console
68
+ - script/destroy
69
+ - script/generate
70
+ - test/test_grem.rb
71
+ - test/test_grem_cli.rb
72
+ - test/test_helper.rb
73
+ has_rdoc: true
74
+ homepage: http://github.com/benatkin/grem
75
+ licenses: []
76
+
77
+ post_install_message: PostInstall.txt
78
+ rdoc_options:
79
+ - --main
80
+ - README.rdoc
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: "0"
88
+ version:
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: "0"
94
+ version:
95
+ requirements: []
96
+
97
+ rubyforge_project: grem
98
+ rubygems_version: 1.3.5
99
+ signing_key:
100
+ specification_version: 3
101
+ summary: The (GitHub) REpo Manager grabs repos and stores them according to my conventions.
102
+ test_files:
103
+ - test/test_grem.rb
104
+ - test/test_grem_cli.rb
105
+ - test/test_helper.rb