gondler 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 732200620f2d3372ac24a1a87aeb099a6c106eda
4
- data.tar.gz: a64f5a74fe646f9bf27d60434bb3c04571e1c11e
3
+ metadata.gz: 6f45c6f030b16dcf668b852a6ad8cf38aa3dcd8c
4
+ data.tar.gz: c59c85cf4b94f661080eff0f6f52f92e78424680
5
5
  SHA512:
6
- metadata.gz: 1bbe1102c7ab4d91760943595df4f6194d9b0b734703739ee9e452d3847e663666e5f0aa036fbfab4a9377cfd3b5deab72495096201e0e2de934de44852768bc
7
- data.tar.gz: 502a779d057626aedaee66f683c8431b093ddca12014919415f61498071e76e1e5795ebe8c6930e57f11a2e618b2a0d9633d49ecc9d9f7b5a4441f5d7b1074d8
6
+ metadata.gz: 2fe061e44abb41e2a0b8ba230b0b4a376b4990edf8d10509ecc0ae04b8c8f2c5c0a62b3c72c4f4e04d9c6b65fbdcaa2ae2ba5d1f3e20703a764cfb3effa84222
7
+ data.tar.gz: c22619b469e1528f31fc3edb3d6d12c3c4b9810d6ac1f2e0e3e2547d83d257e74f2e20863563dc0198031d88789a693dd9747eaeb46f64f7a1eb2cc37560a2e1
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Gondler
2
2
 
3
+ [![Build Status](https://travis-ci.org/rosylilly/gondler.png?branch=master)](https://travis-ci.org/rosylilly/gondler)
4
+
3
5
  bundler for golang. inspired by [gom](https://github.com/mattn/gom).
4
6
 
5
7
  ## Installation
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/lib/gondler/cli.rb CHANGED
@@ -11,18 +11,13 @@ module Gondler
11
11
  def initialize(*args)
12
12
  super
13
13
 
14
- @gomfile = Gondler::Gomfile.new(options[:gomfile])
15
-
16
- path = Pathname.new(options[:path])
17
- path = Pathname.pwd + path unless path.absolute?
18
- Gondler.env.path = path
19
- ENV['PATH'] = "#{path + 'bin'}:#{ENV['PATH']}"
14
+ set_environments
20
15
  end
21
16
 
22
17
  desc 'install', 'Install the dependecies specified in your Gomfile'
23
18
  method_option :without, type: :array, default: []
24
19
  def install
25
- @gomfile.packages.each do |package|
20
+ gomfile.packages.each do |package|
26
21
  puts "Install #{package}"
27
22
  package.resolve
28
23
  end
@@ -59,16 +54,14 @@ module Gondler
59
54
  Gondler.withouts = options[:without]
60
55
 
61
56
  puts 'Packages included by the gondler:'
62
- @gomfile.packages.each do |package|
57
+ gomfile.packages.each do |package|
63
58
  puts " * #{package}"
64
59
  end
65
60
  end
66
61
 
67
62
  desc 'repl', 'REPL in the context of Gondler'
68
63
  def repl
69
- while buf = Readline.readline('> ', true)
70
- Kernel.system(buf)
71
- end
64
+ Kernel.system(buf) while buf = Readline.readline('> ', true)
72
65
  end
73
66
 
74
67
  desc 'version', 'Print Gondler version'
@@ -76,10 +69,18 @@ module Gondler
76
69
  puts Gondler::VERSION
77
70
  end
78
71
 
72
+ desc 'env', 'Print Gondler environments'
73
+ def env
74
+ system('go env')
75
+ end
76
+
77
+ private
78
+
79
79
  def method_missing(*args)
80
80
  if executable?(args.first)
81
81
  invoke(:exec, args)
82
82
  elsif executable?("gondler-#{args.first}")
83
+ args[0] = "gondler-#{args.first}"
83
84
  invoke(:exec, args)
84
85
  else
85
86
  STDERR.puts(%Q{Could not find command "#{args.first}"})
@@ -87,10 +88,22 @@ module Gondler
87
88
  end
88
89
  end
89
90
 
90
- private
91
+ def set_environments
92
+ path = Pathname.new(options[:path])
93
+ path = Pathname.pwd + path unless path.absolute?
94
+ Gondler.env.path = path
95
+ ENV['PATH'] = "#{path + 'bin'}:#{ENV['PATH']}"
96
+ end
91
97
 
92
98
  def executable?(name)
93
99
  system("hash #{name} 1> /dev/null 2>&1")
94
100
  end
101
+
102
+ def gomfile
103
+ @gomfile ||= Gondler::Gomfile.new(options[:gomfile])
104
+ rescue Gomfile::NotFound => e
105
+ say(e.message, :red)
106
+ exit(1)
107
+ end
95
108
  end
96
109
  end
@@ -3,6 +3,7 @@ require 'gondler/package'
3
3
  module Gondler
4
4
  class Gomfile
5
5
  def initialize(path)
6
+ raise NotFound, path unless File.exist?(path)
6
7
  @packages = []
7
8
 
8
9
  load(path)
@@ -35,5 +36,15 @@ module Gondler
35
36
  ensure
36
37
  @now_os = nil
37
38
  end
39
+
40
+ class NotFound < StandardError
41
+ def initialize(gomfile)
42
+ @gomfile = gomfile
43
+ end
44
+
45
+ def message
46
+ "Gondler require gomfile. Your gomfile is not found: #{@gomfile}"
47
+ end
48
+ end
38
49
  end
39
50
  end
@@ -1,3 +1,3 @@
1
1
  module Gondler
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -13,6 +13,20 @@ describe Gondler::Gomfile do
13
13
  let(:content) { '' }
14
14
  after { file.close! }
15
15
 
16
+ describe '#initialize' do
17
+ let(:path) { 'Gomfile' }
18
+
19
+ subject(:init) { described_class.new(path) }
20
+
21
+ context 'without Gomfile' do
22
+ let(:path) { '' }
23
+
24
+ it 'raises Gondler::Gomfile::NotFound' do
25
+ expect { init }.to raise_error(Gondler::Gomfile::NotFound)
26
+ end
27
+ end
28
+ end
29
+
16
30
  describe '#gom' do
17
31
  let(:content) do
18
32
  <<-CONTENT
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gondler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sho Kusano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-02 00:00:00.000000000 Z
11
+ date: 2013-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  version: '0'
88
88
  requirements: []
89
89
  rubyforge_project:
90
- rubygems_version: 2.1.5
90
+ rubygems_version: 2.0.2
91
91
  signing_key:
92
92
  specification_version: 4
93
93
  summary: bundler for golang