hw 1.2.0.beta2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,6 +27,14 @@ class HW
27
27
  rake("db:migrate", env: env, silence: true)
28
28
  end
29
29
 
30
+ def migration filename, data=nil, &block
31
+ last_migration = ActiveRecord::Migrator.migrations('db/migrate').last
32
+ number = last_migration ? last_migration.version + 1 : 0
33
+ timestamp = [Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % number].max.to_i
34
+
35
+ create_file("db/migrate/#{timestamp}_#{filename.underscore}.rb", data, verbose: false, &block)
36
+ end
37
+
30
38
  def worker filename, data=nil, &block
31
39
  create_file("app/workers/#{filename}", data, verbose: false, &block)
32
40
  end
@@ -50,5 +58,15 @@ class HW
50
58
  end
51
59
  end
52
60
  end
61
+
62
+ def pbcopy(input)
63
+ str = input.to_s
64
+ IO.popen('pbcopy', 'w') { |f| f << str }
65
+ str
66
+ end
67
+
68
+ def pbpaste
69
+ `pbpaste`
70
+ end
53
71
  end
54
72
  end
@@ -3,4 +3,12 @@ class String
3
3
  string = self.to_s.sub(/^[a-z\d]*/) { $&.capitalize }
4
4
  string.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$1}#{$2.capitalize}" }.gsub('/', '::')
5
5
  end
6
+
7
+ def underscore
8
+ self.gsub(/::/, '/').
9
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
10
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
11
+ tr("-", "_").
12
+ downcase
13
+ end
6
14
  end
@@ -1,6 +1,8 @@
1
1
  begin
2
2
  require 'rails'
3
3
  require 'rails/generators/base'
4
+ require 'active_record/errors'
5
+ require 'active_record/migration'
4
6
  rescue LoadError
5
7
  puts 'This package requires Rails generators.'
6
8
  puts 'Please run `gem install rails` first!'
@@ -46,10 +46,9 @@ class HW
46
46
 
47
47
  unless local
48
48
  if File.exists?(path)
49
- git = Git.open(path, log: nil)
50
- git.lib.send :command, 'pull' # See: https://github.com/schacon/ruby-git/issues/32
49
+ Git.open(path, log: nil).lib.send(:command, 'pull') # See: https://github.com/schacon/ruby-git/issues/32
51
50
  else
52
- Git.clone(url, name, :path => SOURCES_PATH) unless local
51
+ Git.clone(url, name, :path => SOURCES_PATH)
53
52
  end
54
53
  end
55
54
 
@@ -58,20 +57,12 @@ class HW
58
57
  else
59
58
  success "Successfully pulled updates from #{url} to #{SOURCES_PATH}#{name}"
60
59
  end
61
- rescue Git::GitExecuteError => e
60
+ rescue Git::GitExecuteError
62
61
  warn "Nothing was pulled from #{url}"
63
62
  end
64
63
  end
65
64
  end
66
65
 
67
- def git_clone
68
- # TODO: Clone git repo
69
- end
70
-
71
- def git_pull
72
- # TODO: Pull changes from git repo
73
- end
74
-
75
66
  def local_source? path
76
67
  git_regex = /([A-Za-z0-9]+@|http(|s)\:\/\/)([A-Za-z0-9.]+)(:|\/)([A-Za-z0-9\-\/]+)/
77
68
  (path =~ git_regex).nil?
@@ -2,7 +2,7 @@ class HW
2
2
  MAJOR = 1
3
3
  MINOR = 2
4
4
  TINY = 0
5
- PRE = 'beta2'
5
+ PRE = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, TINY, PRE].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hw
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0.beta2
5
- prerelease: 6
4
+ version: 1.2.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tom Milewski
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-03 00:00:00.000000000 Z
12
+ date: 2013-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -115,13 +115,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
115
  version: '0'
116
116
  segments:
117
117
  - 0
118
- hash: -1259823547237976343
118
+ hash: 2133742286641577851
119
119
  required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  none: false
121
121
  requirements:
122
- - - ! '>'
122
+ - - ! '>='
123
123
  - !ruby/object:Gem::Version
124
- version: 1.3.1
124
+ version: '0'
125
+ segments:
126
+ - 0
127
+ hash: 2133742286641577851
125
128
  requirements: []
126
129
  rubyforge_project:
127
130
  rubygems_version: 1.8.25