effective_developer 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +59 -0
- data/app/models/effective/code_writer.rb +5 -0
- data/lib/effective_developer/version.rb +1 -1
- data/lib/scaffolds/forms/default/_form.html.haml +4 -4
- data/lib/tasks/rename_class.rake +39 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06b214dff64baf33e2aeb2e4552600504a354b6b
|
4
|
+
data.tar.gz: c7eecfcc8f6db836fed83788f861e12a62d7d3d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
@@ -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
|
-
|
14
|
-
|
15
|
-
|
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 -%>
|
data/lib/tasks/rename_class.rake
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2017-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|