hw 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/bin/hw CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  $:.unshift(File.expand_path('../../lib', __FILE__))
4
4
 
5
- require 'hw/runner'
5
+ require 'hw/base'
6
6
  HW::Runner.start
@@ -1,4 +1,4 @@
1
- class HW
1
+ module HW
2
2
  module Actions
3
3
  extend Thor::Actions
4
4
 
@@ -3,7 +3,8 @@ require 'thor'
3
3
  require 'thor/group'
4
4
  require 'hw/core_ext/string'
5
5
 
6
- class HW < Thor
6
+ module HW
7
+ autoload :Runner, 'hw/runner'
7
8
  autoload :Actions, 'hw/actions'
8
9
  autoload :Sources, 'hw/sources'
9
10
  autoload :Packages, 'hw/packages'
@@ -1,4 +1,4 @@
1
- class HW
1
+ module HW
2
2
  class Packages
3
3
  extend Thor::Actions
4
4
  extend Thor::Shell
@@ -1,53 +1,55 @@
1
- require 'hw/base'
1
+ #require 'hw/base'
2
2
 
3
- class HW::Runner < HW
4
- include Base
3
+ module HW
4
+ class Runner < Thor
5
+ include Base
5
6
 
6
- def self.start(given_args = ARGV, config = {})
7
- unless self.is_a_reserved_task?(given_args)
8
- name = ARGV.first
7
+ def self.start(given_args = ARGV, config = {})
8
+ unless self.is_a_reserved_task?(given_args)
9
+ name = ARGV.first
9
10
 
10
- if Packages.reserved?(name)
11
- Packages.register(name, "hw/packages/#{name}")
12
- else
13
- Packages.add(name)
11
+ if Packages.reserved?(name)
12
+ Packages.register(name, "hw/packages/#{name}")
13
+ else
14
+ Packages.add(name)
15
+ end
14
16
  end
17
+
18
+ super(given_args, config)
15
19
  end
16
20
 
17
- super(given_args, config)
18
- end
21
+ desc "list", "list available packages"
22
+ def list
23
+ Packages.formatted_list
24
+ end
19
25
 
20
- desc "list", "list available packages"
21
- def list
22
- Packages.formatted_list
23
- end
26
+ desc "add_source <name> <source>", "Add a source to ~/.hw/config"
27
+ def add_source name, source
28
+ Sources.add(name, source)
29
+ end
24
30
 
25
- desc "add_source <name> <source>", "Add a source to ~/.hw/config"
26
- def add_source name, source
27
- Sources.add(name, source)
28
- end
31
+ desc "update", "Update installed packages"
32
+ method_option :pull, :aliases => "-p", :type => :boolean, :default => "true", :desc => "Pull from remote sources"
33
+ def update
34
+ header "Updating hw"
35
+ Sources.ensure_defaults
29
36
 
30
- desc "update", "Update installed packages"
31
- method_option :pull, :aliases => "-p", :type => :boolean, :default => "true", :desc => "Pull from remote sources"
32
- def update
33
- header "Updating hw"
34
- Sources.ensure_defaults
35
-
36
- if options["pull"]
37
- Sources.fetch
38
- else
39
- warn "Sources not updated"
40
- info "Remove `-p false` to update your sources"
37
+ if options["pull"]
38
+ Sources.fetch
39
+ else
40
+ warn "Sources not updated"
41
+ info "Remove `-p false` to update your sources"
42
+ end
41
43
  end
42
- end
43
-
44
- desc "install", "Update installed packages"
45
- method_option :pull, :aliases => "-p", :type => :boolean, :default => "true", :desc => "Pull from remote sources"
46
- alias :install :update
47
-
48
- no_tasks do
49
- def self.is_a_reserved_task? args
50
- ARGV.empty? or reserved?(args) or self.instance_methods(false).include?(args.first.to_sym)
44
+
45
+ desc "install", "Update installed packages"
46
+ method_option :pull, :aliases => "-p", :type => :boolean, :default => "true", :desc => "Pull from remote sources"
47
+ alias :install :update
48
+
49
+ no_tasks do
50
+ def self.is_a_reserved_task? args
51
+ ARGV.empty? or reserved?(args) or self.instance_methods(false).include?(args.first.to_sym)
52
+ end
51
53
  end
52
54
  end
53
55
  end
@@ -1,4 +1,4 @@
1
- class HW
1
+ module HW
2
2
  class Sources < Thor
3
3
  extend Thor::Actions
4
4
  extend Thor::Shell
@@ -1,6 +1,6 @@
1
- class HW
1
+ module HW
2
2
  MAJOR = 1
3
- MINOR = 2
3
+ MINOR = 3
4
4
  TINY = 0
5
5
  PRE = nil
6
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hw
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-06 00:00:00.000000000 Z
12
+ date: 2013-06-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -115,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
115
  version: '0'
116
116
  segments:
117
117
  - 0
118
- hash: 2133742286641577851
118
+ hash: -1471843386893629720
119
119
  required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  none: false
121
121
  requirements:
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  version: '0'
125
125
  segments:
126
126
  - 0
127
- hash: 2133742286641577851
127
+ hash: -1471843386893629720
128
128
  requirements: []
129
129
  rubyforge_project:
130
130
  rubygems_version: 1.8.25