hw 1.1.7 → 1.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/lib/hw.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'git'
2
2
  require 'thor'
3
3
  require 'thor/group'
4
- #require 'active_support/all'
4
+ require 'rails'
5
5
  require 'rails/generators/base'
6
6
 
7
7
  module HW
@@ -18,12 +18,33 @@ module HW::Actions
18
18
  run "bundle install --quiet"
19
19
  end
20
20
 
21
- def migrate env = :development
21
+ def migrate(options={})
22
22
  header "Migrating the database"
23
- rake "db:migrate", :env => env
23
+ env = options[:env] || 'development'
24
+ rake("db:migrate", env: env, silence: true)
24
25
  end
25
26
 
26
27
  def worker filename, data=nil, &block
27
- create_file("app/workers/#{filename}", data, :verbose => false, &block)
28
+ create_file("app/workers/#{filename}", data, verbose: false, &block)
29
+ end
30
+
31
+ def rake(command, options={})
32
+ env = options[:env] || 'development'
33
+ capture = options[:silence] || false
34
+ sudo = options[:sudo] ? 'sudo ' : ''
35
+
36
+ #run rake db:create from "./testing"
37
+ #success
38
+ run("#{sudo}rake #{command} RAILS_ENV=#{env}", verbose: false, capture: capture)
39
+ end
40
+
41
+ def git(commands={})
42
+ if commands.is_a?(Symbol)
43
+ run "git #{commands}"
44
+ else
45
+ commands.each do |cmd, options|
46
+ run "git #{cmd} #{options}"
47
+ end
48
+ end
28
49
  end
29
50
  end
@@ -4,8 +4,13 @@ module HW::Packages
4
4
  @@packages = {}
5
5
 
6
6
  def add name
7
- HW::Sources.all.keys.each do |directory|
8
- full_path = File.join(HW::SOURCES_PATH, directory, "#{name}.rb")
7
+ HW::Sources.all.each do |key, path|
8
+ full_path = if HW::Sources.local_source?(path)
9
+ File.join(path, "#{name}.rb")
10
+ else
11
+ File.join(HW::SOURCES_PATH, key, "#{name}.rb")
12
+ end
13
+
9
14
  @@packages[name] = full_path if File.exists?(full_path)
10
15
  end
11
16
 
@@ -1,7 +1,7 @@
1
1
  module HW
2
2
  class Thor < ::Thor
3
3
  include Thor::Actions
4
- include Rails::Generators::Actions
4
+ include Rails::Generators::Actions if defined?(Rails)
5
5
  include HW::Actions
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  module HW
2
2
  MAJOR = 1
3
3
  MINOR = 1
4
- TINY = 7
4
+ TINY = 8
5
5
  PRE = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, TINY, PRE].compact.join('.')
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.1.7
4
+ version: 1.1.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-25 00:00:00.000000000 Z
12
+ date: 2013-04-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &70146250484720 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -24,10 +24,18 @@ dependencies:
24
24
  version: '2.0'
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: *70146250484720
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 0.14.6
33
+ - - <
34
+ - !ruby/object:Gem::Version
35
+ version: '2.0'
28
36
  - !ruby/object:Gem::Dependency
29
- name: activesupport
30
- requirement: &70146250483960 !ruby/object:Gem::Requirement
37
+ name: rails
38
+ requirement: !ruby/object:Gem::Requirement
31
39
  none: false
32
40
  requirements:
33
41
  - - ~>
@@ -35,10 +43,15 @@ dependencies:
35
43
  version: '3.0'
36
44
  type: :runtime
37
45
  prerelease: false
38
- version_requirements: *70146250483960
46
+ version_requirements: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ~>
50
+ - !ruby/object:Gem::Version
51
+ version: '3.0'
39
52
  - !ruby/object:Gem::Dependency
40
53
  name: railties
41
- requirement: &70146250483500 !ruby/object:Gem::Requirement
54
+ requirement: !ruby/object:Gem::Requirement
42
55
  none: false
43
56
  requirements:
44
57
  - - ~>
@@ -46,10 +59,15 @@ dependencies:
46
59
  version: '3.0'
47
60
  type: :runtime
48
61
  prerelease: false
49
- version_requirements: *70146250483500
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ~>
66
+ - !ruby/object:Gem::Version
67
+ version: '3.0'
50
68
  - !ruby/object:Gem::Dependency
51
69
  name: git
52
- requirement: &70146250483120 !ruby/object:Gem::Requirement
70
+ requirement: !ruby/object:Gem::Requirement
53
71
  none: false
54
72
  requirements:
55
73
  - - ! '>='
@@ -57,7 +75,12 @@ dependencies:
57
75
  version: '0'
58
76
  type: :runtime
59
77
  prerelease: false
60
- version_requirements: *70146250483120
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
61
84
  description: Package manager for random tasks
62
85
  email: tmilewski@gmail.com
63
86
  executables:
@@ -89,15 +112,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
112
  - - ! '>='
90
113
  - !ruby/object:Gem::Version
91
114
  version: '0'
115
+ segments:
116
+ - 0
117
+ hash: -760293877887696916
92
118
  required_rubygems_version: !ruby/object:Gem::Requirement
93
119
  none: false
94
120
  requirements:
95
121
  - - ! '>='
96
122
  - !ruby/object:Gem::Version
97
123
  version: '0'
124
+ segments:
125
+ - 0
126
+ hash: -760293877887696916
98
127
  requirements: []
99
128
  rubyforge_project:
100
- rubygems_version: 1.8.17
129
+ rubygems_version: 1.8.25
101
130
  signing_key:
102
131
  specification_version: 3
103
132
  summary: ''