effective_developer 0.2.7 → 0.2.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74c38f7ee20c5522dcff4f6b2a6a1e58c8031f19
4
- data.tar.gz: e9111fe494d48ed6d024bca15dbc435ff3d19e9a
3
+ metadata.gz: 06b214dff64baf33e2aeb2e4552600504a354b6b
4
+ data.tar.gz: c7eecfcc8f6db836fed83788f861e12a62d7d3d2
5
5
  SHA512:
6
- metadata.gz: 6e65b13b9a3030f2853bec4aaecf5c2b0d21b8a0a349f59cb93e1051ce80ae4bc3ba7510284e79d2c13e548dd28549ae102f1d6abeff6562652e4fa01dbd6d60
7
- data.tar.gz: f20cbb3501f214a4981eedf971cd4102537f89fd710493b8fabac95e1b2eb5556885102dc5f1515764b56812322199e91c0ebd3d39448df8e37ee5a0d6d36cb1
6
+ metadata.gz: acd4ffc893452ea4287f51c8b310763e76c95211282417992ac101c95c029b0e543f7e9455f5e725310f4ec007340b8a0c3416c43a4f4a2ed11348014f0fe51a
7
+ data.tar.gz: aac13b5b604497f3aeb5e50ab0d79f20584963f0b4411dfb7577a4b1af4d6bc3b30e540d7665a9def346d51fe738242eaec402f02cd2c297f2fb264cde301ed5
data/README.md CHANGED
@@ -32,6 +32,36 @@ export PATH="$PATH:$HOME/effective_developer/bin"
32
32
 
33
33
  # Shell scripts
34
34
 
35
+ ## gem_develop
36
+
37
+ A command line shell script to update a `Gemfile` and use any provided gems locally.
38
+
39
+ This makes it very quick to swich to developing a gem locally.
40
+
41
+ `gem_develop` should be run from the root directory of any rails app.
42
+
43
+ ```console
44
+ > gem_develop effective_datatables effective_resources
45
+ ```
46
+
47
+ to change:
48
+
49
+ ```ruby
50
+ gem 'effective_datatables'
51
+ gem 'effective_resources'
52
+ ```
53
+
54
+ into:
55
+
56
+ ```ruby
57
+ gem 'effective_datatables', path: '~/Sites/effective_datatables'
58
+ gem 'effective_resources', path: '~/Sites/effective_resources'
59
+ ```
60
+
61
+ and execute `bundle`.
62
+
63
+ You can override the `~/Sites/` directory by setting `ENV['GEM_DEVELOP_PATH']`.
64
+
35
65
  ## gem_release
36
66
 
37
67
  A command line shell script that quickly bumps the version of any ruby gem.
@@ -52,6 +82,35 @@ To release a new gem version:
52
82
  > gem_release 1.0.0
53
83
  ```
54
84
 
85
+ ## gem_reset
86
+
87
+ A command line shell script to update a `Gemfile` to find any locally developed gems, and update them to the most current released version.
88
+
89
+ `gem_reset` should be run from the root directory of any rails app.
90
+
91
+ Just run with no arguments:
92
+
93
+ ```console
94
+ > gem_reset
95
+ ```
96
+
97
+ to change:
98
+
99
+ ```ruby
100
+ gem 'effective_datatables', path: '~/Sites/effective_datatables'
101
+ gem 'effective_resources', path: '~/Sites/effective_resources'
102
+ ```
103
+
104
+ into:
105
+
106
+ ```ruby
107
+ gem 'effective_datatables'
108
+ gem 'effective_resources'
109
+ ```
110
+
111
+ and execute `bundle update effective_datatables effective_resources`.
112
+
113
+
55
114
  ## gitreset
56
115
 
57
116
  Careful, this command will delete all your un committed changes.
@@ -205,6 +205,11 @@ module Effective
205
205
  lines.each { |line| @changed = true if line.gsub!(source, target) }
206
206
  end
207
207
 
208
+ def replace(index, content)
209
+ @changed = true
210
+ lines[index].replace(content.to_s)
211
+ end
212
+
208
213
  private
209
214
 
210
215
  def write!
@@ -1,3 +1,3 @@
1
1
  module EffectiveDeveloper
2
- VERSION = '0.2.7'.freeze
2
+ VERSION = '0.2.8'.freeze
3
3
  end
@@ -6,11 +6,11 @@
6
6
  <%= render_field(attribute, depth: 1) %>
7
7
  <% end -%>
8
8
 
9
- .form-actions
10
9
  <% if defined?(EffectiveResources) -%>
11
10
  = simple_form_submit(f)
12
11
  <% else -%>
13
- = f.button :submit, 'Save', data: { disable_with: 'Saving...' }
14
- = f.button :submit, 'Save and Continue', data: { disable_with: 'Saving...' }
15
- = f.button :submit, 'Save and Add New', data: { disable_with: 'Saving...' }
12
+ .form-actions
13
+ = f.button :submit, 'Save', data: { disable_with: 'Saving...' }
14
+ = f.button :submit, 'Save and Continue', data: { disable_with: 'Saving...' }
15
+ = f.button :submit, 'Save and Add New', data: { disable_with: 'Saving...' }
16
16
  <% end -%>
@@ -65,3 +65,42 @@ task :rename_class, [:source, :target, :db] => :environment do |t, args|
65
65
  end
66
66
 
67
67
  end
68
+
69
+
70
+ desc 'Rename a rails attribute to another'
71
+ task :rename_attribute, [:source, :target, :db] => :environment do |t, args|
72
+ unless args.source.present? && args.target.present?
73
+ puts 'usage: rake attribute[expire,expire_after] (or rake attribute[expire,expire_after,skipdb] to skip database migrations)' and exit
74
+ end
75
+
76
+ source = args.source.to_s.downcase
77
+ target = args.target.to_s.downcase
78
+
79
+ puts "=== Renaming attribute '#{source}' to '#{target}'"
80
+
81
+ whitelist = ['app/', 'config/locales/', 'db/', 'lib/', 'test/'].compact
82
+ blacklist = ['db/schema.rb', ('db/migrate' if args.db == 'skipdb')].compact
83
+
84
+ # Search and replace in all files
85
+ subs = {
86
+ source.classify.pluralize => target.classify.pluralize,
87
+ source.classify => target.classify,
88
+ source => target
89
+ }
90
+
91
+ if source.include?('_')
92
+ subs[source.gsub('_', '-')] ||= target
93
+ end
94
+
95
+ Dir.glob('**/*.*').each do |path|
96
+ next unless whitelist.any? { |ok| path.start_with?(ok) }
97
+ next if blacklist.any? { |nope| path.start_with?(nope) }
98
+
99
+ writer = Effective::CodeWriter.new(path) do |w|
100
+ subs.each { |k, v| w.gsub!(k, v) }
101
+ end
102
+
103
+ puts "updated: #{path}" if writer.changed?
104
+ end
105
+ end
106
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_developer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-14 00:00:00.000000000 Z
11
+ date: 2017-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails